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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dgesvdq (int matrix_layout, char joba, char jobp, char jobr, char jobu, char jobv, lapack_int m, lapack_int n, double *a, lapack_int lda, double *s, double *u, lapack_int ldu, double *v, lapack_int ldv, lapack_int *numrank)

Function Documentation

◆ LAPACKE_dgesvdq()

lapack_int LAPACKE_dgesvdq ( int matrix_layout,
char joba,
char jobp,
char jobr,
char jobu,
char jobv,
lapack_int m,
lapack_int n,
double * a,
lapack_int lda,
double * s,
double * u,
lapack_int ldu,
double * v,
lapack_int ldv,
lapack_int * numrank )

Definition at line 35 of file lapacke_dgesvdq.c.

40{
41 lapack_int info = 0;
42 lapack_int liwork = -1;
43 lapack_int* iwork = NULL;
44 lapack_int iwork_query;
45 lapack_int lwork = -1;
46 double* work = NULL;
47 double work_query;
48 lapack_int lrwork = -1;
49 double* rwork = NULL;
50 double rwork_query;
51 lapack_int i;
52 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
53 LAPACKE_xerbla( "LAPACKE_dgesvdq", -1 );
54 return -1;
55 }
56#ifndef LAPACK_DISABLE_NAN_CHECK
57 if( LAPACKE_get_nancheck() ) {
58 /* Optionally check input matrices for NaNs */
59 if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
60 return -6;
61 }
62 }
63#endif
64 /* Query optimal working array(s) size */
65 info = LAPACKE_dgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
66 m, n, a, lda, s, u, ldu, v, ldv, numrank,
67 &iwork_query, liwork, &work_query, lwork,
68 &rwork_query, lrwork );
69 if( info != 0 ) {
70 goto exit_level_0;
71 }
72 liwork = iwork_query;
73 lwork = (lapack_int)work_query;
74 lrwork = (lapack_int)rwork_query;
75 /* Allocate memory for work arrays */
76 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
77 if( iwork == NULL ) {
79 goto exit_level_0;
80 }
81 work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
82 if( work == NULL ) {
84 goto exit_level_0;
85 }
86 rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork );
87 if( rwork == NULL ) {
89 goto exit_level_0;
90 }
91 /* Call middle-level interface */
92 info = LAPACKE_dgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
93 m, n, a, lda, s, u, ldu, v, ldv, numrank,
94 iwork, liwork, work, lwork, rwork, lrwork );
95
96 /* Release memory and exit */
97 LAPACKE_free( iwork );
98 LAPACKE_free( work );
99 LAPACKE_free( rwork );
100exit_level_0:
101 if( info == LAPACK_WORK_MEMORY_ERROR ) {
102 LAPACKE_xerbla( "LAPACKE_dgesvdq", info );
103 }
104 return info;
105}
#define lapack_int
Definition lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition lapacke.h:55
#define LAPACK_COL_MAJOR
Definition lapacke.h:53
#define LAPACKE_free(p)
Definition lapacke.h:46
lapack_int LAPACKE_dgesvdq_work(int matrix_layout, char joba, char jobp, char jobr, char jobu, char jobv, lapack_int m, lapack_int n, double *a, lapack_int lda, double *s, double *u, lapack_int ldu, double *v, lapack_int ldv, lapack_int *numrank, lapack_int *iwork, lapack_int liwork, double *work, lapack_int lwork, double *rwork, lapack_int lrwork)
#define LAPACK_ROW_MAJOR
Definition lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition lapacke.h:43
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
n