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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dsysv_aa_2stage_work (int matrix_layout, char uplo, lapack_int n, lapack_int nrhs, double *a, lapack_int lda, double *tb, lapack_int ltb, lapack_int *ipiv, lapack_int *ipiv2, double *b, lapack_int ldb, double *work, lapack_int lwork)

Function Documentation

◆ LAPACKE_dsysv_aa_2stage_work()

lapack_int LAPACKE_dsysv_aa_2stage_work ( int matrix_layout,
char uplo,
lapack_int n,
lapack_int nrhs,
double * a,
lapack_int lda,
double * tb,
lapack_int ltb,
lapack_int * ipiv,
lapack_int * ipiv2,
double * b,
lapack_int ldb,
double * work,
lapack_int lwork )

Definition at line 35 of file lapacke_dsysv_aa_2stage_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_dsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda, tb,
45 &ltb, ipiv, ipiv2, b, &ldb, work, &lwork,
46 &info );
47 if( info < 0 ) {
48 info = info - 1;
49 }
50 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51 lapack_int lda_t = MAX(1,n);
52 lapack_int ldb_t = MAX(1,n);
53 double* a_t = NULL;
54 double* tb_t = NULL;
55 double* b_t = NULL;
56 /* Check leading dimension(s) */
57 if( lda < n ) {
58 info = -6;
59 LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
60 return info;
61 }
62 if( ltb < 4*n ) {
63 info = -8;
64 LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
65 return info;
66 }
67 if( ldb < nrhs ) {
68 info = -12;
69 LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
70 return info;
71 }
72 /* Query optimal working array(s) size if requested */
73 if( lwork == -1 ) {
74 LAPACK_dsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda_t,
75 tb, &ltb, ipiv, ipiv2, b, &ldb_t, work,
76 &lwork, &info );
77 return (info < 0) ? (info - 1) : info;
78 }
79 /* Allocate memory for temporary array(s) */
80 a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
81 if( a_t == NULL ) {
83 goto exit_level_0;
84 }
85 tb_t = (double*)LAPACKE_malloc( sizeof(double) * ltb );
86 if( tb_t == NULL ) {
88 goto exit_level_1;
89 }
90 b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
91 if( b_t == NULL ) {
93 goto exit_level_2;
94 }
95 /* Transpose input matrices */
96 LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
97 LAPACKE_dge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
98 /* Call LAPACK function and adjust info */
99 LAPACK_dsysv_aa_2stage( &uplo, &n, &nrhs, a_t, &lda_t,
100 tb_t, &ltb, ipiv, ipiv2, b_t, &ldb_t, work,
101 &lwork, &info );
102 if( info < 0 ) {
103 info = info - 1;
104 }
105 /* Transpose output matrices */
106 LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
107 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb );
108 /* Release memory and exit */
109 LAPACKE_free( b_t );
110exit_level_2:
111 LAPACKE_free( tb_t );
112exit_level_1:
113 LAPACKE_free( a_t );
114exit_level_0:
115 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
116 LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
117 }
118 } else {
119 info = -1;
120 LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
121 }
122 return info;
123}
#define lapack_int
Definition lapack.h:83
#define LAPACK_dsysv_aa_2stage(...)
Definition lapack.h:17948
#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
void LAPACKE_xerbla(const char *name, lapack_int info)
#define MAX(x, y)
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
void LAPACKE_dsy_trans(int matrix_layout, char uplo, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
n