LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dlarft_work()

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 35 of file lapacke_dlarft_work.c.

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