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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dgemqrt_work (int matrix_layout, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const double *v, lapack_int ldv, const double *t, lapack_int ldt, double *c, lapack_int ldc, double *work)

Function Documentation

◆ LAPACKE_dgemqrt_work()

lapack_int LAPACKE_dgemqrt_work ( int matrix_layout,
char side,
char trans,
lapack_int m,
lapack_int n,
lapack_int k,
lapack_int nb,
const double * v,
lapack_int ldv,
const double * t,
lapack_int ldt,
double * c,
lapack_int ldc,
double * work )

Definition at line 35 of file lapacke_dgemqrt_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_dgemqrt( &side, &trans, &m, &n, &k, &nb, v, &ldv, t, &ldt, c,
45 &ldc, work, &info );
46 if( info < 0 ) {
47 info = info - 1;
48 }
49 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50 lapack_int ldc_t = MAX(1,m);
51 lapack_int ldt_t = MAX(1,ldt);
52 lapack_int ldv_t = MAX(1,ldv);
53 double* v_t = NULL;
54 double* t_t = NULL;
55 double* c_t = NULL;
56 /* Check leading dimension(s) */
57 if( ldc < n ) {
58 info = -13;
59 LAPACKE_xerbla( "LAPACKE_dgemqrt_work", info );
60 return info;
61 }
62 if( ldt < nb ) {
63 info = -11;
64 LAPACKE_xerbla( "LAPACKE_dgemqrt_work", info );
65 return info;
66 }
67 if( ldv < k ) {
68 info = -9;
69 LAPACKE_xerbla( "LAPACKE_dgemqrt_work", info );
70 return info;
71 }
72 /* Allocate memory for temporary array(s) */
73 v_t = (double*)LAPACKE_malloc( sizeof(double) * ldv_t * MAX(1,k) );
74 if( v_t == NULL ) {
76 goto exit_level_0;
77 }
78 t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,nb) );
79 if( t_t == NULL ) {
81 goto exit_level_1;
82 }
83 c_t = (double*)LAPACKE_malloc( sizeof(double) * ldc_t * MAX(1,n) );
84 if( c_t == NULL ) {
86 goto exit_level_2;
87 }
88 /* Transpose input matrices */
89 LAPACKE_dge_trans( matrix_layout, ldv, k, v, ldv, v_t, ldv_t );
90 LAPACKE_dge_trans( matrix_layout, ldt, nb, t, ldt, t_t, ldt_t );
91 LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
92 /* Call LAPACK function and adjust info */
93 LAPACK_dgemqrt( &side, &trans, &m, &n, &k, &nb, v_t, &ldv_t, t_t,
94 &ldt_t, c_t, &ldc_t, work, &info );
95 if( info < 0 ) {
96 info = info - 1;
97 }
98 /* Transpose output matrices */
99 LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
100 /* Release memory and exit */
101 LAPACKE_free( c_t );
102exit_level_2:
103 LAPACKE_free( t_t );
104exit_level_1:
105 LAPACKE_free( v_t );
106exit_level_0:
107 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
108 LAPACKE_xerbla( "LAPACKE_dgemqrt_work", info );
109 }
110 } else {
111 info = -1;
112 LAPACKE_xerbla( "LAPACKE_dgemqrt_work", info );
113 }
114 return info;
115}
#define lapack_int
Definition lapack.h:83
#define LAPACK_dgemqrt(...)
Definition lapack.h:2573
#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)
n