libflame  revision_anchor
Functions
FLA_Bsvdd_external.c File Reference

(r)

Functions

FLA_Error FLA_Bsvdd_external (FLA_Uplo uplo, FLA_Obj d, FLA_Obj e, FLA_Obj U, FLA_Obj V)
 

Function Documentation

◆ FLA_Bsvdd_external()

FLA_Error FLA_Bsvdd_external ( FLA_Uplo  uplo,
FLA_Obj  d,
FLA_Obj  e,
FLA_Obj  U,
FLA_Obj  V 
)
14 {
15  int info = 0;
16 #ifdef FLA_ENABLE_EXTERNAL_LAPACK_INTERFACES
17  FLA_Datatype datatype;
18  FLA_Datatype dt_real;
19  int m_U, cs_U;
20  int n_V, cs_V;
21  int n_C, cs_C;
22  int min_m_n;
23  int inc_d, inc_e;
24  int lwork, liwork;
25  FLA_Obj work, iwork;
26  char blas_uplo;
27  char blas_compq = 'I';
28 
29  //if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
30  // FLA_Bsvd_check( uplo, d, e, U, V );
31 
32  if ( FLA_Obj_has_zero_dim( d ) ) return FLA_SUCCESS;
33 
34  datatype = FLA_Obj_datatype( U );
35  dt_real = FLA_Obj_datatype_proj_to_real( U );
36 
37  m_U = FLA_Obj_length( U );
38  cs_U = FLA_Obj_col_stride( U );
39 
40  n_V = FLA_Obj_length( V );
41  cs_V = FLA_Obj_col_stride( V );
42 
43  n_C = 0;
44  cs_C = 1;
45 
46  min_m_n = FLA_Obj_vector_dim( d );
47 
48  inc_d = FLA_Obj_vector_inc( d );
49  inc_e = FLA_Obj_vector_inc( e );
50 
51  lwork = max( 1, 3*min_m_n*min_m_n + 4*min_m_n );
52  liwork = 8*min_m_n;
53 
54  FLA_Obj_create( dt_real, lwork, 1, 0, 0, &work );
55  FLA_Obj_create( FLA_INT, liwork, 1, 0, 0, &iwork );
56 
57  FLA_Param_map_flame_to_netlib_uplo( uplo, &blas_uplo );
58 
59  switch( datatype ) {
60 
61  case FLA_FLOAT:
62  {
63  float* buff_d = ( float * ) FLA_FLOAT_PTR( d );
64  float* buff_e = ( float * ) FLA_FLOAT_PTR( e );
65  float* buff_U = ( float * ) FLA_FLOAT_PTR( U );
66  float* buff_V = ( float * ) FLA_FLOAT_PTR( V );
67  float* buff_Q = ( float * ) NULL;
68  float* buff_IQ = ( float * ) NULL;
69  float* buff_work = ( float * ) FLA_FLOAT_PTR( work );
70  int* buff_iwork = ( int * ) FLA_INT_PTR( iwork );
71 
72  F77_sbdsdc( &blas_uplo,
73  &blas_compq,
74  &min_m_n,
75  buff_d,
76  buff_e,
77  buff_U, &cs_U,
78  buff_V, &cs_V,
79  buff_Q,
80  buff_IQ,
81  buff_work,
82  buff_iwork,
83  &info );
84 
85  break;
86  }
87 
88  case FLA_DOUBLE:
89  {
90  double* buff_d = ( double * ) FLA_DOUBLE_PTR( d );
91  double* buff_e = ( double * ) FLA_DOUBLE_PTR( e );
92  double* buff_U = ( double * ) FLA_DOUBLE_PTR( U );
93  double* buff_V = ( double * ) FLA_DOUBLE_PTR( V );
94  double* buff_Q = ( double * ) NULL;
95  double* buff_IQ = ( double * ) NULL;
96  double* buff_work = ( double * ) FLA_DOUBLE_PTR( work );
97  int* buff_iwork = ( int * ) FLA_INT_PTR( iwork );
98 
99  F77_dbdsdc( &blas_uplo,
100  &blas_compq,
101  &min_m_n,
102  buff_d,
103  buff_e,
104  buff_U, &cs_U,
105  buff_V, &cs_V,
106  buff_Q,
107  buff_IQ,
108  buff_work,
109  buff_iwork,
110  &info );
111 
112  break;
113  }
114 
115  }
116 
117  FLA_Obj_free( &work );
118  FLA_Obj_free( &iwork );
119 
120 #else
121  FLA_Check_error_code( FLA_EXTERNAL_LAPACK_NOT_IMPLEMENTED );
122 #endif
123 
124  return info;
125 }
int F77_sbdsdc(char *uplo, char *compq, int *n, float *d, float *e, float *u, int *ldu, float *vt, int *ldvt, float *q, float *iq, float *work, int *iwork, int *info)
int F77_dbdsdc(char *uplo, char *compq, int *n, double *d, double *e, double *u, int *ldu, double *vt, int *ldvt, double *q, double *iq, double *work, int *iwork, int *info)
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
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
FLA_Datatype FLA_Obj_datatype_proj_to_real(FLA_Obj A)
Definition: FLA_Query.c:23
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition: FLA_Query.c:174
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition: FLA_Query.c:145
void FLA_Param_map_flame_to_netlib_uplo(FLA_Uplo uplo, void *blas_uplo)
Definition: FLA_Param.c:47
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition: FLA_Query.c:137
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
int FLA_Datatype
Definition: FLA_type_defs.h:49
Definition: FLA_type_defs.h:159

References F77_dbdsdc(), F77_sbdsdc(), 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_vector_dim(), FLA_Obj_vector_inc(), and FLA_Param_map_flame_to_netlib_uplo().