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

Go to the source code of this file.

Functions

lapack_int LAPACKE_shseqr_work (int matrix_layout, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float *h, lapack_int ldh, float *wr, float *wi, float *z, lapack_int ldz, float *work, lapack_int lwork)

Function Documentation

◆ LAPACKE_shseqr_work()

lapack_int LAPACKE_shseqr_work ( int matrix_layout,
char job,
char compz,
lapack_int n,
lapack_int ilo,
lapack_int ihi,
float * h,
lapack_int ldh,
float * wr,
float * wi,
float * z,
lapack_int ldz,
float * work,
lapack_int lwork )

Definition at line 35 of file lapacke_shseqr_work.c.

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