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

Go to the source code of this file.

Functions

lapack_int LAPACKE_clascl_work (int matrix_layout, char type, lapack_int kl, lapack_int ku, float cfrom, float cto, lapack_int m, lapack_int n, lapack_complex_float *a, lapack_int lda)

Function Documentation

◆ LAPACKE_clascl_work()

lapack_int LAPACKE_clascl_work ( int matrix_layout,
char type,
lapack_int kl,
lapack_int ku,
float cfrom,
float cto,
lapack_int m,
lapack_int n,
lapack_complex_float * a,
lapack_int lda )

Definition at line 35 of file lapacke_clascl_work.c.

39{
40 lapack_int info = 0;
41 if( matrix_layout == LAPACK_COL_MAJOR ) {
42 /* Call LAPACK function and adjust info */
43 LAPACK_clascl( &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 lapack_complex_float* a_t = NULL;
53 /* Check leading dimension(s) */
54 if( lda < n ) {
55 info = -9;
56 LAPACKE_xerbla( "LAPACKE_clascl_work", info );
57 return info;
58 }
59 /* Allocate memory for temporary array(s) */
61 LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
62 if( a_t == NULL ) {
64 goto exit_level_0;
65 }
66 /* Transpose input matrices */
67 LAPACKE_cge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
68 /* Call LAPACK function and adjust info */
69 LAPACK_clascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
70 if( info < 0 ) {
71 info = info - 1;
72 }
73 /* Transpose output matrices */
74 LAPACKE_cge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
75 /* Release memory and exit */
76 LAPACKE_free( a_t );
77exit_level_0:
78 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
79 LAPACKE_xerbla( "LAPACKE_clascl_work", info );
80 }
81 } else {
82 info = -1;
83 LAPACKE_xerbla( "LAPACKE_clascl_work", info );
84 }
85 return info;
86}
#define lapack_int
Definition lapack.h:83
#define LAPACK_clascl(...)
Definition lapack.h:10741
#define lapack_complex_float
Definition lapack.h:45
#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_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
n