LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zgesvj_work()

lapack_int LAPACKE_zgesvj_work ( int  matrix_layout,
char  joba,
char  jobu,
char  jobv,
lapack_int  m,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
double *  sva,
lapack_int  mv,
lapack_complex_double v,
lapack_int  ldv,
lapack_complex_double cwork,
lapack_int  lwork,
double *  rwork,
lapack_int  lrwork 
)

Definition at line 36 of file lapacke_zgesvj_work.c.

43 {
44  lapack_int info = 0;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_zgesvj( &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_double* a_t = NULL;
58  lapack_complex_double* v_t = NULL;
59  /* Check leading dimension(s) */
60  if( lda < n ) {
61  info = -8;
62  LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
63  return info;
64  }
65  if( ldv < n ) {
66  info = -12;
67  LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
68  return info;
69  }
70  /* Allocate memory for temporary array(s) */
71  a_t = (lapack_complex_double*)
72  LAPACKE_malloc( sizeof(lapack_complex_double) * 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_double*)
79  LAPACKE_malloc( sizeof(lapack_complex_double) * ldv_t * MAX(1,n) );
80  if( v_t == NULL ) {
82  goto exit_level_1;
83  }
84  }
85  /* Transpose input matrices */
86  LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
87  if( LAPACKE_lsame( jobv, 'a' ) ) {
88  LAPACKE_zge_trans( matrix_layout, nrows_v, n, v, ldv, v_t, ldv_t );
89  }
90  /* Call LAPACK function and adjust info */
91  LAPACK_zgesvj( &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_zge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
98  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
99  LAPACKE_zge_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_zgesvj_work", info );
111  }
112  } else {
113  info = -1;
114  LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
115  }
116  return info;
117 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define lapack_complex_double
Definition: lapacke.h:90
#define MAX(x, y)
Definition: lapacke_utils.h:47
#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
void LAPACK_zgesvj(char *joba, char *jobu, char *jobv, lapack_int *m, lapack_int *n, lapack_complex_double *a, lapack_int *lda, double *sva, lapack_int *mv, lapack_complex_double *v, lapack_int *ldv, lapack_complex_double *cwork, lapack_int *lwork, double *rwork, lapack_int *lrwork, lapack_int *info)
#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: