LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_chseqr_work()

lapack_int LAPACKE_chseqr_work ( int  matrix_layout,
char  job,
char  compz,
lapack_int  n,
lapack_int  ilo,
lapack_int  ihi,
lapack_complex_float h,
lapack_int  ldh,
lapack_complex_float w,
lapack_complex_float z,
lapack_int  ldz,
lapack_complex_float work,
lapack_int  lwork 
)

Definition at line 35 of file lapacke_chseqr_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_chseqr( &job, &compz, &n, &ilo, &ihi, h, &ldh, w, z, &ldz, work,
46  &lwork, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldh_t = MAX(1,n);
52  lapack_int ldz_t = MAX(1,n);
53  lapack_complex_float* h_t = NULL;
54  lapack_complex_float* z_t = NULL;
55  /* Check leading dimension(s) */
56  if( ldh < n ) {
57  info = -8;
58  LAPACKE_xerbla( "LAPACKE_chseqr_work", info );
59  return info;
60  }
61  if( ldz < n ) {
62  info = -11;
63  LAPACKE_xerbla( "LAPACKE_chseqr_work", info );
64  return info;
65  }
66  /* Query optimal working array(s) size if requested */
67  if( lwork == -1 ) {
68  LAPACK_chseqr( &job, &compz, &n, &ilo, &ihi, h, &ldh_t, w, z,
69  &ldz_t, work, &lwork, &info );
70  return (info < 0) ? (info - 1) : info;
71  }
72  /* Allocate memory for temporary array(s) */
73  h_t = (lapack_complex_float*)
74  LAPACKE_malloc( sizeof(lapack_complex_float) * ldh_t * MAX(1,n) );
75  if( h_t == NULL ) {
77  goto exit_level_0;
78  }
79  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
80  z_t = (lapack_complex_float*)
82  ldz_t * MAX(1,n) );
83  if( z_t == NULL ) {
85  goto exit_level_1;
86  }
87  }
88  /* Transpose input matrices */
89  LAPACKE_cge_trans( matrix_layout, n, n, h, ldh, h_t, ldh_t );
90  if( LAPACKE_lsame( compz, 'v' ) ) {
91  LAPACKE_cge_trans( matrix_layout, n, n, z, ldz, z_t, ldz_t );
92  }
93  /* Call LAPACK function and adjust info */
94  LAPACK_chseqr( &job, &compz, &n, &ilo, &ihi, h_t, &ldh_t, w, z_t,
95  &ldz_t, work, &lwork, &info );
96  if( info < 0 ) {
97  info = info - 1;
98  }
99  /* Transpose output matrices */
100  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, h_t, ldh_t, h, ldh );
101  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
102  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
103  }
104  /* Release memory and exit */
105  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
106  LAPACKE_free( z_t );
107  }
108 exit_level_1:
109  LAPACKE_free( h_t );
110 exit_level_0:
111  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
112  LAPACKE_xerbla( "LAPACKE_chseqr_work", info );
113  }
114  } else {
115  info = -1;
116  LAPACKE_xerbla( "LAPACKE_chseqr_work", info );
117  }
118  return info;
119 }
#define lapack_int
Definition: lapack.h:83
#define lapack_complex_float
Definition: lapack.h:45
#define LAPACK_chseqr(...)
Definition: lapack.h:9134
#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_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: