LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zstedc_work()

lapack_int LAPACKE_zstedc_work ( int  matrix_layout,
char  compz,
lapack_int  n,
double *  d,
double *  e,
lapack_complex_double z,
lapack_int  ldz,
lapack_complex_double work,
lapack_int  lwork,
double *  rwork,
lapack_int  lrwork,
lapack_int iwork,
lapack_int  liwork 
)

Definition at line 35 of file lapacke_zstedc_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_zstedc( &compz, &n, d, e, z, &ldz, work, &lwork, rwork, &lrwork,
46  iwork, &liwork, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldz_t = MAX(1,n);
52  lapack_complex_double* z_t = NULL;
53  /* Check leading dimension(s) */
54  if( ldz < n ) {
55  info = -7;
56  LAPACKE_xerbla( "LAPACKE_zstedc_work", info );
57  return info;
58  }
59  /* Query optimal working array(s) size if requested */
60  if( liwork == -1 || lrwork == -1 || lwork == -1 ) {
61  LAPACK_zstedc( &compz, &n, d, e, z, &ldz_t, work, &lwork, rwork,
62  &lrwork, iwork, &liwork, &info );
63  return (info < 0) ? (info - 1) : info;
64  }
65  /* Allocate memory for temporary array(s) */
66  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
67  z_t = (lapack_complex_double*)
69  ldz_t * MAX(1,n) );
70  if( z_t == NULL ) {
72  goto exit_level_0;
73  }
74  }
75  /* Transpose input matrices */
76  if( LAPACKE_lsame( compz, 'v' ) ) {
77  LAPACKE_zge_trans( matrix_layout, n, n, z, ldz, z_t, ldz_t );
78  }
79  /* Call LAPACK function and adjust info */
80  LAPACK_zstedc( &compz, &n, d, e, z_t, &ldz_t, work, &lwork, rwork,
81  &lrwork, iwork, &liwork, &info );
82  if( info < 0 ) {
83  info = info - 1;
84  }
85  /* Transpose output matrices */
86  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
87  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
88  }
89  /* Release memory and exit */
90  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
91  LAPACKE_free( z_t );
92  }
93 exit_level_0:
94  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
95  LAPACKE_xerbla( "LAPACKE_zstedc_work", info );
96  }
97  } else {
98  info = -1;
99  LAPACKE_xerbla( "LAPACKE_zstedc_work", info );
100  }
101  return info;
102 }
#define LAPACK_zstedc(...)
Definition: lapack.h:16198
#define lapack_int
Definition: lapack.h:83
#define lapack_complex_double
Definition: lapack.h:63
#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)
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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function:
Here is the caller graph for this function: