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

Go to the source code of this file.

Functions

lapack_int LAPACKE_stgsna (int matrix_layout, char job, char howmny, const lapack_logical *select, lapack_int n, const float *a, lapack_int lda, const float *b, lapack_int ldb, const float *vl, lapack_int ldvl, const float *vr, lapack_int ldvr, float *s, float *dif, lapack_int mm, lapack_int *m)

Function Documentation

◆ LAPACKE_stgsna()

lapack_int LAPACKE_stgsna ( int matrix_layout,
char job,
char howmny,
const lapack_logical * select,
lapack_int n,
const float * a,
lapack_int lda,
const float * b,
lapack_int ldb,
const float * vl,
lapack_int ldvl,
const float * vr,
lapack_int ldvr,
float * s,
float * dif,
lapack_int mm,
lapack_int * m )

Definition at line 35 of file lapacke_stgsna.c.

41{
42 lapack_int info = 0;
43 lapack_int lwork = -1;
44 lapack_int* iwork = NULL;
45 float* work = NULL;
46 float work_query;
47 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
48 LAPACKE_xerbla( "LAPACKE_stgsna", -1 );
49 return -1;
50 }
51#ifndef LAPACK_DISABLE_NAN_CHECK
52 if( LAPACKE_get_nancheck() ) {
53 /* Optionally check input matrices for NaNs */
54 if( LAPACKE_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
55 return -6;
56 }
57 if( LAPACKE_sge_nancheck( matrix_layout, n, n, b, ldb ) ) {
58 return -8;
59 }
60 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
61 if( LAPACKE_sge_nancheck( matrix_layout, n, mm, vl, ldvl ) ) {
62 return -10;
63 }
64 }
65 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
66 if( LAPACKE_sge_nancheck( matrix_layout, n, mm, vr, ldvr ) ) {
67 return -12;
68 }
69 }
70 }
71#endif
72 /* Allocate memory for working array(s) */
73 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
74 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n+6) );
75 if( iwork == NULL ) {
77 goto exit_level_0;
78 }
79 }
80 /* Query optimal working array(s) size */
81 info = LAPACKE_stgsna_work( matrix_layout, job, howmny, select, n, a, lda, b,
82 ldb, vl, ldvl, vr, ldvr, s, dif, mm, m,
83 &work_query, lwork, iwork );
84 if( info != 0 ) {
85 goto exit_level_1;
86 }
87 lwork = (lapack_int)work_query;
88 /* Allocate memory for work arrays */
89 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
90 work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
91 if( work == NULL ) {
93 goto exit_level_1;
94 }
95 }
96 /* Call middle-level interface */
97 info = LAPACKE_stgsna_work( matrix_layout, job, howmny, select, n, a, lda, b,
98 ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work,
99 lwork, iwork );
100 /* Release memory and exit */
101 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
102 LAPACKE_free( work );
103 }
104exit_level_1:
105 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
106 LAPACKE_free( iwork );
107 }
108exit_level_0:
109 if( info == LAPACK_WORK_MEMORY_ERROR ) {
110 LAPACKE_xerbla( "LAPACKE_stgsna", info );
111 }
112 return info;
113}
#define lapack_int
Definition lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition lapacke.h:55
lapack_int LAPACKE_stgsna_work(int matrix_layout, char job, char howmny, const lapack_logical *select, lapack_int n, const float *a, lapack_int lda, const float *b, lapack_int ldb, const float *vl, lapack_int ldvl, const float *vr, lapack_int ldvr, float *s, float *dif, lapack_int mm, lapack_int *m, float *work, lapack_int lwork, lapack_int *iwork)
#define LAPACK_COL_MAJOR
Definition lapacke.h:53
#define LAPACKE_free(p)
Definition lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition lapacke.h:43
lapack_logical LAPACKE_lsame(char ca, char cb)
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#define MAX(x, y)
n