LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dtrsna_work()

lapack_int LAPACKE_dtrsna_work ( int  matrix_layout,
char  job,
char  howmny,
const lapack_logical select,
lapack_int  n,
const double *  t,
lapack_int  ldt,
const double *  vl,
lapack_int  ldvl,
const double *  vr,
lapack_int  ldvr,
double *  s,
double *  sep,
lapack_int  mm,
lapack_int m,
double *  work,
lapack_int  ldwork,
lapack_int iwork 
)

Definition at line 36 of file lapacke_dtrsna_work.c.

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