LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ LAPACKE_ctpqrt_work()

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

Definition at line 35 of file lapacke_ctpqrt_work.c.

41{
42 lapack_int info = 0;
43 if( matrix_layout == LAPACK_COL_MAJOR ) {
44 /* Call LAPACK function and adjust info */
45 LAPACK_ctpqrt( &m, &n, &l, &nb, a, &lda, b, &ldb, t, &ldt, work,
46 &info );
47 if( info < 0 ) {
48 info = info - 1;
49 }
50 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51 lapack_int lda_t = MAX(1,n);
52 lapack_int ldb_t = MAX(1,m);
53 lapack_int ldt_t = MAX(1,nb);
54 lapack_complex_float* a_t = NULL;
55 lapack_complex_float* t_t = NULL;
56 lapack_complex_float* b_t = NULL;
57 /* Check leading dimension(s) */
58 if( lda < n ) {
59 info = -7;
60 LAPACKE_xerbla( "LAPACKE_ctpqrt_work", info );
61 return info;
62 }
63 if( ldb < n ) {
64 info = -10;
65 LAPACKE_xerbla( "LAPACKE_ctpqrt_work", info );
66 return info;
67 }
68 if( ldt < n ) {
69 info = -11;
70 LAPACKE_xerbla( "LAPACKE_ctpqrt_work", info );
71 return info;
72 }
73 /* Allocate memory for temporary array(s) */
75 LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
76 if( a_t == NULL ) {
78 goto exit_level_0;
79 }
81 LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
82 if( t_t == NULL ) {
84 goto exit_level_1;
85 }
87 LAPACKE_malloc( sizeof(lapack_complex_float) * ldb_t * MAX(1,n) );
88 if( b_t == NULL ) {
90 goto exit_level_2;
91 }
92 /* Transpose input matrices */
93 LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
94 LAPACKE_cge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
95 /* Call LAPACK function and adjust info */
96 LAPACK_ctpqrt( &m, &n, &l, &nb, a_t, &lda_t, b_t, &ldb_t, t_t, &ldt_t,
97 work, &info );
98 if( info < 0 ) {
99 info = info - 1;
100 }
101 /* Transpose output matrices */
102 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
103 LAPACKE_cge_trans( LAPACK_COL_MAJOR, nb, n, t_t, ldt_t, t, ldt );
104 LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
105 /* Release memory and exit */
106 LAPACKE_free( b_t );
107exit_level_2:
108 LAPACKE_free( t_t );
109exit_level_1:
110 LAPACKE_free( a_t );
111exit_level_0:
112 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
113 LAPACKE_xerbla( "LAPACKE_ctpqrt_work", info );
114 }
115 } else {
116 info = -1;
117 LAPACKE_xerbla( "LAPACKE_ctpqrt_work", info );
118 }
119 return info;
120}
#define lapack_int
Definition: lapack.h:87
#define lapack_complex_float
Definition: lapack.h:46
#define LAPACK_ctpqrt
Definition: lapack.h:20847
#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: