SVD.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_SVD_H_
36 #define _BLAZE_MATH_DENSE_SVD_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
52 
53 
54 namespace blaze {
55 
56 //=================================================================================================
57 //
58 // SINGULAR VALUE DECOMPOSITION FUNCTIONS
59 //
60 //=================================================================================================
61 
62 //*************************************************************************************************
65 template< typename MT, bool SO, typename VT, bool TF >
66 inline void svd( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s );
67 
68 template< typename MT1, bool SO, typename VT, bool TF, typename MT2, typename MT3 >
69 inline void svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
70  DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V );
71 
72 template< typename MT, bool SO, typename VT, bool TF, typename ST >
73 inline size_t svd( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s, ST low, ST upp );
74 
75 template< typename MT1, bool SO, typename VT, bool TF, typename MT2, typename MT3, typename ST >
76 inline size_t svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
77  DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V, ST low, ST upp );
79 //*************************************************************************************************
80 
81 
82 //*************************************************************************************************
129 template< typename MT // Type of the matrix A
130  , bool SO // Storage order of the matrix A
131  , typename VT // Type of the vector s
132  , bool TF > // Transpose flag of the vector s
133 inline void svd( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s )
134 {
137 
141 
142  using Tmp = ResultType_< RemoveAdaptor_<MT> >;
143 
148 
149  Tmp tmp( A );
150 
151  gesdd( tmp, s );
152 }
153 //*************************************************************************************************
154 
155 
156 //*************************************************************************************************
213 template< typename MT1 // Type of the matrix A
214  , bool SO // Storage order of all matrices
215  , typename VT // Type of the vector s
216  , bool TF // Transpose flag of the vector s
217  , typename MT2 // Type of the matrix U
218  , typename MT3 > // Type of the matrix V
219 inline void svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
221 {
224 
229 
233 
238 
239  using Tmp = ResultType_< RemoveAdaptor_<MT1> >;
240 
245 
246  Tmp tmp( A );
247 
248  gesdd( tmp, U, s, V, 'S' );
249 }
250 //*************************************************************************************************
251 
252 
253 //*************************************************************************************************
315 template< typename MT // Type of the matrix A
316  , bool SO // Storage order of the matrix A
317  , typename VT // Type of the vector s
318  , bool TF // Transpose flag of the vector s
319  , typename ST > // Type of the scalar boundary values
320 inline size_t svd( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s, ST low, ST upp )
321 {
324 
328 
330 
331  using Tmp = ResultType_< RemoveAdaptor_<MT> >;
332 
337 
338  Tmp tmp( A );
339 
340  return gesvdx( tmp, s, low, upp );
341 }
342 //*************************************************************************************************
343 
344 
345 //*************************************************************************************************
423 template< typename MT1 // Type of the matrix A
424  , bool SO // Storage order of all matrices
425  , typename VT // Type of the vector s
426  , bool TF // Transpose flag of the vector s
427  , typename MT2 // Type of the matrix U
428  , typename MT3 // Type of the matrix V
429  , typename ST > // Type of the scalar boundary values
430 inline size_t svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
431  DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V, ST low, ST upp )
432 {
435 
440 
444 
449 
451 
452  using Tmp = ResultType_< RemoveAdaptor_<MT1> >;
453 
458 
459  Tmp tmp( A );
460 
461  return gesvdx( tmp, U, s, V, low, upp );
462 }
463 //*************************************************************************************************
464 
465 } // namespace blaze
466 
467 #endif
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
Header file for the LAPACK singular value decomposition functions (gesvdx)
Header file for the DenseVector base class.
Constraint on the data type.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ADAPTOR_TYPE(T)
Constraint on the data type.In case the given data type T is an adaptor type (as for instance LowerMa...
Definition: Adaptor.h:81
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Constraint on the data type.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the DenseMatrix base class.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
void gesdd(char jobz, int m, int n, float *A, int lda, float *s, float *U, int ldu, float *V, int ldv, float *work, int lwork, int *iwork, int *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesdd.h:165
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
void svd(const DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s)
Singular value decomposition (SVD) of the given dense general matrix.
Definition: SVD.h:133
void gesvdx(char jobu, char jobv, char range, int m, int n, float *A, int lda, float vl, float vu, int il, int iu, int *ns, float *s, float *U, int ldu, float *V, int ldv, float *work, int lwork, int *iwork, int *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesvdx.h:179
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is not a built-in data type, a compilation error is created.
Definition: Builtin.h:60
Header file for the LAPACK singular value decomposition functions (gesdd)