OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
lapacke_chbevd_2stage_work.c File Reference
#include "lapacke_utils.h"

Go to the source code of this file.

Functions

lapack_int LAPACKE_chbevd_2stage_work (int matrix_layout, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_float *ab, lapack_int ldab, float *w, lapack_complex_float *z, lapack_int ldz, lapack_complex_float *work, lapack_int lwork, float *rwork, lapack_int lrwork, lapack_int *iwork, lapack_int liwork)

Function Documentation

◆ LAPACKE_chbevd_2stage_work()

lapack_int LAPACKE_chbevd_2stage_work ( int matrix_layout,
char jobz,
char uplo,
lapack_int n,
lapack_int kd,
lapack_complex_float * ab,
lapack_int ldab,
float * w,
lapack_complex_float * z,
lapack_int ldz,
lapack_complex_float * work,
lapack_int lwork,
float * rwork,
lapack_int lrwork,
lapack_int * iwork,
lapack_int liwork )

Definition at line 35 of file lapacke_chbevd_2stage_work.c.

43{
44 lapack_int info = 0;
45 if( matrix_layout == LAPACK_COL_MAJOR ) {
46 /* Call LAPACK function and adjust info */
47 LAPACK_chbevd_2stage( &jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work,
48 &lwork, rwork, &lrwork, iwork, &liwork, &info );
49 if( info < 0 ) {
50 info = info - 1;
51 }
52 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53 lapack_int ldab_t = MAX(1,kd+1);
54 lapack_int ldz_t = MAX(1,n);
55 lapack_complex_float* ab_t = NULL;
56 lapack_complex_float* z_t = NULL;
57 /* Check leading dimension(s) */
58 if( ldab < n ) {
59 info = -7;
60 LAPACKE_xerbla( "LAPACKE_chbevd_2stage_work", info );
61 return info;
62 }
63 if( ldz < n ) {
64 info = -10;
65 LAPACKE_xerbla( "LAPACKE_chbevd_2stage_work", info );
66 return info;
67 }
68 /* Query optimal working array(s) size if requested */
69 if( liwork == -1 || lrwork == -1 || lwork == -1 ) {
70 LAPACK_chbevd_2stage( &jobz, &uplo, &n, &kd, ab, &ldab_t, w, z, &ldz_t,
71 work, &lwork, rwork, &lrwork, iwork, &liwork,
72 &info );
73 return (info < 0) ? (info - 1) : info;
74 }
75 /* Allocate memory for temporary array(s) */
76 ab_t = (lapack_complex_float*)
77 LAPACKE_malloc( sizeof(lapack_complex_float) * ldab_t * MAX(1,n) );
78 if( ab_t == NULL ) {
80 goto exit_level_0;
81 }
82 if( LAPACKE_lsame( jobz, 'v' ) ) {
85 ldz_t * MAX(1,n) );
86 if( z_t == NULL ) {
88 goto exit_level_1;
89 }
90 }
91 /* Transpose input matrices */
92 LAPACKE_chb_trans( matrix_layout, uplo, n, kd, ab, ldab, ab_t, ldab_t );
93 /* Call LAPACK function and adjust info */
94 LAPACK_chbevd_2stage( &jobz, &uplo, &n, &kd, ab_t, &ldab_t, w, z_t, &ldz_t,
95 work, &lwork, rwork, &lrwork, iwork, &liwork, &info );
96 if( info < 0 ) {
97 info = info - 1;
98 }
99 /* Transpose output matrices */
100 LAPACKE_chb_trans( LAPACK_COL_MAJOR, uplo, n, kd, ab_t, ldab_t, ab,
101 ldab );
102 if( LAPACKE_lsame( jobz, 'v' ) ) {
103 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
104 }
105 /* Release memory and exit */
106 if( LAPACKE_lsame( jobz, 'v' ) ) {
107 LAPACKE_free( z_t );
108 }
109exit_level_1:
110 LAPACKE_free( ab_t );
111exit_level_0:
112 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
113 LAPACKE_xerbla( "LAPACKE_chbevd_2stage_work", info );
114 }
115 } else {
116 info = -1;
117 LAPACKE_xerbla( "LAPACKE_chbevd_2stage_work", info );
118 }
119 return info;
120}
#define lapack_int
Definition lapack.h:83
#define LAPACK_chbevd_2stage(...)
Definition lapack.h:6258
#define lapack_complex_float
Definition lapack.h:45
#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)
void LAPACKE_xerbla(const char *name, lapack_int info)
#define MAX(x, y)
void LAPACKE_chb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
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)
n