LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dlarfb_work ( int  matrix_layout,
char  side,
char  trans,
char  direct,
char  storev,
lapack_int  m,
lapack_int  n,
lapack_int  k,
const double *  v,
lapack_int  ldv,
const double *  t,
lapack_int  ldt,
double *  c,
lapack_int  ldc,
double *  work,
lapack_int  ldwork 
)

Definition at line 36 of file lapacke_dlarfb_work.c.

42 {
43  lapack_int info = 0;
44  lapack_int nrows_v, ncols_v;
45  lapack_int ldc_t, ldt_t, ldv_t;
46  double *v_t = NULL, *t_t = NULL, *c_t = NULL;
47  if( matrix_layout == LAPACK_COL_MAJOR ) {
48  /* Call LAPACK function and adjust info */
49  LAPACK_dlarfb( &side, &trans, &direct, &storev, &m, &n, &k, v, &ldv, t,
50  &ldt, c, &ldc, work, &ldwork );
51  if( info < 0 ) {
52  info = info - 1;
53  }
54  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
55  nrows_v = ( LAPACKE_lsame( storev, 'c' ) &&
56  LAPACKE_lsame( side, 'l' ) ) ? m :
57  ( ( LAPACKE_lsame( storev, 'c' ) &&
58  LAPACKE_lsame( side, 'r' ) ) ? n :
59  ( LAPACKE_lsame( storev, 'r' ) ? k : 1) );
60  ncols_v = LAPACKE_lsame( storev, 'c' ) ? k :
61  ( ( LAPACKE_lsame( storev, 'r' ) &&
62  LAPACKE_lsame( side, 'l' ) ) ? m :
63  ( ( LAPACKE_lsame( storev, 'r' ) &&
64  LAPACKE_lsame( side, 'r' ) ) ? n : 1) );
65  ldc_t = MAX(1,m);
66  ldt_t = MAX(1,k);
67  ldv_t = MAX(1,nrows_v);
68  /* Check leading dimension(s) */
69  if( ldc < n ) {
70  info = -14;
71  LAPACKE_xerbla( "LAPACKE_dlarfb_work", info );
72  return info;
73  }
74  if( ldt < k ) {
75  info = -12;
76  LAPACKE_xerbla( "LAPACKE_dlarfb_work", info );
77  return info;
78  }
79  if( ldv < ncols_v ) {
80  info = -10;
81  LAPACKE_xerbla( "LAPACKE_dlarfb_work", info );
82  return info;
83  }
84  /* Allocate memory for temporary array(s) */
85  v_t = (double*)
86  LAPACKE_malloc( sizeof(double) * ldv_t * MAX(1,ncols_v) );
87  if( v_t == NULL ) {
89  goto exit_level_0;
90  }
91  t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,k) );
92  if( t_t == NULL ) {
94  goto exit_level_1;
95  }
96  c_t = (double*)LAPACKE_malloc( sizeof(double) * ldc_t * MAX(1,n) );
97  if( c_t == NULL ) {
99  goto exit_level_2;
100  }
101  /* Transpose input matrices */
102  if( LAPACKE_lsame( storev, 'c' ) && LAPACKE_lsame( direct, 'f' ) ) {
103  LAPACKE_dtr_trans( matrix_layout, 'l', 'u', k, v, ldv, v_t, ldv_t );
104  LAPACKE_dge_trans( matrix_layout, nrows_v-k, ncols_v, &v[k*ldv], ldv,
105  &v_t[k], ldv_t );
106  } else if( LAPACKE_lsame( storev, 'c' ) &&
107  LAPACKE_lsame( direct, 'b' ) ) {
108  if( k > nrows_v ) {
109  LAPACKE_xerbla( "LAPACKE_dlarfb_work", -8 );
110  return -8;
111  }
112  LAPACKE_dtr_trans( matrix_layout, 'u', 'u', k, &v[(nrows_v-k)*ldv],
113  ldv, &v_t[nrows_v-k], ldv_t );
114  LAPACKE_dge_trans( matrix_layout, nrows_v-k, ncols_v, v, ldv, v_t,
115  ldv_t );
116  } else if( LAPACKE_lsame( storev, 'r' ) &&
117  LAPACKE_lsame( direct, 'f' ) ) {
118  LAPACKE_dtr_trans( matrix_layout, 'u', 'u', k, v, ldv, v_t, ldv_t );
119  LAPACKE_dge_trans( matrix_layout, nrows_v, ncols_v-k, &v[k], ldv,
120  &v_t[k*ldv_t], ldv_t );
121  } else if( LAPACKE_lsame( storev, 'r' ) &&
122  LAPACKE_lsame( direct, 'f' ) ) {
123  if( k > ncols_v ) {
124  LAPACKE_xerbla( "LAPACKE_dlarfb_work", -8 );
125  return -8;
126  }
127  LAPACKE_dtr_trans( matrix_layout, 'l', 'u', k, &v[ncols_v-k], ldv,
128  &v_t[(ncols_v-k)*ldv_t], ldv_t );
129  LAPACKE_dge_trans( matrix_layout, nrows_v, ncols_v-k, v, ldv, v_t,
130  ldv_t );
131  }
132  LAPACKE_dge_trans( matrix_layout, k, k, t, ldt, t_t, ldt_t );
133  LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
134  /* Call LAPACK function and adjust info */
135  LAPACK_dlarfb( &side, &trans, &direct, &storev, &m, &n, &k, v_t, &ldv_t,
136  t_t, &ldt_t, c_t, &ldc_t, work, &ldwork );
137  info = 0; /* LAPACK call is ok! */
138  /* Transpose output matrices */
139  LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
140  /* Release memory and exit */
141  LAPACKE_free( c_t );
142 exit_level_2:
143  LAPACKE_free( t_t );
144 exit_level_1:
145  LAPACKE_free( v_t );
146 exit_level_0:
147  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
148  LAPACKE_xerbla( "LAPACKE_dlarfb_work", info );
149  }
150  } else {
151  info = -1;
152  LAPACKE_xerbla( "LAPACKE_dlarfb_work", info );
153  }
154  return info;
155 }
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
void LAPACK_dlarfb(char *side, char *trans, char *direct, char *storev, lapack_int *m, lapack_int *n, lapack_int *k, const double *v, lapack_int *ldv, const double *t, lapack_int *ldt, double *c, lapack_int *ldc, double *work, lapack_int *ldwork)
#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
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
void LAPACKE_dtr_trans(int matrix_layout, char uplo, char diag, 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: