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

◆ LAPACKE_cgees_work()

lapack_int LAPACKE_cgees_work ( int  matrix_layout,
char  jobvs,
char  sort,
LAPACK_C_SELECT1  select,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
lapack_int sdim,
lapack_complex_float w,
lapack_complex_float vs,
lapack_int  ldvs,
lapack_complex_float work,
lapack_int  lwork,
float *  rwork,
lapack_logical bwork 
)

Definition at line 35 of file lapacke_cgees_work.c.

42{
43 lapack_int info = 0;
44 if( matrix_layout == LAPACK_COL_MAJOR ) {
45 /* Call LAPACK function and adjust info */
46 LAPACK_cgees( &jobvs, &sort, select, &n, a, &lda, sdim, w, vs, &ldvs,
47 work, &lwork, rwork, bwork, &info );
48 if( info < 0 ) {
49 info = info - 1;
50 }
51 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52 lapack_int lda_t = MAX(1,n);
53 lapack_int ldvs_t = MAX(1,n);
54 lapack_complex_float* a_t = NULL;
55 lapack_complex_float* vs_t = NULL;
56 /* Check leading dimension(s) */
57 if( lda < n ) {
58 info = -7;
59 LAPACKE_xerbla( "LAPACKE_cgees_work", info );
60 return info;
61 }
62 if( ldvs < n ) {
63 info = -11;
64 LAPACKE_xerbla( "LAPACKE_cgees_work", info );
65 return info;
66 }
67 /* Query optimal working array(s) size if requested */
68 if( lwork == -1 ) {
69 LAPACK_cgees( &jobvs, &sort, select, &n, a, &lda_t, sdim, w, vs,
70 &ldvs_t, work, &lwork, rwork, bwork, &info );
71 return (info < 0) ? (info - 1) : 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 }
80 if( LAPACKE_lsame( jobvs, 'v' ) ) {
81 vs_t = (lapack_complex_float*)
83 ldvs_t * MAX(1,n) );
84 if( vs_t == NULL ) {
86 goto exit_level_1;
87 }
88 }
89 /* Transpose input matrices */
90 LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
91 /* Call LAPACK function and adjust info */
92 LAPACK_cgees( &jobvs, &sort, select, &n, a_t, &lda_t, sdim, w, vs_t,
93 &ldvs_t, work, &lwork, rwork, bwork, &info );
94 if( info < 0 ) {
95 info = info - 1;
96 }
97 /* Transpose output matrices */
98 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
99 if( LAPACKE_lsame( jobvs, 'v' ) ) {
100 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, vs_t, ldvs_t, vs, ldvs );
101 }
102 /* Release memory and exit */
103 if( LAPACKE_lsame( jobvs, 'v' ) ) {
104 LAPACKE_free( vs_t );
105 }
106exit_level_1:
107 LAPACKE_free( a_t );
108exit_level_0:
109 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
110 LAPACKE_xerbla( "LAPACKE_cgees_work", info );
111 }
112 } else {
113 info = -1;
114 LAPACKE_xerbla( "LAPACKE_cgees_work", info );
115 }
116 return info;
117}
#define lapack_int
Definition: lapack.h:87
#define LAPACK_cgees(...)
Definition: lapack.h:1651
#define lapack_complex_float
Definition: lapack.h:46
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
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: