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

Go to the source code of this file.

Functions

lapack_int LAPACKE_sopmtr_work (int matrix_layout, char side, char uplo, char trans, lapack_int m, lapack_int n, const float *ap, const float *tau, float *c, lapack_int ldc, float *work)

Function Documentation

◆ LAPACKE_sopmtr_work()

lapack_int LAPACKE_sopmtr_work ( int matrix_layout,
char side,
char uplo,
char trans,
lapack_int m,
lapack_int n,
const float * ap,
const float * tau,
float * c,
lapack_int ldc,
float * work )

Definition at line 35 of file lapacke_sopmtr_work.c.

39{
40 lapack_int info = 0;
42 lapack_int ldc_t;
43 float *ap_t = NULL, *c_t = NULL;
44 if( matrix_layout == LAPACK_COL_MAJOR ) {
45 /* Call LAPACK function and adjust info */
46 LAPACK_sopmtr( &side, &uplo, &trans, &m, &n, ap, tau, c, &ldc, work,
47 &info );
48 if( info < 0 ) {
49 info = info - 1;
50 }
51 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52 r = LAPACKE_lsame( side, 'l' ) ? m : n;
53 ldc_t = MAX(1,m);
54 /* Check leading dimension(s) */
55 if( ldc < n ) {
56 info = -10;
57 LAPACKE_xerbla( "LAPACKE_sopmtr_work", info );
58 return info;
59 }
60 /* Allocate memory for temporary array(s) */
61 c_t = (float*)LAPACKE_malloc( sizeof(float) * ldc_t * MAX(1,n) );
62 if( c_t == NULL ) {
64 goto exit_level_0;
65 }
66 ap_t = (float*)
67 LAPACKE_malloc( sizeof(float) * ( MAX(1,r) * MAX(2,r+1) ) / 2 );
68 if( ap_t == NULL ) {
70 goto exit_level_1;
71 }
72 /* Transpose input matrices */
73 LAPACKE_sge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
74 LAPACKE_ssp_trans( matrix_layout, uplo, r, ap, ap_t );
75 /* Call LAPACK function and adjust info */
76 LAPACK_sopmtr( &side, &uplo, &trans, &m, &n, ap_t, tau, c_t, &ldc_t,
77 work, &info );
78 if( info < 0 ) {
79 info = info - 1;
80 }
81 /* Transpose output matrices */
82 LAPACKE_sge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
83 /* Release memory and exit */
84 LAPACKE_free( ap_t );
85exit_level_1:
86 LAPACKE_free( c_t );
87exit_level_0:
88 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
89 LAPACKE_xerbla( "LAPACKE_sopmtr_work", info );
90 }
91 } else {
92 info = -1;
93 LAPACKE_xerbla( "LAPACKE_sopmtr_work", info );
94 }
95 return info;
96}
#define lapack_int
Definition lapack.h:83
#define LAPACK_sopmtr(...)
Definition lapack.h:11175
#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)
void LAPACKE_ssp_trans(int matrix_layout, char uplo, lapack_int n, const float *in, float *out)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
n