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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dgeesx_work (int matrix_layout, char jobvs, char sort, LAPACK_D_SELECT2 select, char sense, lapack_int n, double *a, lapack_int lda, lapack_int *sdim, double *wr, double *wi, double *vs, lapack_int ldvs, double *rconde, double *rcondv, double *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork, lapack_logical *bwork)

Function Documentation

◆ LAPACKE_dgeesx_work()

lapack_int LAPACKE_dgeesx_work ( int matrix_layout,
char jobvs,
char sort,
LAPACK_D_SELECT2 select,
char sense,
lapack_int n,
double * a,
lapack_int lda,
lapack_int * sdim,
double * wr,
double * wi,
double * vs,
lapack_int ldvs,
double * rconde,
double * rcondv,
double * work,
lapack_int lwork,
lapack_int * iwork,
lapack_int liwork,
lapack_logical * bwork )

Definition at line 35 of file lapacke_dgeesx_work.c.

43{
44 lapack_int info = 0;
45 if( matrix_layout == LAPACK_COL_MAJOR ) {
46 /* Call LAPACK function and adjust info */
47 LAPACK_dgeesx( &jobvs, &sort, select, &sense, &n, a, &lda, sdim, wr, wi,
48 vs, &ldvs, rconde, rcondv, work, &lwork, iwork, &liwork,
49 bwork, &info );
50 if( info < 0 ) {
51 info = info - 1;
52 }
53 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54 lapack_int lda_t = MAX(1,n);
55 lapack_int ldvs_t = MAX(1,n);
56 double* a_t = NULL;
57 double* vs_t = NULL;
58 /* Check leading dimension(s) */
59 if( lda < n ) {
60 info = -8;
61 LAPACKE_xerbla( "LAPACKE_dgeesx_work", info );
62 return info;
63 }
64 if( ldvs < n ) {
65 info = -13;
66 LAPACKE_xerbla( "LAPACKE_dgeesx_work", info );
67 return info;
68 }
69 /* Query optimal working array(s) size if requested */
70 if( liwork == -1 || lwork == -1 ) {
71 LAPACK_dgeesx( &jobvs, &sort, select, &sense, &n, a, &lda_t, sdim,
72 wr, wi, vs, &ldvs_t, rconde, rcondv, work, &lwork,
73 iwork, &liwork, bwork, &info );
74 return (info < 0) ? (info - 1) : info;
75 }
76 /* Allocate memory for temporary array(s) */
77 a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
78 if( a_t == NULL ) {
80 goto exit_level_0;
81 }
82 if( LAPACKE_lsame( jobvs, 'v' ) ) {
83 vs_t = (double*)
84 LAPACKE_malloc( sizeof(double) * ldvs_t * MAX(1,n) );
85 if( vs_t == NULL ) {
87 goto exit_level_1;
88 }
89 }
90 /* Transpose input matrices */
91 LAPACKE_dge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
92 /* Call LAPACK function and adjust info */
93 LAPACK_dgeesx( &jobvs, &sort, select, &sense, &n, a_t, &lda_t, sdim, wr,
94 wi, vs_t, &ldvs_t, rconde, rcondv, work, &lwork, iwork,
95 &liwork, bwork, &info );
96 if( info < 0 ) {
97 info = info - 1;
98 }
99 /* Transpose output matrices */
100 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
101 if( LAPACKE_lsame( jobvs, 'v' ) ) {
102 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, vs_t, ldvs_t, vs, ldvs );
103 }
104 /* Release memory and exit */
105 if( LAPACKE_lsame( jobvs, 'v' ) ) {
106 LAPACKE_free( vs_t );
107 }
108exit_level_1:
109 LAPACKE_free( a_t );
110exit_level_0:
111 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
112 LAPACKE_xerbla( "LAPACKE_dgeesx_work", info );
113 }
114 } else {
115 info = -1;
116 LAPACKE_xerbla( "LAPACKE_dgeesx_work", info );
117 }
118 return info;
119}
#define LAPACK_dgeesx(...)
Definition lapack.h:1740
#define lapack_int
Definition lapack.h:83
#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_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
n