LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dopmtr_work()

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

Definition at line 36 of file lapacke_dopmtr_work.c.

40 {
41  lapack_int info = 0;
42  lapack_int r;
43  lapack_int ldc_t;
44  double *c_t = NULL, *ap_t = NULL;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_dopmtr( &side, &uplo, &trans, &m, &n, ap, tau, c, &ldc, work,
48  &info );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  r = LAPACKE_lsame( side, 'l' ) ? m : n;
54  ldc_t = MAX(1,m);
55  /* Check leading dimension(s) */
56  if( ldc < n ) {
57  info = -10;
58  LAPACKE_xerbla( "LAPACKE_dopmtr_work", info );
59  return info;
60  }
61  /* Allocate memory for temporary array(s) */
62  c_t = (double*)LAPACKE_malloc( sizeof(double) * ldc_t * MAX(1,n) );
63  if( c_t == NULL ) {
65  goto exit_level_0;
66  }
67  ap_t = (double*)
68  LAPACKE_malloc( sizeof(double) * ( MAX(1,r) * MAX(2,r+1) ) / 2 );
69  if( ap_t == NULL ) {
71  goto exit_level_1;
72  }
73  /* Transpose input matrices */
74  LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
75  LAPACKE_dsp_trans( matrix_layout, uplo, r, ap, ap_t );
76  /* Call LAPACK function and adjust info */
77  LAPACK_dopmtr( &side, &uplo, &trans, &m, &n, ap_t, tau, c_t, &ldc_t,
78  work, &info );
79  if( info < 0 ) {
80  info = info - 1;
81  }
82  /* Transpose output matrices */
83  LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
84  /* Release memory and exit */
85  LAPACKE_free( ap_t );
86 exit_level_1:
87  LAPACKE_free( c_t );
88 exit_level_0:
89  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
90  LAPACKE_xerbla( "LAPACKE_dopmtr_work", info );
91  }
92  } else {
93  info = -1;
94  LAPACKE_xerbla( "LAPACKE_dopmtr_work", info );
95  }
96  return info;
97 }
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
void LAPACK_dopmtr(char *side, char *uplo, char *trans, lapack_int *m, lapack_int *n, const double *ap, const double *tau, double *c, lapack_int *ldc, double *work, lapack_int *info)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
void LAPACKE_dsp_trans(int matrix_layout, char uplo, lapack_int n, const double *in, double *out)
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
Here is the call graph for this function:
Here is the caller graph for this function: