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

◆ LAPACKE_clarfb_work()

lapack_int LAPACKE_clarfb_work ( int  matrix_layout,
char  side,
char  trans,
char  direct,
char  storev,
lapack_int  m,
lapack_int  n,
lapack_int  k,
const lapack_complex_float v,
lapack_int  ldv,
const lapack_complex_float t,
lapack_int  ldt,
lapack_complex_float c,
lapack_int  ldc,
lapack_complex_float work,
lapack_int  ldwork 
)

Definition at line 35 of file lapacke_clarfb_work.c.

42{
43 lapack_int info = 0;
44 lapack_int nrows_v, ncols_v;
45 lapack_logical left, col, forward;
46 char uplo;
47 lapack_int ldc_t, ldt_t, ldv_t;
48 lapack_complex_float *v_t = NULL, *t_t = NULL, *c_t = NULL;
49 if( matrix_layout == LAPACK_COL_MAJOR ) {
50 /* Call LAPACK function and adjust info */
51 LAPACK_clarfb( &side, &trans, &direct, &storev, &m, &n, &k, v, &ldv, t,
52 &ldt, c, &ldc, work, &ldwork );
53 if( info < 0 ) {
54 info = info - 1;
55 }
56 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
57 left = LAPACKE_lsame( side, 'l' );
58 col = LAPACKE_lsame( storev, 'c' );
59 forward = LAPACKE_lsame( direct, 'f' );
60
61 nrows_v = ( col && left ) ? m : ( ( col && !left ) ? n : ( !col ? k : 1) );
62 ncols_v = ( !col && left ) ? m : ( ( !col && !left ) ? n : ( col ? k : 1 ) );
63 uplo = ( ( left && col ) || !( left || col ) ) ? 'l' : 'u';
64
65 ldc_t = MAX(1,m);
66 ldt_t = MAX(1,k);
67 ldv_t = MAX(1,nrows_v);
68 /* Check leading dimension(s) */
69 if( ldc < n ) {
70 info = -14;
71 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
72 return info;
73 }
74 if( ldt < k ) {
75 info = -12;
76 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
77 return info;
78 }
79 if( ldv < ncols_v ) {
80 info = -10;
81 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
82 return info;
83 }
84 if( !forward && ( col && k > nrows_v ) || ( !col && k > ncols_v )) {
85 info = -8;
86 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
87 return info;
88 }
89 /* Allocate memory for temporary array(s) */
92 ldv_t * MAX(1,ncols_v) );
93 if( v_t == NULL ) {
95 goto exit_level_0;
96 }
98 LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,k) );
99 if( t_t == NULL ) {
101 goto exit_level_1;
102 }
103 c_t = (lapack_complex_float*)
104 LAPACKE_malloc( sizeof(lapack_complex_float) * ldc_t * MAX(1,n) );
105 if( c_t == NULL ) {
107 goto exit_level_2;
108 }
109 /* Transpose input matrices */
110 LAPACKE_ctz_trans( matrix_layout, direct, uplo, 'u', nrows_v, ncols_v,
111 v, ldv, v_t, ldv_t );
112 LAPACKE_cge_trans( matrix_layout, k, k, t, ldt, t_t, ldt_t );
113 LAPACKE_cge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
114 /* Call LAPACK function and adjust info */
115 LAPACK_clarfb( &side, &trans, &direct, &storev, &m, &n, &k, v_t, &ldv_t,
116 t_t, &ldt_t, c_t, &ldc_t, work, &ldwork );
117 info = 0; /* LAPACK call is ok! */
118 /* Transpose output matrices */
119 LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
120 /* Release memory and exit */
121 LAPACKE_free( c_t );
122exit_level_2:
123 LAPACKE_free( t_t );
124exit_level_1:
125 LAPACKE_free( v_t );
126exit_level_0:
127 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
128 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
129 }
130 } else {
131 info = -1;
132 LAPACKE_xerbla( "LAPACKE_clarfb_work", info );
133 }
134 return info;
135}
#define lapack_int
Definition: lapack.h:87
#define LAPACK_clarfb(...)
Definition: lapack.h:10465
#define lapack_complex_float
Definition: lapack.h:46
#define lapack_logical
Definition: lapack.h:103
#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)
void LAPACKE_ctz_trans(int matrix_layout, char direct, char uplo, char diag, 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: