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

Go to the source code of this file.

Functions

lapack_int LAPACKE_sspgv_work (int matrix_layout, lapack_int itype, char jobz, char uplo, lapack_int n, float *ap, float *bp, float *w, float *z, lapack_int ldz, float *work)

Function Documentation

◆ LAPACKE_sspgv_work()

lapack_int LAPACKE_sspgv_work ( int matrix_layout,
lapack_int itype,
char jobz,
char uplo,
lapack_int n,
float * ap,
float * bp,
float * w,
float * z,
lapack_int ldz,
float * work )

Definition at line 35 of file lapacke_sspgv_work.c.

38{
39 lapack_int info = 0;
40 if( matrix_layout == LAPACK_COL_MAJOR ) {
41 /* Call LAPACK function and adjust info */
42 LAPACK_sspgv( &itype, &jobz, &uplo, &n, ap, bp, w, z, &ldz, work,
43 &info );
44 if( info < 0 ) {
45 info = info - 1;
46 }
47 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
48 lapack_int ldz_t = MAX(1,n);
49 float* z_t = NULL;
50 float* ap_t = NULL;
51 float* bp_t = NULL;
52 /* Check leading dimension(s) */
53 if( ldz < n ) {
54 info = -10;
55 LAPACKE_xerbla( "LAPACKE_sspgv_work", info );
56 return info;
57 }
58 /* Allocate memory for temporary array(s) */
59 if( LAPACKE_lsame( jobz, 'v' ) ) {
60 z_t = (float*)LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,n) );
61 if( z_t == NULL ) {
63 goto exit_level_0;
64 }
65 }
66 ap_t = (float*)
67 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
68 if( ap_t == NULL ) {
70 goto exit_level_1;
71 }
72 bp_t = (float*)
73 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
74 if( bp_t == NULL ) {
76 goto exit_level_2;
77 }
78 /* Transpose input matrices */
79 LAPACKE_ssp_trans( matrix_layout, uplo, n, ap, ap_t );
80 LAPACKE_ssp_trans( matrix_layout, uplo, n, bp, bp_t );
81 /* Call LAPACK function and adjust info */
82 LAPACK_sspgv( &itype, &jobz, &uplo, &n, ap_t, bp_t, w, z_t, &ldz_t,
83 work, &info );
84 if( info < 0 ) {
85 info = info - 1;
86 }
87 /* Transpose output matrices */
88 if( LAPACKE_lsame( jobz, 'v' ) ) {
89 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
90 }
91 LAPACKE_ssp_trans( LAPACK_COL_MAJOR, uplo, n, ap_t, ap );
92 LAPACKE_ssp_trans( LAPACK_COL_MAJOR, uplo, n, bp_t, bp );
93 /* Release memory and exit */
94 LAPACKE_free( bp_t );
95exit_level_2:
96 LAPACKE_free( ap_t );
97exit_level_1:
98 if( LAPACKE_lsame( jobz, 'v' ) ) {
99 LAPACKE_free( z_t );
100 }
101exit_level_0:
102 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
103 LAPACKE_xerbla( "LAPACKE_sspgv_work", info );
104 }
105 } else {
106 info = -1;
107 LAPACKE_xerbla( "LAPACKE_sspgv_work", info );
108 }
109 return info;
110}
#define lapack_int
Definition lapack.h:83
#define LAPACK_sspgv(...)
Definition lapack.h:15486
#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)
void LAPACKE_ssp_trans(int matrix_layout, char uplo, lapack_int n, const float *in, float *out)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
n