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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dgees_work (int matrix_layout, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double *a, lapack_int lda, lapack_int *sdim, double *wr, double *wi, double *vs, lapack_int ldvs, double *work, lapack_int lwork, lapack_logical *bwork)

Function Documentation

◆ LAPACKE_dgees_work()

lapack_int LAPACKE_dgees_work ( int matrix_layout,
char jobvs,
char sort,
LAPACK_D_SELECT2 select,
lapack_int n,
double * a,
lapack_int lda,
lapack_int * sdim,
double * wr,
double * wi,
double * vs,
lapack_int ldvs,
double * work,
lapack_int lwork,
lapack_logical * bwork )

Definition at line 35 of file lapacke_dgees_work.c.

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