LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dlarft_work ( int  matrix_layout,
char  direct,
char  storev,
lapack_int  n,
lapack_int  k,
const double *  v,
lapack_int  ldv,
const double *  tau,
double *  t,
lapack_int  ldt 
)

Definition at line 36 of file lapacke_dlarft_work.c.

40 {
41  lapack_int info = 0;
42  lapack_int nrows_v, ncols_v;
43  lapack_int ldt_t, ldv_t;
44  double *v_t = NULL, *t_t = NULL;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_dlarft( &direct, &storev, &n, &k, v, &ldv, tau, t, &ldt );
48  if( info < 0 ) {
49  info = info - 1;
50  }
51  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52  nrows_v = LAPACKE_lsame( storev, 'c' ) ? n :
53  ( LAPACKE_lsame( storev, 'r' ) ? k : 1);
54  ncols_v = LAPACKE_lsame( storev, 'c' ) ? k :
55  ( LAPACKE_lsame( storev, 'r' ) ? n : 1);
56  ldt_t = MAX(1,k);
57  ldv_t = MAX(1,nrows_v);
58  /* Check leading dimension(s) */
59  if( ldt < k ) {
60  info = -10;
61  LAPACKE_xerbla( "LAPACKE_dlarft_work", info );
62  return info;
63  }
64  if( ldv < ncols_v ) {
65  info = -7;
66  LAPACKE_xerbla( "LAPACKE_dlarft_work", info );
67  return info;
68  }
69  /* Allocate memory for temporary array(s) */
70  v_t = (double*)
71  LAPACKE_malloc( sizeof(double) * ldv_t * MAX(1,ncols_v) );
72  if( v_t == NULL ) {
74  goto exit_level_0;
75  }
76  t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,k) );
77  if( t_t == NULL ) {
79  goto exit_level_1;
80  }
81  /* Transpose input matrices */
82  LAPACKE_dge_trans( matrix_layout, nrows_v, ncols_v, v, ldv, v_t, ldv_t );
83  /* Call LAPACK function and adjust info */
84  LAPACK_dlarft( &direct, &storev, &n, &k, v_t, &ldv_t, tau, t_t,
85  &ldt_t );
86  info = 0; /* LAPACK call is ok! */
87  /* Transpose output matrices */
88  LAPACKE_dge_trans( LAPACK_COL_MAJOR, k, k, t_t, ldt_t, t, ldt );
89  /* Release memory and exit */
90  LAPACKE_free( t_t );
91 exit_level_1:
92  LAPACKE_free( v_t );
93 exit_level_0:
94  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
95  LAPACKE_xerbla( "LAPACKE_dlarft_work", info );
96  }
97  } else {
98  info = -1;
99  LAPACKE_xerbla( "LAPACKE_dlarft_work", info );
100  }
101  return info;
102 }
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 MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#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 LAPACK_dlarft(char *direct, char *storev, lapack_int *n, lapack_int *k, const double *v, lapack_int *ldv, const double *tau, double *t, lapack_int *ldt)
#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: