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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dlascl_work (int matrix_layout, char type, lapack_int kl, lapack_int ku, double cfrom, double cto, lapack_int m, lapack_int n, double *a, lapack_int lda)

Function Documentation

◆ LAPACKE_dlascl_work()

lapack_int LAPACKE_dlascl_work ( int matrix_layout,
char type,
lapack_int kl,
lapack_int ku,
double cfrom,
double cto,
lapack_int m,
lapack_int n,
double * a,
lapack_int lda )

Definition at line 35 of file lapacke_dlascl_work.c.

39{
40 lapack_int info = 0;
41 if( matrix_layout == LAPACK_COL_MAJOR ) {
42 /* Call LAPACK function and adjust info */
43 LAPACK_dlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a, &lda, &info);
44 if( info < 0 ) {
45 info = info - 1;
46 }
47 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
48 lapack_int nrows_a = LAPACKE_lsame(type, 'b') ? kl + 1 :
49 LAPACKE_lsame(type, 'q') ? ku + 1 :
50 LAPACKE_lsame(type, 'z') ? 2 * kl + ku + 1 : m;
51 lapack_int lda_t = MAX(1,nrows_a);
52 double* a_t = NULL;
53 /* Check leading dimension(s) */
54 if( lda < n ) {
55 info = -9;
56 LAPACKE_xerbla( "LAPACKE_dlascl_work", info );
57 return info;
58 }
59 /* Allocate memory for temporary array(s) */
60 a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
61 if( a_t == NULL ) {
63 goto exit_level_0;
64 }
65 /* Transpose input matrices */
66 LAPACKE_dge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
67 /* Call LAPACK function and adjust info */
68 LAPACK_dlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
69 if( info < 0 ) {
70 info = info - 1;
71 }
72 /* Transpose output matrices */
73 LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
74 /* Release memory and exit */
75 LAPACKE_free( a_t );
76exit_level_0:
77 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
78 LAPACKE_xerbla( "LAPACKE_dlascl_work", info );
79 }
80 } else {
81 info = -1;
82 LAPACKE_xerbla( "LAPACKE_dlascl_work", info );
83 }
84 return info;
85}
#define LAPACK_dlascl(...)
Definition lapack.h:10759
#define lapack_int
Definition lapack.h:83
#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)
#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)
n