LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ssbgv_work()

lapack_int LAPACKE_ssbgv_work ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_int  ka,
lapack_int  kb,
float *  ab,
lapack_int  ldab,
float *  bb,
lapack_int  ldbb,
float *  w,
float *  z,
lapack_int  ldz,
float *  work 
)

Definition at line 35 of file lapacke_ssbgv_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_ssbgv( &jobz, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb, w, z,
45  &ldz, work, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int ldab_t = MAX(1,ka+1);
51  lapack_int ldbb_t = MAX(1,kb+1);
52  lapack_int ldz_t = MAX(1,n);
53  float* ab_t = NULL;
54  float* bb_t = NULL;
55  float* z_t = NULL;
56  /* Check leading dimension(s) */
57  if( ldab < n ) {
58  info = -8;
59  LAPACKE_xerbla( "LAPACKE_ssbgv_work", info );
60  return info;
61  }
62  if( ldbb < n ) {
63  info = -10;
64  LAPACKE_xerbla( "LAPACKE_ssbgv_work", info );
65  return info;
66  }
67  if( ldz < n ) {
68  info = -13;
69  LAPACKE_xerbla( "LAPACKE_ssbgv_work", info );
70  return info;
71  }
72  /* Allocate memory for temporary array(s) */
73  ab_t = (float*)LAPACKE_malloc( sizeof(float) * ldab_t * MAX(1,n) );
74  if( ab_t == NULL ) {
76  goto exit_level_0;
77  }
78  bb_t = (float*)LAPACKE_malloc( sizeof(float) * ldbb_t * MAX(1,n) );
79  if( bb_t == NULL ) {
81  goto exit_level_1;
82  }
83  if( LAPACKE_lsame( jobz, 'v' ) ) {
84  z_t = (float*)LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,n) );
85  if( z_t == NULL ) {
87  goto exit_level_2;
88  }
89  }
90  /* Transpose input matrices */
91  LAPACKE_ssb_trans( matrix_layout, uplo, n, ka, ab, ldab, ab_t, ldab_t );
92  LAPACKE_ssb_trans( matrix_layout, uplo, n, kb, bb, ldbb, bb_t, ldbb_t );
93  /* Call LAPACK function and adjust info */
94  LAPACK_ssbgv( &jobz, &uplo, &n, &ka, &kb, ab_t, &ldab_t, bb_t, &ldbb_t,
95  w, z_t, &ldz_t, work, &info );
96  if( info < 0 ) {
97  info = info - 1;
98  }
99  /* Transpose output matrices */
100  LAPACKE_ssb_trans( LAPACK_COL_MAJOR, uplo, n, ka, ab_t, ldab_t, ab,
101  ldab );
102  LAPACKE_ssb_trans( LAPACK_COL_MAJOR, uplo, n, kb, bb_t, ldbb_t, bb,
103  ldbb );
104  if( LAPACKE_lsame( jobz, 'v' ) ) {
105  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
106  }
107  /* Release memory and exit */
108  if( LAPACKE_lsame( jobz, 'v' ) ) {
109  LAPACKE_free( z_t );
110  }
111 exit_level_2:
112  LAPACKE_free( bb_t );
113 exit_level_1:
114  LAPACKE_free( ab_t );
115 exit_level_0:
116  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
117  LAPACKE_xerbla( "LAPACKE_ssbgv_work", info );
118  }
119  } else {
120  info = -1;
121  LAPACKE_xerbla( "LAPACKE_ssbgv_work", info );
122  }
123  return info;
124 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_ssbgv(...)
Definition: lapack.h:15042
#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
void LAPACKE_ssb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const float *in, lapack_int ldin, float *out, lapack_int ldout)
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *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: