LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ctpqrt2_work()

lapack_int LAPACKE_ctpqrt2_work ( int  matrix_layout,
lapack_int  m,
lapack_int  n,
lapack_int  l,
lapack_complex_float a,
lapack_int  lda,
lapack_complex_float b,
lapack_int  ldb,
lapack_complex_float t,
lapack_int  ldt 
)

Definition at line 35 of file lapacke_ctpqrt2_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_ctpqrt2( &m, &n, &l, a, &lda, b, &ldb, t, &ldt, &info );
45  if( info < 0 ) {
46  info = info - 1;
47  }
48  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
49  lapack_int lda_t = MAX(1,n);
50  lapack_int ldb_t = MAX(1,m);
51  lapack_int ldt_t = MAX(1,n);
52  lapack_complex_float* a_t = NULL;
53  lapack_complex_float* b_t = NULL;
54  lapack_complex_float* t_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < n ) {
57  info = -5;
58  LAPACKE_xerbla( "LAPACKE_ctpqrt2_work", info );
59  return info;
60  }
61  if( ldb < n ) {
62  info = -7;
63  LAPACKE_xerbla( "LAPACKE_ctpqrt2_work", info );
64  return info;
65  }
66  if( ldt < n ) {
67  info = -9;
68  LAPACKE_xerbla( "LAPACKE_ctpqrt2_work", info );
69  return info;
70  }
71  /* Allocate memory for temporary array(s) */
72  a_t = (lapack_complex_float*)
73  LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
74  if( a_t == NULL ) {
76  goto exit_level_0;
77  }
78  b_t = (lapack_complex_float*)
79  LAPACKE_malloc( sizeof(lapack_complex_float) * ldb_t * MAX(1,n) );
80  if( b_t == NULL ) {
82  goto exit_level_1;
83  }
84  t_t = (lapack_complex_float*)
85  LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
86  if( t_t == NULL ) {
88  goto exit_level_2;
89  }
90  /* Transpose input matrices */
91  LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
92  LAPACKE_cge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
93  /* Call LAPACK function and adjust info */
94  LAPACK_ctpqrt2( &m, &n, &l, a_t, &lda_t, b_t, &ldb_t, t_t, &ldt_t, &info );
95  if( info < 0 ) {
96  info = info - 1;
97  }
98  /* Transpose output matrices */
99  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
100  LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
101  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, t_t, ldt_t, t, ldt );
102  /* Release memory and exit */
103  LAPACKE_free( t_t );
104 exit_level_2:
105  LAPACKE_free( b_t );
106 exit_level_1:
107  LAPACKE_free( a_t );
108 exit_level_0:
109  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
110  LAPACKE_xerbla( "LAPACKE_ctpqrt2_work", info );
111  }
112  } else {
113  info = -1;
114  LAPACKE_xerbla( "LAPACKE_ctpqrt2_work", info );
115  }
116  return info;
117 }
void LAPACK_ctpqrt2(lapack_int const *m, lapack_int const *n, lapack_int const *l, lapack_complex_float *A, lapack_int const *lda, lapack_complex_float *B, lapack_int const *ldb, lapack_complex_float *T, lapack_int const *ldt, lapack_int *info)
#define lapack_int
Definition: lapack.h:83
#define lapack_complex_float
Definition: lapack.h:45
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACKE_free(p)
Definition: lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:56
void LAPACKE_xerbla(const char *name, lapack_int info)
#define MAX(x, y)
Definition: lapacke_utils.h:46
void LAPACKE_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: