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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dtrexc_work (int matrix_layout, char compq, lapack_int n, double *t, lapack_int ldt, double *q, lapack_int ldq, lapack_int *ifst, lapack_int *ilst, double *work)

Function Documentation

◆ LAPACKE_dtrexc_work()

lapack_int LAPACKE_dtrexc_work ( int matrix_layout,
char compq,
lapack_int n,
double * t,
lapack_int ldt,
double * q,
lapack_int ldq,
lapack_int * ifst,
lapack_int * ilst,
double * work )

Definition at line 35 of file lapacke_dtrexc_work.c.

39{
40 lapack_int info = 0;
41 if( matrix_layout == LAPACK_COL_MAJOR ) {
42 /* Call LAPACK function and adjust info */
43 LAPACK_dtrexc( &compq, &n, t, &ldt, q, &ldq, ifst, ilst, work, &info );
44 if( info < 0 ) {
45 info = info - 1;
46 }
47 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
48 lapack_int ldq_t = MAX(1,n);
49 lapack_int ldt_t = MAX(1,n);
50 double* t_t = NULL;
51 double* q_t = NULL;
52 /* Check leading dimension(s) */
53 if( ldq < n && LAPACKE_lsame( compq, 'v' ) ) {
54 info = -7;
55 LAPACKE_xerbla( "LAPACKE_dtrexc_work", info );
56 return info;
57 }
58 if( ldt < n ) {
59 info = -5;
60 LAPACKE_xerbla( "LAPACKE_dtrexc_work", info );
61 return info;
62 }
63 /* Allocate memory for temporary array(s) */
64 t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
65 if( t_t == NULL ) {
67 goto exit_level_0;
68 }
69 if( LAPACKE_lsame( compq, 'v' ) ) {
70 q_t = (double*)LAPACKE_malloc( sizeof(double) * ldq_t * MAX(1,n) );
71 if( q_t == NULL ) {
73 goto exit_level_1;
74 }
75 }
76 /* Transpose input matrices */
77 LAPACKE_dge_trans( matrix_layout, n, n, t, ldt, t_t, ldt_t );
78 if( LAPACKE_lsame( compq, 'v' ) ) {
79 LAPACKE_dge_trans( matrix_layout, n, n, q, ldq, q_t, ldq_t );
80 }
81 /* Call LAPACK function and adjust info */
82 LAPACK_dtrexc( &compq, &n, t_t, &ldt_t, q_t, &ldq_t, ifst, ilst, work,
83 &info );
84 if( info < 0 ) {
85 info = info - 1;
86 }
87 /* Transpose output matrices */
88 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, t_t, ldt_t, t, ldt );
89 if( LAPACKE_lsame( compq, 'v' ) ) {
90 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
91 }
92 /* Release memory and exit */
93 if( LAPACKE_lsame( compq, 'v' ) ) {
94 LAPACKE_free( q_t );
95 }
96exit_level_1:
97 LAPACKE_free( t_t );
98exit_level_0:
99 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
100 LAPACKE_xerbla( "LAPACKE_dtrexc_work", info );
101 }
102 } else {
103 info = -1;
104 LAPACKE_xerbla( "LAPACKE_dtrexc_work", info );
105 }
106 return info;
107}
#define LAPACK_dtrexc(...)
Definition lapack.h:21601
#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