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

Go to the source code of this file.

Functions

lapack_int LAPACKE_sbdsdc_work (int matrix_layout, char uplo, char compq, lapack_int n, float *d, float *e, float *u, lapack_int ldu, float *vt, lapack_int ldvt, float *q, lapack_int *iq, float *work, lapack_int *iwork)

Function Documentation

◆ LAPACKE_sbdsdc_work()

lapack_int LAPACKE_sbdsdc_work ( int matrix_layout,
char uplo,
char compq,
lapack_int n,
float * d,
float * e,
float * u,
lapack_int ldu,
float * vt,
lapack_int ldvt,
float * q,
lapack_int * iq,
float * work,
lapack_int * iwork )

Definition at line 35 of file lapacke_sbdsdc_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_sbdsdc( &uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work,
45 iwork, &info );
46 if( info < 0 ) {
47 info = info - 1;
48 }
49 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50 lapack_int ldu_t = MAX(1,n);
51 lapack_int ldvt_t = MAX(1,n);
52 float* u_t = NULL;
53 float* vt_t = NULL;
54 /* Check leading dimension(s) */
55 if( ldu < n ) {
56 info = -8;
57 LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
58 return info;
59 }
60 if( ldvt < n ) {
61 info = -10;
62 LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
63 return info;
64 }
65 /* Allocate memory for temporary array(s) */
66 if( LAPACKE_lsame( compq, 'i' ) ) {
67 u_t = (float*)LAPACKE_malloc( sizeof(float) * ldu_t * MAX(1,n) );
68 if( u_t == NULL ) {
70 goto exit_level_0;
71 }
72 }
73 if( LAPACKE_lsame( compq, 'i' ) ) {
74 vt_t = (float*)LAPACKE_malloc( sizeof(float) * ldvt_t * MAX(1,n) );
75 if( vt_t == NULL ) {
77 goto exit_level_1;
78 }
79 }
80 /* Call LAPACK function and adjust info */
81 LAPACK_sbdsdc( &uplo, &compq, &n, d, e, u_t, &ldu_t, vt_t, &ldvt_t, q,
82 iq, work, iwork, &info );
83 if( info < 0 ) {
84 info = info - 1;
85 }
86 /* Transpose output matrices */
87 if( LAPACKE_lsame( compq, 'i' ) ) {
88 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, u_t, ldu_t, u, ldu );
89 }
90 if( LAPACKE_lsame( compq, 'i' ) ) {
91 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, vt_t, ldvt_t, vt, ldvt );
92 }
93 /* Release memory and exit */
94 if( LAPACKE_lsame( compq, 'i' ) ) {
95 LAPACKE_free( vt_t );
96 }
97exit_level_1:
98 if( LAPACKE_lsame( compq, 'i' ) ) {
99 LAPACKE_free( u_t );
100 }
101exit_level_0:
102 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
103 LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
104 }
105 } else {
106 info = -1;
107 LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
108 }
109 return info;
110}
#define lapack_int
Definition lapack.h:83
#define LAPACK_sbdsdc(...)
Definition lapack.h:293
#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_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