libflame  revision_anchor
Functions
FLA_Bidiag_unb_external.c File Reference

(r)

Functions

FLA_Error FLA_Bidiag_unb_external (FLA_Obj A, FLA_Obj tu, FLA_Obj tv)
 
FLA_Error FLA_Bidiag_unb_ext (FLA_Obj A, FLA_Obj tu, FLA_Obj tv)
 

Function Documentation

◆ FLA_Bidiag_unb_ext()

FLA_Error FLA_Bidiag_unb_ext ( FLA_Obj  A,
FLA_Obj  tu,
FLA_Obj  tv 
)

References FLA_Bidiag_unb_external().

146 {
147  return FLA_Bidiag_unb_external( A, tu, tv );
148 }
FLA_Error FLA_Bidiag_unb_external(FLA_Obj A, FLA_Obj tu, FLA_Obj tv)
Definition: FLA_Bidiag_unb_external.c:13

◆ FLA_Bidiag_unb_external()

FLA_Error FLA_Bidiag_unb_external ( FLA_Obj  A,
FLA_Obj  tu,
FLA_Obj  tv 
)

References F77_cgebd2(), F77_dgebd2(), F77_sgebd2(), F77_zgebd2(), FLA_Bidiag_check(), FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_datatype_proj_to_real(), FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLA_Obj_length(), FLA_Obj_max_dim(), FLA_Obj_min_dim(), and FLA_Obj_width().

Referenced by FLA_Bidiag_unb_ext().

14 {
15  int info = 0;
16 #ifdef FLA_ENABLE_EXTERNAL_LAPACK_INTERFACES
17  FLA_Datatype datatype;
18  int m_A, n_A, cs_A;
19  int min_m_n, max_m_n;
20  int lwork;
21  FLA_Obj d, e, work_obj;
22 
23  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
24  FLA_Bidiag_check( A, tu, tv );
25 
26  if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
27 
28  datatype = FLA_Obj_datatype( A );
29 
30  m_A = FLA_Obj_length( A );
31  n_A = FLA_Obj_width( A );
32  min_m_n = FLA_Obj_min_dim( A );
33  max_m_n = FLA_Obj_max_dim( A );
34  cs_A = FLA_Obj_col_stride( A );
35 
36  FLA_Obj_create( FLA_Obj_datatype_proj_to_real( A ), min_m_n, 1, 0, 0, &d );
37  FLA_Obj_create( FLA_Obj_datatype_proj_to_real( A ), min_m_n - 1, 1, 0, 0, &e );
38 
39  lwork = max_m_n;
40  FLA_Obj_create( datatype, lwork, 1, 0, 0, &work_obj );
41 
42 
43  switch( datatype ){
44 
45  case FLA_FLOAT:
46  {
47  float* buff_A = ( float * ) FLA_FLOAT_PTR( A );
48  float* buff_d = ( float * ) FLA_FLOAT_PTR( d );
49  float* buff_e = ( float * ) FLA_FLOAT_PTR( e );
50  float* buff_tu = ( float * ) FLA_FLOAT_PTR( tu );
51  float* buff_tv = ( float * ) FLA_FLOAT_PTR( tv );
52  float* buff_work = ( float * ) FLA_FLOAT_PTR( work_obj );
53 
54  F77_sgebd2( &m_A,
55  &n_A,
56  buff_A, &cs_A,
57  buff_d,
58  buff_e,
59  buff_tu,
60  buff_tv,
61  buff_work,
62  &info );
63 
64  break;
65  }
66 
67  case FLA_DOUBLE:
68  {
69  double* buff_A = ( double * ) FLA_DOUBLE_PTR( A );
70  double* buff_d = ( double * ) FLA_DOUBLE_PTR( d );
71  double* buff_e = ( double * ) FLA_DOUBLE_PTR( e );
72  double* buff_tu = ( double * ) FLA_DOUBLE_PTR( tu );
73  double* buff_tv = ( double * ) FLA_DOUBLE_PTR( tv );
74  double* buff_work = ( double * ) FLA_DOUBLE_PTR( work_obj );
75 
76  F77_dgebd2( &m_A,
77  &n_A,
78  buff_A, &cs_A,
79  buff_d,
80  buff_e,
81  buff_tu,
82  buff_tv,
83  buff_work,
84  &info );
85 
86  break;
87  }
88 
89  case FLA_COMPLEX:
90  {
91  scomplex* buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
92  float* buff_d = ( float * ) FLA_FLOAT_PTR( d );
93  float* buff_e = ( float * ) FLA_FLOAT_PTR( e );
94  scomplex* buff_tu = ( scomplex * ) FLA_COMPLEX_PTR( tu );
95  scomplex* buff_tv = ( scomplex * ) FLA_COMPLEX_PTR( tv );
96  scomplex* buff_work = ( scomplex * ) FLA_COMPLEX_PTR( work_obj );
97 
98  F77_cgebd2( &m_A,
99  &n_A,
100  buff_A, &cs_A,
101  buff_d,
102  buff_e,
103  buff_tu,
104  buff_tv,
105  buff_work,
106  &info );
107 
108  break;
109  }
110 
111  case FLA_DOUBLE_COMPLEX:
112  {
113  dcomplex* buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
114  double* buff_d = ( double * ) FLA_DOUBLE_PTR( d );
115  double* buff_e = ( double * ) FLA_DOUBLE_PTR( e );
116  dcomplex* buff_tu = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( tu );
117  dcomplex* buff_tv = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( tv );
118  dcomplex* buff_work = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( work_obj );
119 
120  F77_zgebd2( &m_A,
121  &n_A,
122  buff_A, &cs_A,
123  buff_d,
124  buff_e,
125  buff_tu,
126  buff_tv,
127  buff_work,
128  &info );
129 
130  break;
131  }
132 
133  }
134 
135  FLA_Obj_free( &d );
136  FLA_Obj_free( &e );
137  FLA_Obj_free( &work_obj );
138 #else
139  FLA_Check_error_code( FLA_EXTERNAL_LAPACK_NOT_IMPLEMENTED );
140 #endif
141 
142  return info;
143 }
FLA_Error FLA_Obj_create(FLA_Datatype datatype, dim_t m, dim_t n, dim_t rs, dim_t cs, FLA_Obj *obj)
Definition: FLA_Obj.c:55
int F77_cgebd2(int *m, int *n, scomplex *a, int *lda, float *d, float *e, scomplex *tauq, scomplex *taup, scomplex *work, int *info)
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Error FLA_Bidiag_check(FLA_Obj A, FLA_Obj tu, FLA_Obj tv)
Definition: FLA_Bidiag_check.c:13
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
Definition: FLA_type_defs.h:158
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
int F77_zgebd2(int *m, int *n, dcomplex *a, int *lda, double *d, double *e, dcomplex *tauq, dcomplex *taup, dcomplex *work, int *info)
FLA_Datatype FLA_Obj_datatype_proj_to_real(FLA_Obj A)
Definition: FLA_Query.c:23
Definition: blis_type_defs.h:132
int F77_sgebd2(int *m, int *n, float *a, int *lda, float *d, float *e, float *tauq, float *taup, float *work, int *info)
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_max_dim(FLA_Obj obj)
Definition: FLA_Query.c:160
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition: FLA_Query.c:174
int F77_dgebd2(int *m, int *n, double *a, int *lda, double *d, double *e, double *tauq, double *taup, double *work, int *info)
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
Definition: blis_type_defs.h:137
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153