LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_zgejsv_work ( int  matrix_layout,
char  joba,
char  jobu,
char  jobv,
char  jobr,
char  jobt,
char  jobp,
lapack_int  m,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
double *  sva,
lapack_complex_double u,
lapack_int  ldu,
lapack_complex_double v,
lapack_int  ldv,
lapack_complex_double cwork,
lapack_int  lwork,
double *  rwork,
lapack_int  lrwork,
lapack_int iwork 
)

Definition at line 36 of file lapacke_zgejsv_work.c.

44 {
45  lapack_int info = 0;
46  if( matrix_layout == LAPACK_COL_MAJOR ) {
47  /* Call LAPACK function and adjust info */
48  LAPACK_zgejsv( &joba, &jobu, &jobv, &jobr, &jobt, &jobp, &m, &n, a,
49  &lda, sva, u, &ldu, v, &ldv, cwork, &lwork, rwork, &lrwork,
50  iwork, &info );
51  if( info < 0 ) {
52  info = info - 1;
53  }
54  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
55  lapack_int nu = LAPACKE_lsame( jobu, 'n' ) ? 1 : m;
56  lapack_int nv = LAPACKE_lsame( jobv, 'n' ) ? 1 : n;
57  lapack_int ncols_u = LAPACKE_lsame( jobu, 'n' ) ? 1 :
58  LAPACKE_lsame( jobu, 'f' ) ? m : n;
59  lapack_int lda_t = MAX(1,m);
60  lapack_int ldu_t = MAX(1,nu);
61  lapack_int ldv_t = MAX(1,nv);
62  lapack_complex_double* a_t = NULL;
63  lapack_complex_double* u_t = NULL;
64  lapack_complex_double* v_t = NULL;
65  /* Check leading dimension(s) */
66  if( lda < n ) {
67  info = -11;
68  LAPACKE_xerbla( "LAPACKE_zgejsv_work", info );
69  return info;
70  }
71  if( ldu < ncols_u ) {
72  info = -14;
73  LAPACKE_xerbla( "LAPACKE_zgejsv_work", info );
74  return info;
75  }
76  if( ldv < n ) {
77  info = -16;
78  LAPACKE_xerbla( "LAPACKE_zgejsv_work", info );
79  return info;
80  }
81  /* Allocate memory for temporary array(s) */
82  a_t = (lapack_complex_double*)
83  LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
84  if( a_t == NULL ) {
86  goto exit_level_0;
87  }
88  if( LAPACKE_lsame( jobu, 'f' ) || LAPACKE_lsame( jobu, 'u' ) ||
89  LAPACKE_lsame( jobu, 'w' ) ) {
90  u_t = (lapack_complex_double*)
91  LAPACKE_malloc( sizeof(lapack_complex_double) * ldu_t * MAX(1,ncols_u) );
92  if( u_t == NULL ) {
94  goto exit_level_1;
95  }
96  }
97  if( LAPACKE_lsame( jobv, 'j' ) || LAPACKE_lsame( jobv, 'v' ) ||
98  LAPACKE_lsame( jobv, 'w' ) ) {
99  v_t = (lapack_complex_double*)
100  LAPACKE_malloc( sizeof(lapack_complex_double) * ldv_t * MAX(1,n) );
101  if( v_t == NULL ) {
103  goto exit_level_2;
104  }
105  }
106  /* Transpose input matrices */
107  LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
108  /* Call LAPACK function and adjust info */
109  LAPACK_zgejsv( &joba, &jobu, &jobv, &jobr, &jobt, &jobp, &m, &n, a_t,
110  &lda_t, sva, u_t, &ldu_t, v_t, &ldv_t, cwork, &lwork,
111  rwork, &lrwork, iwork, &info );
112  if( info < 0 ) {
113  info = info - 1;
114  }
115  /* Transpose output matrices */
116  if( LAPACKE_lsame( jobu, 'f' ) || LAPACKE_lsame( jobu, 'u' ) ||
117  LAPACKE_lsame( jobu, 'w' ) ) {
118  LAPACKE_zge_trans( LAPACK_COL_MAJOR, nu, ncols_u, u_t, ldu_t, u, ldu );
119  }
120  if( LAPACKE_lsame( jobv, 'j' ) || LAPACKE_lsame( jobv, 'v' ) ||
121  LAPACKE_lsame( jobv, 'w' ) ) {
122  LAPACKE_zge_trans( LAPACK_COL_MAJOR, nv, n, v_t, ldv_t, v, ldv );
123  }
124  /* Release memory and exit */
125  if( LAPACKE_lsame( jobv, 'j' ) || LAPACKE_lsame( jobv, 'v' ) ||
126  LAPACKE_lsame( jobv, 'w' ) ) {
127  LAPACKE_free( v_t );
128  }
129 exit_level_2:
130  if( LAPACKE_lsame( jobu, 'f' ) || LAPACKE_lsame( jobu, 'u' ) ||
131  LAPACKE_lsame( jobu, 'w' ) ) {
132  LAPACKE_free( u_t );
133  }
134 exit_level_1:
135  LAPACKE_free( a_t );
136 exit_level_0:
137  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
138  LAPACKE_xerbla( "LAPACKE_zgejsv_work", info );
139  }
140  } else {
141  info = -1;
142  LAPACKE_xerbla( "LAPACKE_zgejsv_work", info );
143  }
144  return info;
145 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_double
Definition: lapacke.h:90
void LAPACK_zgejsv(char *joba, char *jobu, char *jobv, char *jobr, char *jobt, char *jobp, lapack_int *m, lapack_int *n, lapack_complex_double *a, lapack_int *lda, double *sva, lapack_complex_double *u, lapack_int *ldu, lapack_complex_double *v, lapack_int *ldv, lapack_complex_double *cwork, lapack_int *lwork, double *work, lapack_int *lrwork, lapack_int *iwork, lapack_int *info)
#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 LAPACKE_zge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)

Here is the call graph for this function:

Here is the caller graph for this function: