LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dgesvj_work()

lapack_int LAPACKE_dgesvj_work ( int  matrix_layout,
char  joba,
char  jobu,
char  jobv,
lapack_int  m,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  sva,
lapack_int  mv,
double *  v,
lapack_int  ldv,
double *  work,
lapack_int  lwork 
)

Definition at line 35 of file lapacke_dgesvj_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_dgesvj( &joba, &jobu, &jobv, &m, &n, a, &lda, sva, &mv, v, &ldv,
45  work, &lwork, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int nrows_v = LAPACKE_lsame( jobv, 'v' ) ? MAX(0,n) :
51  ( LAPACKE_lsame( jobv, 'a' ) ? MAX(0,mv) : 0);
52  lapack_int lda_t = MAX(1,m);
53  lapack_int ldv_t = MAX(1,nrows_v);
54  double* a_t = NULL;
55  double* v_t = NULL;
56  /* Check leading dimension(s) */
57  if( lda < n ) {
58  info = -8;
59  LAPACKE_xerbla( "LAPACKE_dgesvj_work", info );
60  return info;
61  }
62  if( ldv < n ) {
63  info = -12;
64  LAPACKE_xerbla( "LAPACKE_dgesvj_work", info );
65  return info;
66  }
67  /* Allocate memory for temporary array(s) */
68  a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
69  if( a_t == NULL ) {
71  goto exit_level_0;
72  }
73  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
74  v_t = (double*)LAPACKE_malloc( sizeof(double) * ldv_t * MAX(1,n) );
75  if( v_t == NULL ) {
77  goto exit_level_1;
78  }
79  }
80  /* Transpose input matrices */
81  LAPACKE_dge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
82  if( LAPACKE_lsame( jobv, 'a' ) ) {
83  LAPACKE_dge_trans( matrix_layout, nrows_v, n, v, ldv, v_t, ldv_t );
84  }
85  /* Call LAPACK function and adjust info */
86  LAPACK_dgesvj( &joba, &jobu, &jobv, &m, &n, a_t, &lda_t, sva, &mv, v_t,
87  &ldv_t, work, &lwork, &info );
88  if( info < 0 ) {
89  info = info - 1;
90  }
91  /* Transpose output matrices */
92  LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
93  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
94  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_v, n, v_t, ldv_t, v,
95  ldv );
96  }
97  /* Release memory and exit */
98  if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
99  LAPACKE_free( v_t );
100  }
101 exit_level_1:
102  LAPACKE_free( a_t );
103 exit_level_0:
104  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
105  LAPACKE_xerbla( "LAPACKE_dgesvj_work", info );
106  }
107  } else {
108  info = -1;
109  LAPACKE_xerbla( "LAPACKE_dgesvj_work", info );
110  }
111  return info;
112 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_dgesvj(...)
Definition: lapack.h:3654
#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_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: