LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_strsen()

lapack_int LAPACKE_strsen ( int  matrix_layout,
char  job,
char  compq,
const lapack_logical select,
lapack_int  n,
float *  t,
lapack_int  ldt,
float *  q,
lapack_int  ldq,
float *  wr,
float *  wi,
lapack_int m,
float *  s,
float *  sep 
)

Definition at line 36 of file lapacke_strsen.c.

40 {
41  lapack_int info = 0;
42  lapack_int liwork = -1;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  float* work = NULL;
46  lapack_int iwork_query;
47  float work_query;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_strsen", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  /* Optionally check input matrices for NaNs */
54  if( LAPACKE_lsame( compq, 'v' ) ) {
55  if( LAPACKE_sge_nancheck( matrix_layout, n, n, q, ldq ) ) {
56  return -8;
57  }
58  }
59  if( LAPACKE_sge_nancheck( matrix_layout, n, n, t, ldt ) ) {
60  return -6;
61  }
62 #endif
63  /* Query optimal working array(s) size */
64  info = LAPACKE_strsen_work( matrix_layout, job, compq, select, n, t, ldt, q,
65  ldq, wr, wi, m, s, sep, &work_query, lwork,
66  &iwork_query, liwork );
67  if( info != 0 ) {
68  goto exit_level_0;
69  }
70  liwork = (lapack_int)iwork_query;
71  lwork = (lapack_int)work_query;
72  /* Allocate memory for work arrays */
73  if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
74  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
75  if( iwork == NULL ) {
77  goto exit_level_0;
78  }
79  }
80  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
81  if( work == NULL ) {
83  goto exit_level_1;
84  }
85  /* Call middle-level interface */
86  info = LAPACKE_strsen_work( matrix_layout, job, compq, select, n, t, ldt, q,
87  ldq, wr, wi, m, s, sep, work, lwork, iwork,
88  liwork );
89  /* Release memory and exit */
90  LAPACKE_free( work );
91 exit_level_1:
92  if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
93  LAPACKE_free( iwork );
94  }
95 exit_level_0:
96  if( info == LAPACK_WORK_MEMORY_ERROR ) {
97  LAPACKE_xerbla( "LAPACKE_strsen", info );
98  }
99  return info;
100 }
lapack_int LAPACKE_strsen_work(int matrix_layout, char job, char compq, const lapack_logical *select, lapack_int n, float *t, lapack_int ldt, float *q, lapack_int ldq, float *wr, float *wi, lapack_int *m, float *s, float *sep, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
#define LAPACKE_free(p)
Definition: lapacke.h:113
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#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
Here is the call graph for this function: