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 {
138 
142 
143  RemoveAdaptor_<MT> tmp( A );
144 
145  gesdd( tmp, s );
146 }
147 //*************************************************************************************************
148 
149 
150 //*************************************************************************************************
207 template< typename MT1 // Type of the matrix A
208  , bool SO // Storage order of all matrices
209  , typename VT // Type of the vector s
210  , bool TF // Transpose flag of the vector s
211  , typename MT2 // Type of the matrix U
212  , typename MT3 > // Type of the matrix V
213 inline void svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
215 {
220 
225 
229 
234 
235  RemoveAdaptor_<MT1> tmp( A );
236 
237  gesdd( tmp, U, s, V, 'S' );
238 }
239 //*************************************************************************************************
240 
241 
242 //*************************************************************************************************
304 template< typename MT // Type of the matrix A
305  , bool SO // Storage order of the matrix A
306  , typename VT // Type of the vector s
307  , bool TF // Transpose flag of the vector s
308  , typename ST > // Type of the scalar boundary values
309 inline size_t svd( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s, ST low, ST upp )
310 {
315 
319 
321 
322  RemoveAdaptor_<MT> tmp( A );
323 
324  return gesvdx( tmp, s, low, upp );
325 }
326 //*************************************************************************************************
327 
328 
329 //*************************************************************************************************
407 template< typename MT1 // Type of the matrix A
408  , bool SO // Storage order of all matrices
409  , typename VT // Type of the vector s
410  , bool TF // Transpose flag of the vector s
411  , typename MT2 // Type of the matrix U
412  , typename MT3 // Type of the matrix V
413  , typename ST > // Type of the scalar boundary values
414 inline size_t svd( const DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
415  DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V, ST low, ST upp )
416 {
421 
426 
430 
435 
437 
438  RemoveAdaptor_<MT1> tmp( A );
439 
440  return gesvdx( tmp, U, s, V, low, upp );
441 }
442 //*************************************************************************************************
443 
444 } // namespace blaze
445 
446 #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
typename RemoveAdaptor< T >::Type RemoveAdaptor_
Auxiliary alias declaration for the RemoveAdaptor type trait.The RemoveAdaptor_ alias declaration pro...
Definition: RemoveAdaptor.h:153
#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.
#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:71
Constraint on the data type.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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:70
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:163
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:177
#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)