LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dlarfb()

lapack_int LAPACKE_dlarfb ( 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 
)

Definition at line 35 of file lapacke_dlarfb.c.

40 {
41  lapack_int info = 0;
42  lapack_int ldwork;
43  double* work = NULL;
44  lapack_int ncols_v, nrows_v;
45  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
46  LAPACKE_xerbla( "LAPACKE_dlarfb", -1 );
47  return -1;
48  }
49 #ifndef LAPACK_DISABLE_NAN_CHECK
50  if( LAPACKE_get_nancheck() ) {
51  /* Optionally check input matrices for NaNs */
52  lapack_int lrv, lcv; /* row, column stride */
53  if( matrix_layout == LAPACK_COL_MAJOR ) {
54  lrv = 1;
55  lcv = ldv;
56  } else {
57  lrv = ldv;
58  lcv = 1;
59  }
60  ncols_v = LAPACKE_lsame( storev, 'c' ) ? k :
61  ( ( LAPACKE_lsame( storev, 'r' ) && LAPACKE_lsame( side, 'l' ) ) ? m :
62  ( ( LAPACKE_lsame( storev, 'r' ) && LAPACKE_lsame( side, 'r' ) ) ? n : 1) );
63 
64  nrows_v = ( LAPACKE_lsame( storev, 'c' ) && LAPACKE_lsame( side, 'l' ) ) ? m :
65  ( ( LAPACKE_lsame( storev, 'c' ) && LAPACKE_lsame( side, 'r' ) ) ? n :
66  ( LAPACKE_lsame( storev, 'r' ) ? k : 1) );
67  if( LAPACKE_dge_nancheck( matrix_layout, m, n, c, ldc ) ) {
68  return -13;
69  }
70  if( LAPACKE_dge_nancheck( matrix_layout, k, k, t, ldt ) ) {
71  return -11;
72  }
73  if( LAPACKE_lsame( storev, 'c' ) && LAPACKE_lsame( direct, 'f' ) ) {
74  if( LAPACKE_dtr_nancheck( matrix_layout, 'l', 'u', k, v, ldv ) )
75  return -9;
76  if( LAPACKE_dge_nancheck( matrix_layout, nrows_v-k, ncols_v,
77  &v[k*lrv], ldv ) )
78  return -9;
79  } else if( LAPACKE_lsame( storev, 'c' ) && LAPACKE_lsame( direct, 'b' ) ) {
80  if( k > nrows_v ) {
81  LAPACKE_xerbla( "LAPACKE_dlarfb", -8 );
82  return -8;
83  }
84  if( LAPACKE_dtr_nancheck( matrix_layout, 'u', 'u', k,
85  &v[(nrows_v-k)*lrv], ldv ) )
86  return -9;
87  if( LAPACKE_dge_nancheck( matrix_layout, nrows_v-k, ncols_v, v, ldv ) )
88  return -9;
89  } else if( LAPACKE_lsame( storev, 'r' ) && LAPACKE_lsame( direct, 'f' ) ) {
90  if( LAPACKE_dtr_nancheck( matrix_layout, 'u', 'u', k, v, ldv ) )
91  return -9;
92  if( LAPACKE_dge_nancheck( matrix_layout, nrows_v, ncols_v-k,
93  &v[k*lrv], ldv ) )
94  return -9;
95  } else if( LAPACKE_lsame( storev, 'r' ) && LAPACKE_lsame( direct, 'b' ) ) {
96  if( k > ncols_v ) {
97  LAPACKE_xerbla( "LAPACKE_dlarfb", -8 );
98  return -8;
99  }
100  if( LAPACKE_dtr_nancheck( matrix_layout, 'l', 'u', k,
101  &v[(ncols_v-k)*lcv], ldv ) )
102  return -9;
103  if( LAPACKE_dge_nancheck( matrix_layout, nrows_v, ncols_v-k, v, ldv ) )
104  return -9;
105  }
106  }
107 #endif
108  if( LAPACKE_lsame( side, 'l' ) ) {
109  ldwork = n;
110  } else if( LAPACKE_lsame( side, 'r' ) ) {
111  ldwork = m;
112  } else {
113  ldwork = 1;
114  }
115  /* Allocate memory for working array(s) */
116  work = (double*)LAPACKE_malloc( sizeof(double) * ldwork * MAX(1,k) );
117  if( work == NULL ) {
119  goto exit_level_0;
120  }
121  /* Call middle-level interface */
122  info = LAPACKE_dlarfb_work( matrix_layout, side, trans, direct, storev, m, n,
123  k, v, ldv, t, ldt, c, ldc, work, ldwork );
124  /* Release memory and exit */
125  LAPACKE_free( work );
126 exit_level_0:
127  if( info == LAPACK_WORK_MEMORY_ERROR ) {
128  LAPACKE_xerbla( "LAPACKE_dlarfb", info );
129  }
130  return info;
131 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
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)
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACKE_free(p)
Definition: lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_dtr_nancheck(int matrix_layout, char uplo, char diag, lapack_int n, const double *a, lapack_int lda)
#define MAX(x, y)
Definition: lapacke_utils.h:46
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
Here is the call graph for this function: