LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_strevc_work()

lapack_int LAPACKE_strevc_work ( int  matrix_layout,
char  side,
char  howmny,
lapack_logical select,
lapack_int  n,
const float *  t,
lapack_int  ldt,
float *  vl,
lapack_int  ldvl,
float *  vr,
lapack_int  ldvr,
lapack_int  mm,
lapack_int m,
float *  work 
)

Definition at line 35 of file lapacke_strevc_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_strevc( &side, &howmny, select, &n, t, &ldt, vl, &ldvl, vr,
45  &ldvr, &mm, m, work, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int ldt_t = MAX(1,n);
51  lapack_int ldvl_t = MAX(1,n);
52  lapack_int ldvr_t = MAX(1,n);
53  float* t_t = NULL;
54  float* vl_t = NULL;
55  float* vr_t = NULL;
56  /* Check leading dimension(s) */
57  if( ldt < n ) {
58  info = -7;
59  LAPACKE_xerbla( "LAPACKE_strevc_work", info );
60  return info;
61  }
62  if( ldvl < mm ) {
63  info = -9;
64  LAPACKE_xerbla( "LAPACKE_strevc_work", info );
65  return info;
66  }
67  if( ldvr < mm ) {
68  info = -11;
69  LAPACKE_xerbla( "LAPACKE_strevc_work", info );
70  return info;
71  }
72  /* Allocate memory for temporary array(s) */
73  t_t = (float*)LAPACKE_malloc( sizeof(float) * ldt_t * MAX(1,n) );
74  if( t_t == NULL ) {
76  goto exit_level_0;
77  }
78  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
79  vl_t = (float*)LAPACKE_malloc( sizeof(float) * ldvl_t * MAX(1,mm) );
80  if( vl_t == NULL ) {
82  goto exit_level_1;
83  }
84  }
85  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
86  vr_t = (float*)LAPACKE_malloc( sizeof(float) * ldvr_t * MAX(1,mm) );
87  if( vr_t == NULL ) {
89  goto exit_level_2;
90  }
91  }
92  /* Transpose input matrices */
93  LAPACKE_sge_trans( matrix_layout, n, n, t, ldt, t_t, ldt_t );
94  if( ( LAPACKE_lsame( side, 'l' ) || LAPACKE_lsame( side, 'b' ) ) &&
95  LAPACKE_lsame( howmny, 'b' ) ) {
96  LAPACKE_sge_trans( matrix_layout, n, mm, vl, ldvl, vl_t, ldvl_t );
97  }
98  if( ( LAPACKE_lsame( side, 'r' ) || LAPACKE_lsame( side, 'b' ) ) &&
99  LAPACKE_lsame( howmny, 'b' ) ) {
100  LAPACKE_sge_trans( matrix_layout, n, mm, vr, ldvr, vr_t, ldvr_t );
101  }
102  /* Call LAPACK function and adjust info */
103  LAPACK_strevc( &side, &howmny, select, &n, t_t, &ldt_t, vl_t, &ldvl_t,
104  vr_t, &ldvr_t, &mm, m, work, &info );
105  if( info < 0 ) {
106  info = info - 1;
107  }
108  /* Transpose output matrices */
109  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
110  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, mm, vl_t, ldvl_t, vl,
111  ldvl );
112  }
113  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
114  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, mm, vr_t, ldvr_t, vr,
115  ldvr );
116  }
117  /* Release memory and exit */
118  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
119  LAPACKE_free( vr_t );
120  }
121 exit_level_2:
122  if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
123  LAPACKE_free( vl_t );
124  }
125 exit_level_1:
126  LAPACKE_free( t_t );
127 exit_level_0:
128  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
129  LAPACKE_xerbla( "LAPACKE_strevc_work", info );
130  }
131  } else {
132  info = -1;
133  LAPACKE_xerbla( "LAPACKE_strevc_work", info );
134  }
135  return info;
136 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_strevc(...)
Definition: lapack.h:21463
#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)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function:
Here is the caller graph for this function: