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

Go to the source code of this file.

Functions

lapack_int LAPACKE_sstedc (int matrix_layout, char compz, lapack_int n, float *d, float *e, float *z, lapack_int ldz)

Function Documentation

◆ LAPACKE_sstedc()

lapack_int LAPACKE_sstedc ( int matrix_layout,
char compz,
lapack_int n,
float * d,
float * e,
float * z,
lapack_int ldz )

Definition at line 35 of file lapacke_sstedc.c.

37{
38 lapack_int info = 0;
39 lapack_int liwork = -1;
40 lapack_int lwork = -1;
41 lapack_int* iwork = NULL;
42 float* work = NULL;
43 lapack_int iwork_query;
44 float work_query;
45 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
46 LAPACKE_xerbla( "LAPACKE_sstedc", -1 );
47 return -1;
48 }
49#ifndef LAPACK_DISABLE_NAN_CHECK
50 if( LAPACKE_get_nancheck() ) {
51 /* Optionally check input matrices for NaNs */
52 if( LAPACKE_s_nancheck( n, d, 1 ) ) {
53 return -4;
54 }
55 if( LAPACKE_s_nancheck( n-1, e, 1 ) ) {
56 return -5;
57 }
58 if( LAPACKE_lsame( compz, 'v' ) ) {
59 if( LAPACKE_sge_nancheck( matrix_layout, n, n, z, ldz ) ) {
60 return -6;
61 }
62 }
63 }
64#endif
65 /* Query optimal working array(s) size */
66 info = LAPACKE_sstedc_work( matrix_layout, compz, n, d, e, z, ldz,
67 &work_query, lwork, &iwork_query, liwork );
68 if( info != 0 ) {
69 goto exit_level_0;
70 }
71 liwork = iwork_query;
72 lwork = (lapack_int)work_query;
73 /* Allocate memory for work arrays */
74 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
75 if( iwork == NULL ) {
77 goto exit_level_0;
78 }
79 work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
80 if( work == NULL ) {
82 goto exit_level_1;
83 }
84 /* Call middle-level interface */
85 info = LAPACKE_sstedc_work( matrix_layout, compz, n, d, e, z, ldz, work,
86 lwork, iwork, liwork );
87 /* Release memory and exit */
88 LAPACKE_free( work );
89exit_level_1:
90 LAPACKE_free( iwork );
91exit_level_0:
92 if( info == LAPACK_WORK_MEMORY_ERROR ) {
93 LAPACKE_xerbla( "LAPACKE_sstedc", info );
94 }
95 return info;
96}
#define lapack_int
Definition lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition lapacke.h:55
#define LAPACK_COL_MAJOR
Definition lapacke.h:53
lapack_int LAPACKE_sstedc_work(int matrix_layout, char compz, lapack_int n, float *d, float *e, float *z, lapack_int ldz, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#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_s_nancheck(lapack_int n, const float *x, lapack_int incx)
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
n