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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dtrsna_work (int matrix_layout, char job, char howmny, const lapack_logical *select, lapack_int n, const double *t, lapack_int ldt, const double *vl, lapack_int ldvl, const double *vr, lapack_int ldvr, double *s, double *sep, lapack_int mm, lapack_int *m, double *work, lapack_int ldwork, lapack_int *iwork)

Function Documentation

◆ LAPACKE_dtrsna_work()

lapack_int LAPACKE_dtrsna_work ( int matrix_layout,
char job,
char howmny,
const lapack_logical * select,
lapack_int n,
const double * t,
lapack_int ldt,
const double * vl,
lapack_int ldvl,
const double * vr,
lapack_int ldvr,
double * s,
double * sep,
lapack_int mm,
lapack_int * m,
double * work,
lapack_int ldwork,
lapack_int * iwork )

Definition at line 35 of file lapacke_dtrsna_work.c.

43{
44 lapack_int info = 0;
45 if( matrix_layout == LAPACK_COL_MAJOR ) {
46 /* Call LAPACK function and adjust info */
47 LAPACK_dtrsna( &job, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr,
48 s, sep, &mm, m, work, &ldwork, iwork, &info );
49 if( info < 0 ) {
50 info = info - 1;
51 }
52 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53 lapack_int ldt_t = MAX(1,n);
54 lapack_int ldvl_t = MAX(1,n);
55 lapack_int ldvr_t = MAX(1,n);
56 double* t_t = NULL;
57 double* vl_t = NULL;
58 double* vr_t = NULL;
59 /* Check leading dimension(s) */
60 if( ldt < n ) {
61 info = -7;
62 LAPACKE_xerbla( "LAPACKE_dtrsna_work", info );
63 return info;
64 }
65 if( ldvl < mm ) {
66 info = -9;
67 LAPACKE_xerbla( "LAPACKE_dtrsna_work", info );
68 return info;
69 }
70 if( ldvr < mm ) {
71 info = -11;
72 LAPACKE_xerbla( "LAPACKE_dtrsna_work", info );
73 return info;
74 }
75 /* Allocate memory for temporary array(s) */
76 t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
77 if( t_t == NULL ) {
79 goto exit_level_0;
80 }
81 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
82 vl_t = (double*)
83 LAPACKE_malloc( sizeof(double) * ldvl_t * MAX(1,mm) );
84 if( vl_t == NULL ) {
86 goto exit_level_1;
87 }
88 }
89 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
90 vr_t = (double*)
91 LAPACKE_malloc( sizeof(double) * ldvr_t * MAX(1,mm) );
92 if( vr_t == NULL ) {
94 goto exit_level_2;
95 }
96 }
97 /* Transpose input matrices */
98 LAPACKE_dge_trans( matrix_layout, n, n, t, ldt, t_t, ldt_t );
99 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
100 LAPACKE_dge_trans( matrix_layout, n, mm, vl, ldvl, vl_t, ldvl_t );
101 }
102 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
103 LAPACKE_dge_trans( matrix_layout, n, mm, vr, ldvr, vr_t, ldvr_t );
104 }
105 /* Call LAPACK function and adjust info */
106 LAPACK_dtrsna( &job, &howmny, select, &n, t_t, &ldt_t, vl_t, &ldvl_t,
107 vr_t, &ldvr_t, s, sep, &mm, m, work, &ldwork, iwork,
108 &info );
109 if( info < 0 ) {
110 info = info - 1;
111 }
112 /* Release memory and exit */
113 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
114 LAPACKE_free( vr_t );
115 }
116exit_level_2:
117 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
118 LAPACKE_free( vl_t );
119 }
120exit_level_1:
121 LAPACKE_free( t_t );
122exit_level_0:
123 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
124 LAPACKE_xerbla( "LAPACKE_dtrsna_work", info );
125 }
126 } else {
127 info = -1;
128 LAPACKE_xerbla( "LAPACKE_dtrsna_work", info );
129 }
130 return info;
131}
#define LAPACK_dtrsna(...)
Definition lapack.h:21862
#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