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

Go to the source code of this file.

Functions

lapack_int LAPACKE_cuncsd (int matrix_layout, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float *x11, lapack_int ldx11, lapack_complex_float *x12, lapack_int ldx12, lapack_complex_float *x21, lapack_int ldx21, lapack_complex_float *x22, lapack_int ldx22, float *theta, lapack_complex_float *u1, lapack_int ldu1, lapack_complex_float *u2, lapack_int ldu2, lapack_complex_float *v1t, lapack_int ldv1t, lapack_complex_float *v2t, lapack_int ldv2t)

Function Documentation

◆ LAPACKE_cuncsd()

lapack_int LAPACKE_cuncsd ( int matrix_layout,
char jobu1,
char jobu2,
char jobv1t,
char jobv2t,
char trans,
char signs,
lapack_int m,
lapack_int p,
lapack_int q,
lapack_complex_float * x11,
lapack_int ldx11,
lapack_complex_float * x12,
lapack_int ldx12,
lapack_complex_float * x21,
lapack_int ldx21,
lapack_complex_float * x22,
lapack_int ldx22,
float * theta,
lapack_complex_float * u1,
lapack_int ldu1,
lapack_complex_float * u2,
lapack_int ldu2,
lapack_complex_float * v1t,
lapack_int ldv1t,
lapack_complex_float * v2t,
lapack_int ldv2t )

Definition at line 35 of file lapacke_cuncsd.c.

47{
48 lapack_int info = 0;
49 lapack_int lrwork = -1;
50 lapack_int lwork = -1;
51 lapack_int* iwork = NULL;
52 float* rwork = NULL;
53 lapack_complex_float* work = NULL;
54 float rwork_query;
55 lapack_complex_float work_query;
56 int lapack_layout;
57 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
58 LAPACKE_xerbla( "LAPACKE_cuncsd", -1 );
59 return -1;
60 }
61 if( LAPACKE_lsame( trans, 'n' ) && matrix_layout == LAPACK_COL_MAJOR ) {
62 lapack_layout = LAPACK_COL_MAJOR;
63 } else {
64 lapack_layout = LAPACK_ROW_MAJOR;
65 }
66#ifndef LAPACK_DISABLE_NAN_CHECK
67 if( LAPACKE_get_nancheck() ) {
68 /* Optionally check input matrices for NaNs */
69 if( LAPACKE_cge_nancheck( lapack_layout, p, q, x11, ldx11 ) ) {
70 return -11;
71 }
72 if( LAPACKE_cge_nancheck( lapack_layout, p, m-q, x12, ldx12 ) ) {
73 return -13;
74 }
75 if( LAPACKE_cge_nancheck( lapack_layout, m-p, q, x21, ldx21 ) ) {
76 return -15;
77 }
78 if( LAPACKE_cge_nancheck( lapack_layout, m-p, m-q, x22, ldx22 ) ) {
79 return -17;
80 }
81 }
82#endif
83 /* Allocate memory for working array(s) */
84 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,m-MIN(MIN(p,m-p),MIN(q,m-q))) );
85 if( iwork == NULL ) {
87 goto exit_level_0;
88 }
89 /* Query optimal working array(s) size */
90 info = LAPACKE_cuncsd_work( matrix_layout, jobu1, jobu2, jobv1t, jobv2t,
91 trans, signs, m, p, q, x11, ldx11, x12, ldx12,
92 x21, ldx21, x22, ldx22, theta, u1, ldu1, u2,
93 ldu2, v1t, ldv1t, v2t, ldv2t, &work_query,
94 lwork, &rwork_query, lrwork, iwork );
95 if( info != 0 ) {
96 goto exit_level_1;
97 }
98 lrwork = (lapack_int)rwork_query;
99 lwork = LAPACK_C2INT( work_query );
100 /* Allocate memory for work arrays */
101 rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork );
102 if( rwork == NULL ) {
104 goto exit_level_1;
105 }
106 work = (lapack_complex_float*)
107 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
108 if( work == NULL ) {
110 goto exit_level_2;
111 }
112 /* Call middle-level interface */
113 info = LAPACKE_cuncsd_work( matrix_layout, jobu1, jobu2, jobv1t, jobv2t,
114 trans, signs, m, p, q, x11, ldx11, x12, ldx12,
115 x21, ldx21, x22, ldx22, theta, u1, ldu1, u2,
116 ldu2, v1t, ldv1t, v2t, ldv2t, work, lwork,
117 rwork, lrwork, iwork );
118 /* Release memory and exit */
119 LAPACKE_free( work );
120exit_level_2:
121 LAPACKE_free( rwork );
122exit_level_1:
123 LAPACKE_free( iwork );
124exit_level_0:
125 if( info == LAPACK_WORK_MEMORY_ERROR ) {
126 LAPACKE_xerbla( "LAPACKE_cuncsd", info );
127 }
128 return info;
129}
#define lapack_int
Definition lapack.h:83
#define lapack_complex_float
Definition lapack.h:45
#define LAPACK_WORK_MEMORY_ERROR
Definition lapacke.h:55
lapack_int LAPACKE_cuncsd_work(int matrix_layout, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float *x11, lapack_int ldx11, lapack_complex_float *x12, lapack_int ldx12, lapack_complex_float *x21, lapack_int ldx21, lapack_complex_float *x22, lapack_int ldx22, float *theta, lapack_complex_float *u1, lapack_int ldu1, lapack_complex_float *u2, lapack_int ldu2, lapack_complex_float *v1t, lapack_int ldv1t, lapack_complex_float *v2t, lapack_int ldv2t, lapack_complex_float *work, lapack_int lwork, float *rwork, lapack_int lrwork, lapack_int *iwork)
#define LAPACK_COL_MAJOR
Definition lapacke.h:53
#define LAPACK_C2INT(x)
Definition lapacke.h:49
#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)
#define MIN(x, y)
#define MAX(x, y)
lapack_logical LAPACKE_cge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *a, lapack_int lda)