LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_cgesvj_work ( int  matrix_layout,
char  joba,
char  jobu,
char  jobv,
lapack_int  m,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
float *  sva,
lapack_int  mv,
lapack_complex_float v,
lapack_int  ldv,
lapack_complex_float cwork,
lapack_int  lwork,
float *  rwork,
lapack_int  lrwork 
)

Definition at line 36 of file lapacke_cgesvj_work.c.

43 {
44  lapack_int info = 0;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_cgesvj( &joba, &jobu, &jobv, &m, &n, a, &lda, sva, &mv, v, &ldv,
48  cwork, &lwork, rwork, &lrwork, &info );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  lapack_int nrows_v = LAPACKE_lsame( jobv, 'v' ) ? MAX(0,n) :
54  ( LAPACKE_lsame( jobv, 'a' ) ? MAX(0,mv) : 0);
55  lapack_int lda_t = MAX(1,m);
56  lapack_int ldv_t = MAX(1,nrows_v);
57  lapack_complex_float* a_t = NULL;
58  lapack_complex_float* v_t = NULL;
59  /* Check leading dimension(s) */
60  if( lda < n ) {
61  info = -8;
62  LAPACKE_xerbla( "LAPACKE_cgesvj_work", info );
63  return info;
64  }
65  if( ldv < n ) {
66  info = -12;
67  LAPACKE_xerbla( "LAPACKE_cgesvj_work", info );
68  return info;
69  }
70  /* Allocate memory for temporary array(s) */
71  a_t = (lapack_complex_float*)
72  LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
73  if( a_t == NULL ) {
75  goto exit_level_0;
76  }
77  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
78  v_t = (lapack_complex_float*)
79  LAPACKE_malloc( sizeof(lapack_complex_float) * ldv_t * MAX(1,n) );
80  if( v_t == NULL ) {
82  goto exit_level_1;
83  }
84  }
85  /* Transpose input matrices */
86  LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
87  if( LAPACKE_lsame( jobv, 'a' ) ) {
88  LAPACKE_cge_trans( matrix_layout, nrows_v, n, v, ldv, v_t, ldv_t );
89  }
90  /* Call LAPACK function and adjust info */
91  LAPACK_cgesvj( &joba, &jobu, &jobv, &m, &n, a_t, &lda_t, sva, &mv, v_t,
92  &ldv_t, cwork, &lwork, rwork, &lrwork, &info );
93  if( info < 0 ) {
94  info = info - 1;
95  }
96  /* Transpose output matrices */
97  LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
98  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
99  LAPACKE_cge_trans( LAPACK_COL_MAJOR, nrows_v, n, v_t, ldv_t, v,
100  ldv );
101  }
102  /* Release memory and exit */
103  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
104  LAPACKE_free( v_t );
105  }
106 exit_level_1:
107  LAPACKE_free( a_t );
108 exit_level_0:
109  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
110  LAPACKE_xerbla( "LAPACKE_cgesvj_work", info );
111  }
112  } else {
113  info = -1;
114  LAPACKE_xerbla( "LAPACKE_cgesvj_work", info );
115  }
116  return info;
117 }
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)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_float
Definition: lapacke.h:74
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
void LAPACK_cgesvj(char *joba, char *jobu, char *jobv, lapack_int *m, lapack_int *n, lapack_complex_float *a, lapack_int *lda, float *sva, lapack_int *mv, lapack_complex_float *v, lapack_int *ldv, lapack_complex_float *cwork, lapack_int *lwork, float *rwork, lapack_int *lrwork, lapack_int *info)

Here is the call graph for this function:

Here is the caller graph for this function: