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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dtgsen (int matrix_layout, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical *select, lapack_int n, double *a, lapack_int lda, double *b, lapack_int ldb, double *alphar, double *alphai, double *beta, double *q, lapack_int ldq, double *z, lapack_int ldz, lapack_int *m, double *pl, double *pr, double *dif)

Function Documentation

◆ LAPACKE_dtgsen()

lapack_int LAPACKE_dtgsen ( int matrix_layout,
lapack_int ijob,
lapack_logical wantq,
lapack_logical wantz,
const lapack_logical * select,
lapack_int n,
double * a,
lapack_int lda,
double * b,
lapack_int ldb,
double * alphar,
double * alphai,
double * beta,
double * q,
lapack_int ldq,
double * z,
lapack_int ldz,
lapack_int * m,
double * pl,
double * pr,
double * dif )

Definition at line 35 of file lapacke_dtgsen.c.

42{
43 lapack_int info = 0;
44 lapack_int liwork = -1;
45 lapack_int lwork = -1;
46 lapack_int* iwork = NULL;
47 double* work = NULL;
48 lapack_int iwork_query;
49 double work_query;
50 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
51 LAPACKE_xerbla( "LAPACKE_dtgsen", -1 );
52 return -1;
53 }
54#ifndef LAPACK_DISABLE_NAN_CHECK
55 if( LAPACKE_get_nancheck() ) {
56 /* Optionally check input matrices for NaNs */
57 if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
58 return -7;
59 }
60 if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
61 return -9;
62 }
63 if( wantq ) {
64 if( LAPACKE_dge_nancheck( matrix_layout, n, n, q, ldq ) ) {
65 return -14;
66 }
67 }
68 if( wantz ) {
69 if( LAPACKE_dge_nancheck( matrix_layout, n, n, z, ldz ) ) {
70 return -16;
71 }
72 }
73 }
74#endif
75 /* Query optimal working array(s) size */
76 info = LAPACKE_dtgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
77 lda, b, ldb, alphar, alphai, beta, q, ldq, z,
78 ldz, m, pl, pr, dif, &work_query, lwork,
79 &iwork_query, liwork );
80 if( info != 0 ) {
81 goto exit_level_0;
82 }
83 liwork = iwork_query;
84 lwork = (lapack_int)work_query;
85 /* Allocate memory for work arrays */
86 if( ijob != 0 ) {
87 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
88 if( iwork == NULL ) {
90 goto exit_level_0;
91 }
92 }
93 work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
94 if( work == NULL ) {
96 goto exit_level_1;
97 }
98 /* Call middle-level interface */
99 info = LAPACKE_dtgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
100 lda, b, ldb, alphar, alphai, beta, q, ldq, z,
101 ldz, m, pl, pr, dif, work, lwork, iwork,
102 liwork );
103 /* Release memory and exit */
104 LAPACKE_free( work );
105exit_level_1:
106 if( ijob != 0 ) {
107 LAPACKE_free( iwork );
108 }
109exit_level_0:
110 if( info == LAPACK_WORK_MEMORY_ERROR ) {
111 LAPACKE_xerbla( "LAPACKE_dtgsen", info );
112 }
113 return info;
114}
#define lapack_int
Definition lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition lapacke.h:55
#define LAPACK_COL_MAJOR
Definition lapacke.h:53
#define LAPACKE_free(p)
Definition lapacke.h:46
lapack_int LAPACKE_dtgsen_work(int matrix_layout, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical *select, lapack_int n, double *a, lapack_int lda, double *b, lapack_int ldb, double *alphar, double *alphai, double *beta, double *q, lapack_int ldq, double *z, lapack_int ldz, lapack_int *m, double *pl, double *pr, double *dif, double *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#define LAPACK_ROW_MAJOR
Definition lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition lapacke.h:43
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
n