LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dtpqrt2_work()

lapack_int LAPACKE_dtpqrt2_work ( int  matrix_layout,
lapack_int  m,
lapack_int  n,
lapack_int  l,
double *  a,
lapack_int  lda,
double *  b,
lapack_int  ldb,
double *  t,
lapack_int  ldt 
)

Definition at line 35 of file lapacke_dtpqrt2_work.c.

39 {
40  lapack_int info = 0;
41  if( matrix_layout == LAPACK_COL_MAJOR ) {
42  /* Call LAPACK function and adjust info */
43  LAPACK_dtpqrt2( &m, &n, &l, a, &lda, b, &ldb, t, &ldt, &info );
44  if( info < 0 ) {
45  info = info - 1;
46  }
47  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
48  lapack_int lda_t = MAX(1,n);
49  lapack_int ldb_t = MAX(1,m);
50  lapack_int ldt_t = MAX(1,n);
51  double* a_t = NULL;
52  double* b_t = NULL;
53  double* t_t = NULL;
54  /* Check leading dimension(s) */
55  if( lda < n ) {
56  info = -5;
57  LAPACKE_xerbla( "LAPACKE_dtpqrt2_work", info );
58  return info;
59  }
60  if( ldb < n ) {
61  info = -7;
62  LAPACKE_xerbla( "LAPACKE_dtpqrt2_work", info );
63  return info;
64  }
65  if( ldt < n ) {
66  info = -9;
67  LAPACKE_xerbla( "LAPACKE_dtpqrt2_work", info );
68  return info;
69  }
70  /* Allocate memory for temporary array(s) */
71  a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
72  if( a_t == NULL ) {
74  goto exit_level_0;
75  }
76  b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,n) );
77  if( b_t == NULL ) {
79  goto exit_level_1;
80  }
81  t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
82  if( t_t == NULL ) {
84  goto exit_level_2;
85  }
86  /* Transpose input matrices */
87  LAPACKE_dge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
88  LAPACKE_dge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
89  /* Call LAPACK function and adjust info */
90  LAPACK_dtpqrt2( &m, &n, &l, a_t, &lda_t, b_t, &ldb_t, t_t, &ldt_t, &info );
91  if( info < 0 ) {
92  info = info - 1;
93  }
94  /* Transpose output matrices */
95  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
96  LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
97  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, t_t, ldt_t, t, ldt );
98  /* Release memory and exit */
99  LAPACKE_free( t_t );
100 exit_level_2:
101  LAPACKE_free( b_t );
102 exit_level_1:
103  LAPACKE_free( a_t );
104 exit_level_0:
105  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
106  LAPACKE_xerbla( "LAPACKE_dtpqrt2_work", info );
107  }
108  } else {
109  info = -1;
110  LAPACKE_xerbla( "LAPACKE_dtpqrt2_work", info );
111  }
112  return info;
113 }
#define lapack_int
Definition: lapack.h:83
void LAPACK_dtpqrt2(lapack_int const *m, lapack_int const *n, lapack_int const *l, double *A, lapack_int const *lda, double *B, lapack_int const *ldb, double *T, lapack_int const *ldt, lapack_int *info)
#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)
Definition: lapacke_utils.h:46
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: