Blaze 3.9
Singular Value

LAPACK SVD functions (gesdd)

void blaze::gesdd (char jobz, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix. More...
 
void blaze::gesdd (char jobz, blas_int_t m, blas_int_t n, double *A, blas_int_t lda, double *s, double *U, blas_int_t ldu, double *V, blas_int_t ldv, double *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix. More...
 
void blaze::gesdd (char jobz, blas_int_t m, blas_int_t n, complex< float > *A, blas_int_t lda, float *s, complex< float > *U, blas_int_t ldu, complex< float > *V, blas_int_t ldv, complex< float > *work, blas_int_t lwork, float *rwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix. More...
 
void blaze::gesdd (char jobz, blas_int_t m, blas_int_t n, complex< double > *A, blas_int_t lda, double *s, complex< double > *U, blas_int_t ldu, complex< double > *V, blas_int_t ldv, complex< double > *work, blas_int_t lwork, double *rwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix. More...
 
template<typename MT , bool SO, typename VT , bool TF>
void blaze::gesdd (DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesdd (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, char jobz)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesdd (DenseMatrix< MT1, SO > &A, DenseVector< VT, TF > &s, DenseMatrix< MT2, SO > &V, char jobz)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
void blaze::gesdd (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V, char jobz)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 

LAPACK SVD functions (gesvd)

void blaze::gesvd (char jobu, char jobv, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix. More...
 
void blaze::gesvd (char jobu, char jobv, blas_int_t m, blas_int_t n, double *A, blas_int_t lda, double *s, double *U, blas_int_t ldu, double *V, blas_int_t ldv, double *work, blas_int_t lwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix. More...
 
void blaze::gesvd (char jobu, char jobv, blas_int_t m, blas_int_t n, complex< float > *A, blas_int_t lda, float *s, complex< float > *U, blas_int_t ldu, complex< float > *V, blas_int_t ldv, complex< float > *work, blas_int_t lwork, float *rwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix. More...
 
void blaze::gesvd (char jobu, char jobv, blas_int_t m, blas_int_t n, complex< double > *A, blas_int_t lda, double *s, complex< double > *U, blas_int_t ldu, complex< double > *V, blas_int_t ldv, complex< double > *work, blas_int_t lwork, double *rwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix. More...
 
template<typename MT , bool SO, typename VT , bool TF>
void blaze::gesvd (DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s, char jobu, char jobv)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesvd (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, char jobu, char jobv)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 >
void blaze::gesvd (DenseMatrix< MT1, SO > &A, DenseVector< VT, TF > &s, DenseMatrix< MT2, SO > &V, char jobu, char jobv)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
void blaze::gesvd (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V, char jobu, char jobv)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 

LAPACK SVD functions (gesvdx)

void blaze::gesvdx (char jobu, char jobv, char range, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float vl, float vu, blas_int_t il, blas_int_t iu, blas_int_t *ns, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix. More...
 
void blaze::gesvdx (char jobu, char jobv, char range, blas_int_t m, blas_int_t n, double *A, blas_int_t lda, double vl, double vu, blas_int_t il, blas_int_t iu, blas_int_t *ns, double *s, double *U, blas_int_t ldu, double *V, blas_int_t ldv, double *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix. More...
 
void blaze::gesvdx (char jobu, char jobv, char range, blas_int_t m, blas_int_t n, complex< float > *A, blas_int_t lda, float vl, float vu, blas_int_t il, blas_int_t iu, blas_int_t *ns, float *s, complex< float > *U, blas_int_t ldu, complex< float > *V, blas_int_t ldv, complex< float > *work, blas_int_t lwork, float *rwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix. More...
 
void blaze::gesvdx (char jobu, char jobv, char range, blas_int_t m, blas_int_t n, complex< double > *A, blas_int_t lda, double vl, double vu, blas_int_t il, blas_int_t iu, blas_int_t *ns, double *s, complex< double > *U, blas_int_t ldu, complex< double > *V, blas_int_t ldv, complex< double > *work, blas_int_t lwork, double *rwork, blas_int_t *iwork, blas_int_t *info)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix. More...
 
template<typename MT , bool SO, typename VT , bool TF>
size_t blaze::gesvdx (DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT , bool SO, typename VT , bool TF, typename ST >
size_t blaze::gesvdx (DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s, ST low, ST upp)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename ST >
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, ST low, ST upp)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 >
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseVector< VT, TF > &s, DenseMatrix< MT2, SO > &V)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 , typename ST >
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseVector< VT, TF > &s, DenseMatrix< MT2, SO > &V, ST low, ST upp)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 
template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 , typename ST >
size_t blaze::gesvdx (DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V, ST low, ST upp)
 LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix. More...
 

Detailed Description

Function Documentation

◆ gesdd() [1/8]

void blaze::gesdd ( char  jobz,
blas_int_t  m,
blas_int_t  n,
complex< double > *  A,
blas_int_t  lda,
double *  s,
complex< double > *  U,
blas_int_t  ldu,
complex< double > *  V,
blas_int_t  ldv,
complex< double > *  work,
blas_int_t  lwork,
double *  rwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix.

Parameters
jobzSpecifies the computation of the singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision complex column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max(1, lwork).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; see online reference for details.
iworkAuxiliary array; size >= 8*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n double precision complex column-major matrix based on the LAPACK zgesdd() function. Optionally, it computes the left and/or right singular vectors using a divide-and-conquer strategy. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'A': All m columns of U and all n rows of V are returned in U and V; U must be a general m-by-m matrix and V must be a general n-by-n matrix.
  • 'S': The first min(m,n) columns of U and the first min(m,n) rows of V are returned in U and V; U must be a m-by-min(m,n) matrix and V must be a min(m,n)-by-n matrix.
  • 'O': If m >= n, the first n columns of U are returned in A and all rows of V are returned in V; matrix U is not referenced. Otherwise all columns of U are returned in U and the first m rows of V are returned in A; matrix V is not referenced.
  • 'N': No columns of U or rows of V are computed; both U and V are not referenced.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: The decomposition did not converge.

For more information on the zgesdd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [2/8]

void blaze::gesdd ( char  jobz,
blas_int_t  m,
blas_int_t  n,
complex< float > *  A,
blas_int_t  lda,
float *  s,
complex< float > *  U,
blas_int_t  ldu,
complex< float > *  V,
blas_int_t  ldv,
complex< float > *  work,
blas_int_t  lwork,
float *  rwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix.

Parameters
jobzSpecifies the computation of the singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision complex column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max(1, lwork).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; see online reference for details.
iworkAuxiliary array; size >= 8*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n single precision complex column-major matrix based on the LAPACK cgesdd() function. Optionally, it computes the left and/or right singular vectors using a divide-and-conquer strategy. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'A': All m columns of U and all n rows of V are returned in U and V; U must be a general m-by-m matrix and V must be a general n-by-n matrix.
  • 'S': The first min(m,n) columns of U and the first min(m,n) rows of V are returned in U and V; U must be a m-by-min(m,n) matrix and V must be a min(m,n)-by-n matrix.
  • 'O': If m >= n, the first n columns of U are returned in A and all rows of V are returned in V; matrix U is not referenced. Otherwise all columns of U are returned in U and the first m rows of V are returned in A; matrix V is not referenced.
  • 'N': No columns of U or rows of V are computed; both U and V are not referenced.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: The decomposition did not converge.

For more information on the cgesdd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [3/8]

void blaze::gesdd ( char  jobz,
blas_int_t  m,
blas_int_t  n,
double *  A,
blas_int_t  lda,
double *  s,
double *  U,
blas_int_t  ldu,
double *  V,
blas_int_t  ldv,
double *  work,
blas_int_t  lwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix.

Parameters
jobzSpecifies the computation of the singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max(1, lwork).
lworkThe dimension of the array work; see online reference for details.
iworkAuxiliary array; size >= 8*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n double precision column-major matrix based on the LAPACK dgesdd() function. Optionally, it computes the left and/or right singular vectors using a divide-and-conquer strategy. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'A': All m columns of U and all n rows of V are returned in U and V; U must be a general m-by-m matrix and V must be a general n-by-n matrix.
  • 'S': The first min(m,n) columns of U and the first min(m,n) rows of V are returned in U and V; U must be a m-by-min(m,n) matrix and V must be a min(m,n)-by-n matrix.
  • 'O': If m >= n, the first n columns of U are returned in A and all rows of V are returned in V; matrix U is not referenced. Otherwise all columns of U are returned in U and the first m rows of V are returned in A; matrix V is not referenced.
  • 'N': No columns of U or rows of V are computed; both U and V are not referenced.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: The decomposition did not converge.

For more information on the dgesdd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [4/8]

void blaze::gesdd ( char  jobz,
blas_int_t  m,
blas_int_t  n,
float *  A,
blas_int_t  lda,
float *  s,
float *  U,
blas_int_t  ldu,
float *  V,
blas_int_t  ldv,
float *  work,
blas_int_t  lwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix.

Parameters
jobzSpecifies the computation of the singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max(1, lwork).
lworkThe dimension of the array work; see online reference for details.
iworkAuxiliary array; size >= 8*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n single precision column-major matrix based on the LAPACK sgesdd() function. Optionally, it computes the left and/or right singular vectors using a divide-and-conquer strategy. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'A': All m columns of U and all n rows of V are returned in U and V; U must be a general m-by-m matrix and V must be a general n-by-n matrix.
  • 'S': The first min(m,n) columns of U and the first min(m,n) rows of V are returned in U and V; U must be a m-by-min(m,n) matrix and V must be a min(m,n)-by-n matrix.
  • 'O': If m >= n, the first n columns of U are returned in A and all rows of V are returned in V; matrix U is not referenced. Otherwise all columns of U are returned in U and the first m rows of V are returned in A; matrix V is not referenced.
  • 'N': No columns of U or rows of V are computed; both U and V are not referenced.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: The decomposition did not converge.

For more information on the sgesdd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [5/8]

template<typename MT , bool SO, typename VT , bool TF>
void blaze::gesdd ( DenseMatrix< MT, SO > &  A,
DenseVector< VT, TF > &  s 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesdd() functions, which use a divide-and-conquer strategy.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesdd( A, s );
Efficient implementation of a dynamic matrix.
Definition: DynamicMatrix.h:242
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
void gesdd(char jobz, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesdd.h:185
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58

For more information on the gesdd() functions (i.e. sgesdd(), dgesdd(), cgesdd(), and zgesdd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [6/8]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesdd ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
char  jobz 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
jobzSpecifies the computation of the singular vectors ('O' or 'N').
Returns
void
Exceptions
std::invalid_argumentInvalid input matrix provided.
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobz argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix (m < n) based on the LAPACK gesdd() functions, which uses a divide-and-conquer strategy. Optionally, it computes the left or right singular vectors.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'O': If m < n, the m left singular vectors are returned in the columns of U and the m right singular vectors are returned in the rows of A; U is either resized (if possible) or expected to be a m-by-m matrix, the dimensions of A are not adapted. Otherwise a std::invalid_argument exception is thrown.
  • 'N': No left and right signular vectors are computed; U is not referenced.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... jobz == 'O' and m >= n;
  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given jobz argument is neither 'O' nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesdd( A, U, s, 'O' );

For more information on the gesdd() functions (i.e. sgesdd(), dgesdd(), cgesdd(), and zgesdd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [7/8]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
void blaze::gesdd ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
DenseMatrix< MT3, SO > &  V,
char  jobz 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
jobzSpecifies the computation of the singular vectors ('A', 'S', or 'N').
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobz argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesdd() functions, which uses a divide-and-conquer strategy. Optionally, it computes the left or right singular vectors.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'A': All m columns of U and all n rows of V are returned in U and V; U is either resized (if possible) or expected to be a m-by-m matrix and V is either resized (if possible) or expected to be a n-by-n matrix.
  • 'S': The min(m,n) left singular vectors are returned in the columns of U; U is either resized (if possible) or expected to be a m-by-min(m,n) matrix. The min(m,n) right singular vectors are returned in the rows of V; V is either resized (if possible) or expected to be a min(m,n)-by-n matrix.
  • 'N': No columns of U or rows of V are computed; both U and V are not referenced.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given jobz argument is neither 'A', 'S', nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 8UL, 8UL ); // The matrix for the right singular vectors
gesdd( A, U, s, V, 'A' );
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesdd( A, U, s, V, 'S' );

For more information on the gesdd() functions (i.e. sgesdd(), dgesdd(), cgesdd(), and zgesdd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesdd() [8/8]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesdd ( DenseMatrix< MT1, SO > &  A,
DenseVector< VT, TF > &  s,
DenseMatrix< MT2, SO > &  V,
char  jobz 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
jobzSpecifies the computation of the singular vectors ('O' or 'N').
Returns
void
Exceptions
std::invalid_argumentInvalid input matrix provided.
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobz argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix (m >= n) based on the LAPACK gesdd() functions, which uses a divide-and-conquer strategy. Optionally, it computes the left or right singular vectors.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobz specifies the computation of the left and right singular vectors:

  • 'O': If m >= n, the n left singular vectors are returned in the columns of A and the n right singular vectors are returned in the rows of V; V is either resized (if possible) or expected to be a n-by-n matrix, the dimensions of A are not adapted. Otherwise a std::invalid_argument exception is thrown.
  • 'N': No left and right signular vectors are computed; V is not referenced.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... jobz == 'O' and m < n;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given jobz argument is neither 'O' nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesdd( A, s, V, 'O' );

For more information on the gesdd() functions (i.e. sgesdd(), dgesdd(), cgesdd(), and zgesdd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [1/8]

void blaze::gesvd ( char  jobu,
char  jobv,
blas_int_t  m,
blas_int_t  n,
complex< double > *  A,
blas_int_t  lda,
double *  s,
complex< double > *  U,
blas_int_t  ldu,
complex< double > *  V,
blas_int_t  ldv,
complex< double > *  work,
blas_int_t  lwork,
double *  rwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('A', 'S', 'O' or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision complex column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; size >= 5*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n double precision complex column-major matrix based on the LAPACK zgesvd() function. Optionally, it computes the left and/or right singular vectors. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U.
  • 'S': The first min(m,n) columns of U (the singular vectors) are returned in U.
  • 'O': The first min(m,n) columns of U (the singular vectors) are returned in A.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V.
  • 'S': The first min(m,n) rows of V (the singular vectors) are returned in V.
  • 'O': The first min(m,n) rows of V (the singular vectors) are returned in A.
  • 'N': No rows of V (no right singular vectors) are computed.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the zgesvd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [2/8]

void blaze::gesvd ( char  jobu,
char  jobv,
blas_int_t  m,
blas_int_t  n,
complex< float > *  A,
blas_int_t  lda,
float *  s,
complex< float > *  U,
blas_int_t  ldu,
complex< float > *  V,
blas_int_t  ldv,
complex< float > *  work,
blas_int_t  lwork,
float *  rwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('A', 'S', 'O' or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision complex column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; size >= 5*min(m,n).
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n single precision complex column-major matrix based on the LAPACK cgesvd() function. Optionally, it computes the left and/or right singular vectors. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U.
  • 'S': The first min(m,n) columns of U (the singular vectors) are returned in U.
  • 'O': The first min(m,n) columns of U (the singular vectors) are returned in A.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V.
  • 'S': The first min(m,n) rows of V (the singular vectors) are returned in V.
  • 'O': The first min(m,n) rows of V (the singular vectors) are returned in A.
  • 'N': No rows of V (no right singular vectors) are computed.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the cgesvd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [3/8]

void blaze::gesvd ( char  jobu,
char  jobv,
blas_int_t  m,
blas_int_t  n,
double *  A,
blas_int_t  lda,
double *  s,
double *  U,
blas_int_t  ldu,
double *  V,
blas_int_t  ldv,
double *  work,
blas_int_t  lwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('A', 'S', 'O' or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n double precision column-major matrix based on the LAPACK dgesvd() function. Optionally, it computes the left and/or right singular vectors. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U.
  • 'S': The first min(m,n) columns of U (the singular vectors) are returned in U.
  • 'O': The first min(m,n) columns of U (the singular vectors) are returned in A.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V.
  • 'S': The first min(m,n) rows of V (the singular vectors) are returned in V.
  • 'O': The first min(m,n) rows of V (the singular vectors) are returned in A.
  • 'N': No rows of V (no right singular vectors) are computed.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the dgesvd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [4/8]

void blaze::gesvd ( char  jobu,
char  jobv,
blas_int_t  m,
blas_int_t  n,
float *  A,
blas_int_t  lda,
float *  s,
float *  U,
blas_int_t  ldu,
float *  V,
blas_int_t  ldv,
float *  work,
blas_int_t  lwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('A', 'S', 'O' or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', 'O' or 'N').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
infoReturn code of the function call.
Returns
void

This function performs the singular value decomposition of a general m-by-n single precision column-major matrix based on the LAPACK sgesvd() function. Optionally, it computes the left and/or right singular vectors. The resulting decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U.
  • 'S': The first min(m,n) columns of U (the singular vectors) are returned in U.
  • 'O': The first min(m,n) columns of U (the singular vectors) are returned in A.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V.
  • 'S': The first min(m,n) rows of V (the singular vectors) are returned in V.
  • 'O': The first min(m,n) rows of V (the singular vectors) are returned in A.
  • 'N': No rows of V (no right singular vectors) are computed.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the sgesvd() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [5/8]

template<typename MT , bool SO, typename VT , bool TF>
void blaze::gesvd ( DenseMatrix< MT, SO > &  A,
DenseVector< VT, TF > &  s,
char  jobu,
char  jobv 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
jobuSpecifies the computation of the left singular vectors ('O' or 'N').
jobvSpecifies the computation of the right singular vectors ('O' or 'N').
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentInvalid jobu argument provided.
std::invalid_argumentInvalid jobv argument provided.
std::invalid_argumentInvalid combination of jobu and jobv provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesvd() functions. Optionally, it computes the left or right singular vectors.

The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobu specifies the computation of the left singular vectors:

  • 'O': The first min(m,n) columns of U (the left singular vectors) are returned in A; The dimensions of A are not adapted.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'O': The first min(m,n) rows of V (the right singular vectors) are returned in A; The dimensions of A are not adapted.
  • 'N': No rows of V (no right singular vectors) are computed.

Please note that jobu and jobv cannot both be 'O'.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given jobu argument is neither 'O' nor 'N';
  • ... the given jobv argument is neither 'O' nor 'N';
  • ... the given jobu and jobv arguments are both 'O';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvd( A, s, 'N', 'N' );
void gesvd(char jobu, char jobv, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesvd.h:179

For more information on the gesvd() functions (i.e. sgesvd(), dgesvd(), cgesvd(), and zgesvd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [6/8]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
void blaze::gesvd ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
char  jobu,
char  jobv 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
jobuSpecifies the computation of the left singular vectors ('A', 'S', or 'N').
jobvSpecifies the computation of the right singular vectors ('O' or 'N').
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobu argument provided.
std::invalid_argumentInvalid jobv argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesvd() functions. Optionally, it computes the left or right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U; U is either resized (if possible) or expected to be a m-by-m matrix.
  • 'S': The first min(m,n) columns of U (the left singular vectors) are returned in U; U is either resized (if possible) or expected to be a m-by-min(m,n) matrix.
  • 'N': No columns of U (no left singular vectors) are computed; U is not referenced.

The parameter jobv specifies the computation of the right singular vectors:

  • 'O': The first min(m,n) rows of V (the right singular vectors) are returned in A; The dimensions of A are not adapted.
  • 'N': No rows of V (no right singular vectors) are computed.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given jobu argument is neither 'A' nor 'S' nor 'N';
  • ... the given jobv argument is neither 'O' nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 8UL, 5UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 8UL, 8UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvd( A, U, s, 'A', 'O' );
DynamicMatrix<double,rowMajor> A( 8UL, 5UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 8UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvd( A, U, s, 'S', 'N' );

For more information on the gesvd() functions (i.e. sgesvd(), dgesvd(), cgesvd(), and zgesvd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [7/8]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
void blaze::gesvd ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
DenseMatrix< MT3, SO > &  V,
char  jobu,
char  jobv 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
jobuSpecifies the computation of the left singular vectors ('A', 'S', or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', or 'N').
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobu argument provided.
std::invalid_argumentInvalid jobv argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesvd() functions. Optionally, it computes the left or right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobu specifies the computation of the left singular vectors:

  • 'A': All m columns of U are returned in U; U is either resized (if possible) or expected to be a m-by-m matrix.
  • 'S': The first min(m,n) columns of U (the left singular vectors) are returned in U; U is either resized (if possible) or expected to be a m-by-min(m,n) matrix.
  • 'N': No columns of U (no left singular vectors) are computed; U is not referenced.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V; V is either resized (if possible) or expected to be a n-by-n matrix.
  • 'S': The first min(m,n) rows of V (the right singular vectors) are returned in V; V is either resized (if possible) or expected to be a min(m,n)-by-n matrix.
  • 'N': No rows of V (no right singular vectors) are computed; V is not referenced.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given jobu argument is neither 'A' nor 'S' nor 'N';
  • ... the given jobv argument is neither 'A' nor 'S' nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 8UL, 8UL ); // The matrix for the right singular vectors
gesvd( A, U, s, V, 'A', 'A' );
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvd( A, U, s, V, 'S', 'S' );

For more information on the gesvd() functions (i.e. sgesvd(), dgesvd(), cgesvd(), and zgesvd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvd() [8/8]

template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 >
void blaze::gesvd ( DenseMatrix< MT1, SO > &  A,
DenseVector< VT, TF > &  s,
DenseMatrix< MT2, SO > &  V,
char  jobu,
char  jobv 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
jobuSpecifies the computation of the left singular vectors ('O' or 'N').
jobvSpecifies the computation of the right singular vectors ('A', 'S', or 'N').
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid jobu argument provided.
std::invalid_argumentInvalid jobv argument provided.
std::runtime_errorSingular value decomposition failed.

This function performs the singular value decomposition of a general m-by-n matrix based on the LAPACK gesvd() functions. Optionally, it computes the left or right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A, the first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The resulting min(m,n) real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

The parameter jobu specifies the computation of the left singular vectors:

  • 'O': The first min(m,n) columns of U (the left singular vectors) are returned in A; The dimensions of A are not adapted.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'A': All m rows of V are returned in V; V is either resized (if possible) or expected to be a n-by-n matrix.
  • 'S': The first min(m,n) rows of V (the right singular vectors) are returned in V; V is either resized (if possible) or expected to be a min(m,n)-by-n matrix.
  • 'N': No rows of V (no right singular vectors) are computed; V is not referenced.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given jobu argument is neither 'O' nor 'N';
  • ... the given jobv argument is neither 'A' nor 'S' nor 'N';
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 8UL, 8UL ); // The matrix for the right singular vectors
gesvd( A, s, V, 'O', 'A' );
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvd( A, s, V, 'N', 'S' );

For more information on the gesvd() functions (i.e. sgesvd(), dgesvd(), cgesvd(), and zgesvd()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [1/12]

void blaze::gesvdx ( char  jobu,
char  jobv,
char  range,
blas_int_t  m,
blas_int_t  n,
complex< double > *  A,
blas_int_t  lda,
double  vl,
double  vu,
blas_int_t  il,
blas_int_t  iu,
blas_int_t ns,
double *  s,
complex< double > *  U,
blas_int_t  ldu,
complex< double > *  V,
blas_int_t  ldv,
complex< double > *  work,
blas_int_t  lwork,
double *  rwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision complex column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('V' or 'N').
jobvSpecifies the computation of the right singular vectors ('V' or 'N').
rangeSpecifies the range of singular values to find ('A', 'V', or 'I').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
vlThe lower bound of the interval to be searched for singular values (vl < vu).
vuThe upper bound of the interval to be searched for singular values (vl < vu).
ilThe index of the smallest singular value to be returned (0 <= il <= iu).
iuThe index of the largest singular value to be returned (0 <= il <= iu).
nsThe total number of singular values found (0 <= ns <= min(m,n)).
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; size >= min(m,n) * ( min(m,n)^2 + 15*min(m,n) ).
iworkAuxiliary array; size >= 12*min(m,n).
infoReturn code of the function call.
Returns
void

This function computes a specified number of singular values of a general m-by-n single precision complex column-major matrix based on the LAPACK zgesvdx() function. Optionally, it computes a specified number of left and right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'V': Either the first min(m, n) columns of U (the left singular vectors) or the number specified by range are computed.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'V': Either the first min(m, n) rows of V (the right singular vectors) or the number specified by range are computed.
  • 'N': No rows of V (no right singular vectors) are computed.

The parameter range specifies the amount of singular values/vectors to be found:

  • 'A': All singular values will be found.
  • 'V': All singular values in the half-open interval $(vl..vu]$ will be found.
  • 'I': The il-th through iu-th singular values will be found.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the zgesvdx() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [2/12]

void blaze::gesvdx ( char  jobu,
char  jobv,
char  range,
blas_int_t  m,
blas_int_t  n,
complex< float > *  A,
blas_int_t  lda,
float  vl,
float  vu,
blas_int_t  il,
blas_int_t  iu,
blas_int_t ns,
float *  s,
complex< float > *  U,
blas_int_t  ldu,
complex< float > *  V,
blas_int_t  ldv,
complex< float > *  work,
blas_int_t  lwork,
float *  rwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision complex column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('V' or 'N').
jobvSpecifies the computation of the right singular vectors ('V' or 'N').
rangeSpecifies the range of singular values to find ('A', 'V', or 'I').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
vlThe lower bound of the interval to be searched for singular values (vl < vu).
vuThe upper bound of the interval to be searched for singular values (vl < vu).
ilThe index of the smallest singular value to be returned (0 <= il <= iu).
iuThe index of the largest singular value to be returned (0 <= il <= iu).
nsThe total number of singular values found (0 <= ns <= min(m,n)).
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
rworkAuxiliary array; size >= min(m,n) * ( min(m,n)^2 + 15*min(m,n) ).
iworkAuxiliary array; size >= 12*min(m,n).
infoReturn code of the function call.
Returns
void

This function computes a specified number of singular values of a general m-by-n single precision complex column-major matrix based on the LAPACK cgesvdx() function. Optionally, it computes a specified number of left and right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'V': Either the first min(m, n) columns of U (the left singular vectors) or the number specified by range are computed.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'V': Either the first min(m, n) rows of V (the right singular vectors) or the number specified by range are computed.
  • 'N': No rows of V (no right singular vectors) are computed.

The parameter range specifies the amount of singular values/vectors to be found:

  • 'A': All singular values will be found.
  • 'V': All singular values in the half-open interval $(vl..vu]$ will be found.
  • 'I': The il-th through iu-th singular values will be found.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the cgesvdx() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [3/12]

void blaze::gesvdx ( char  jobu,
char  jobv,
char  range,
blas_int_t  m,
blas_int_t  n,
double *  A,
blas_int_t  lda,
double  vl,
double  vu,
blas_int_t  il,
blas_int_t  iu,
blas_int_t ns,
double *  s,
double *  U,
blas_int_t  ldu,
double *  V,
blas_int_t  ldv,
double *  work,
blas_int_t  lwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general double precision column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('V' or 'N').
jobvSpecifies the computation of the right singular vectors ('V' or 'N').
rangeSpecifies the range of singular values to find ('A', 'V', or 'I').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the double precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
vlThe lower bound of the interval to be searched for singular values (vl < vu).
vuThe upper bound of the interval to be searched for singular values (vl < vu).
ilThe index of the smallest singular value to be returned (0 <= il <= iu).
iuThe index of the largest singular value to be returned (0 <= il <= iu).
nsThe total number of singular values found (0 <= ns <= min(m,n)).
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
iworkAuxiliary array; size >= 12*min(m,n).
infoReturn code of the function call.
Returns
void

This function computes a specified number of singular values of a general m-by-n single precision complex column-major matrix based on the LAPACK dgesvdx() function. Optionally, it computes a specified number of left and right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'V': Either the first min(m, n) columns of U (the left singular vectors) or the number specified by range are computed.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'V': Either the first min(m, n) rows of V (the right singular vectors) or the number specified by range are computed.
  • 'N': No rows of V (no right singular vectors) are computed.

The parameter range specifies the amount of singular values/vectors to be found:

  • 'A': All singular values will be found.
  • 'V': All singular values in the half-open interval $(vl..vu]$ will be found.
  • 'I': The il-th through iu-th singular values will be found.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the dgesvdx() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [4/12]

void blaze::gesvdx ( char  jobu,
char  jobv,
char  range,
blas_int_t  m,
blas_int_t  n,
float *  A,
blas_int_t  lda,
float  vl,
float  vu,
blas_int_t  il,
blas_int_t  iu,
blas_int_t ns,
float *  s,
float *  U,
blas_int_t  ldu,
float *  V,
blas_int_t  ldv,
float *  work,
blas_int_t  lwork,
blas_int_t iwork,
blas_int_t info 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision column-major matrix.

Parameters
jobuSpecifies the computation of the left singular vectors ('V' or 'N').
jobvSpecifies the computation of the right singular vectors ('V' or 'N').
rangeSpecifies the range of singular values to find ('A', 'V', or 'I').
mThe number of rows of the given matrix $[0..\infty)$.
nThe number of columns of the given matrix $[0..\infty)$.
APointer to the first element of the single precision column-major matrix.
ldaThe total number of elements between two columns of the matrix A $[0..\infty)$.
vlThe lower bound of the interval to be searched for singular values (vl < vu).
vuThe upper bound of the interval to be searched for singular values (vl < vu).
ilThe index of the smallest singular value to be returned (0 <= il <= iu).
iuThe index of the largest singular value to be returned (0 <= il <= iu).
nsThe total number of singular values found (0 <= ns <= min(m,n)).
sPointer to the first element of the vector for the singular values.
UPointer to the first element of the column-major matrix for the left singular vectors.
lduThe total number of elements between two columns of the matrix U $[0..\infty)$.
VPointer to the first element of the column-major matrix for the right singular vectors.
ldvThe total number of elements between two columns of the matrix V $[0..\infty)$.
workAuxiliary array; size >= max( 1, lwork ).
lworkThe dimension of the array work; see online reference for details.
iworkAuxiliary array; size >= 12*min(m,n).
infoReturn code of the function call.
Returns
void

This function computes a specified number of singular values of a general m-by-n single precision complex column-major matrix based on the LAPACK sgesvdx() function. Optionally, it computes a specified number of left and right singular vectors. The complete decomposition has the form

                       \f[ A = U \cdot S \cdot V, \f]

where S is a m-by-n matrix, which is zero except for its min(m,n) diagonal elements, which are stored in s, U is an m-by-m orthogonal matrix, and V is a n-by-n orthogonal matrix. The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and rows of V are the left and right singular vectors of A.

The parameter jobu specifies the computation of the left singular vectors:

  • 'V': Either the first min(m, n) columns of U (the left singular vectors) or the number specified by range are computed.
  • 'N': No columns of U (no left singular vectors) are computed.

The parameter jobv specifies the computation of the right singular vectors:

  • 'V': Either the first min(m, n) rows of V (the right singular vectors) or the number specified by range are computed.
  • 'N': No rows of V (no right singular vectors) are computed.

The parameter range specifies the amount of singular values/vectors to be found:

  • 'A': All singular values will be found.
  • 'V': All singular values in the half-open interval $(vl..vu]$ will be found.
  • 'I': The il-th through iu-th singular values will be found.

The info argument provides feedback on the success of the function call:

  • = 0: The decomposition finished successfully.
  • < 0: If info = -i, the i-th argument had an illegal value.
  • > 0: If info = i, the decomposition has been completed, but i superdiagonals did not converge.

For more information on the sgesvdx() function, see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [5/12]

template<typename MT , bool SO, typename VT , bool TF>
size_t blaze::gesvdx ( DenseMatrix< MT, SO > &  A,
DenseVector< VT, TF > &  s 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::runtime_errorSingular value decomposition failed.

This function computes all min(m,n) singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The resulting real and non-negative singular values are returned in descending order in the vector s, which is resized to the correct size (if possible and necessary).

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvdx( A, s );
void gesvdx(char jobu, char jobv, char range, blas_int_t m, blas_int_t n, float *A, blas_int_t lda, float vl, float vu, blas_int_t il, blas_int_t iu, blas_int_t *ns, float *s, float *U, blas_int_t ldu, float *V, blas_int_t ldv, float *work, blas_int_t lwork, blas_int_t *iwork, blas_int_t *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesvdx.h:213

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [6/12]

template<typename MT , bool SO, typename VT , bool TF, typename ST >
size_t blaze::gesvdx ( DenseMatrix< MT, SO > &  A,
DenseVector< VT, TF > &  s,
ST  low,
ST  upp 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
lowThe lower bound of the interval to be searched for singular values.
uppThe upper bound of the interval to be searched for singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentInvalid value range provided.
std::invalid_argumentInvalid index range provided.
std::runtime_errorSingular value decomposition failed.

This function computes a specified number of singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The number of singular values to be computed is specified by the lower bound low and the upper bound upp, which either form an integral or a floating point range.

In case low and upp are of integral type, the function computes all singular values in the index range $[low..upp]$. The num resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a num-dimensional vector.

In case low and upp are of floating point type, the function computes all singular values in the half-open interval $(low..upp]$. The resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a min(m,n)-dimensional vector.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given scalar values don't form a proper range;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvdx( A, s, 1.0, 2.0 ); // Computes all eigenvalues in the interval (1..2]
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 3UL ); // The vector for the singular values
gesvdx( A, s, 0, 2 ); // Computes the first three eigenvalues

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [7/12]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF>
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::runtime_errorSingular value decomposition failed.

This function computes all min(m,n) singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The resulting real and non-negative singular values are stored in descending order in the given vector s, the resulting left singular vectors are stored in the given matrix U. Both s and U are resized to the correct dimensions (if possible and necessary).

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvdx( A, U, s );

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [8/12]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 >
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
DenseMatrix< MT3, SO > &  V 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::runtime_errorSingular value decomposition failed.

This function computes all min(m,n) singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The resulting real and non-negative singular values are stored in descending order in the given vector s, the resulting left singular vectors are stored in the given matrix U, and the resulting right singular vectors are stred in the given matrix V. s, U, and V are resized to the correct dimensions (if possible and necessary).

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, U, s, V );

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [9/12]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename MT3 , typename ST >
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
DenseMatrix< MT3, SO > &  V,
ST  low,
ST  upp 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
lowThe lower bound of the interval to be searched for singular values.
uppThe upper bound of the interval to be searched for singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid value range provided.
std::invalid_argumentInvalid index range provided.
std::runtime_errorSingular value decomposition failed.

This function computes a specified number of singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The number of singular values to be computed is specified by the lower bound low and the upper bound upp, which either form an integral or a floating point range.

In case low and upp form are of integral type, the function computes all singular values in the index range $[low..upp]$. The num resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a num-dimensional vector. The resulting left singular vectors are stored in the given matrix U, which is either resized (if possible) or expected to be a m-by-num matrix. The resulting right singular vectors are stored in the given matrix V, which is either resized (if possible) or expected to be a num-by-n matrix.

In case low and upp are of floating point type, the function computes all singular values in the half-open interval $(low..upp]$. The resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a min(m,n)-dimensional vector. The resulting left singular vectors are stored in the given matrix U, which is either resized (if possible) or expected to be a m-by-min(m,n) matrix. The resulting right singular vectors are stored in the given matrix V, which is either resized (if possible) or expected to be a min(m,n)-by-n matrix.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given scalar values don't form a proper range;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, U, s, V, 1.0, 2.0 ); // Computes all eigenvalues in the interval (1..2]
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 3UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 3UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 3UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, U, s, V, 0, 2 ); // Computes the first three eigenvalues

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [10/12]

template<typename MT1 , bool SO, typename MT2 , typename VT , bool TF, typename ST >
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseMatrix< MT2, SO > &  U,
DenseVector< VT, TF > &  s,
ST  low,
ST  upp 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
UThe resulting matrix of left singular vectors.
sThe resulting vector of singular values.
lowThe lower bound of the interval to be searched for singular values.
uppThe upper bound of the interval to be searched for singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid value range provided.
std::invalid_argumentInvalid index range provided.
std::runtime_errorSingular value decomposition failed.

This function computes a specified number of singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The number of singular values to be computed is specified by the lower bound low and the upper bound upp, which either form an integral or a floating point range.

In case low and upp are of integral type, the function computes all singular values in the index range $[low..upp]$. The num resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a num-dimensional vector. The resulting left singular vectors are stored in the given matrix U, which is either resized (if possible) or expected to be a m-by-num matrix.

In case low and upp are of floating point type, the function computes all singular values in the half-open interval $(low..upp]$. The resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a min(m,n)-dimensional vector. The resulting left singular vectors are stored in the given matrix U, which is either resized (if possible) or expected to be a m-by-min(m,n) matrix.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given matrix U is a fixed size matrix and the dimensions don't match;
  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given scalar values don't form a proper range;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 5UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
gesvdx( A, U, s, 1.0, 2.0 ); // Computes all eigenvalues in the interval (1..2]
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicMatrix<double,rowMajor> U( 5UL, 3UL ); // The matrix for the left singular vectors
DynamicVector<double,columnVector> s( 3UL ); // The vector for the singular values
gesvdx( A, U, s, 0, 2 ); // Computes the first three eigenvalues

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [11/12]

template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 >
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseVector< VT, TF > &  s,
DenseMatrix< MT2, SO > &  V 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::runtime_errorSingular value decomposition failed.

This function computes all min(m,n) singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The resulting real and non-negative singular values are stored in descending order in the given vector s. The resulting right singular vectors are stored in the given min(m,n)-by-n matrix V. Both s and V are resized to the correct dimensions (if possible and necessary).

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, s, V );

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.

◆ gesvdx() [12/12]

template<typename MT1 , bool SO, typename VT , bool TF, typename MT2 , typename ST >
size_t blaze::gesvdx ( DenseMatrix< MT1, SO > &  A,
DenseVector< VT, TF > &  s,
DenseMatrix< MT2, SO > &  V,
ST  low,
ST  upp 
)
inline

LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.

Parameters
AThe given general matrix.
sThe resulting vector of singular values.
VThe resulting matrix of right singular vectors.
lowThe lower bound of the interval to be searched for singular values.
uppThe upper bound of the interval to be searched for singular values.
Returns
The total number of singular values found.
Exceptions
std::invalid_argumentVector cannot be resized.
std::invalid_argumentMatrix cannot be resized.
std::invalid_argumentInvalid value range provided.
std::invalid_argumentInvalid index range provided.
std::runtime_errorSingular value decomposition failed.

This function computes a specified number of singular values of the given general m-by-n matrix A by means of the LAPACK gesvdx() functions. The number of singular values to be computed is specified by the lower bound low and the upper bound upp, which either form an integral or a floating point range.

In case low and upp are of integral type, the function computes all singular values in the index range $[low..upp]$. The num resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a num-dimensional vector. The resulting right singular vectors are stored in the given matrix V, which is either resized (if possible) or expected to be a num-by-n matrix.

In case low and upp are of floating point type, the function computes all singular values in the half-open interval $(low..upp]$. The resulting real and non-negative singular values are stored in descending order in the given vector s, which is either resized (if possible) or expected to be a min(m,n)-dimensional vector. The resulting right singular vectors are stored in the given matrix V, which is either resized (if possible) or expected to be a min(m,n)-by-n matrix.

Note that this function can only be used for general, non-adapted matrices with float, double, complex<float>, or complex<double> element type. The attempt to call the function with any adapted matrix or matrices of any other element type results in a compile time error!

The function fails if ...

  • ... the given vector s is a fixed size vector and the size doesn't match;
  • ... the given matrix V is a fixed size matrix and the dimensions don't match;
  • ... the given scalar values don't form a proper range;
  • ... the singular value decomposition fails.

In all failure cases an exception is thrown.

Examples:

DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 5UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 5UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, s, V, 1.0, 2.0 ); // Computes all eigenvalues in the interval (1..2]
DynamicMatrix<double,rowMajor> A( 5UL, 8UL ); // The general matrix A
// ... Initialization
DynamicVector<double,columnVector> s( 3UL ); // The vector for the singular values
DynamicMatrix<double,rowMajor> V( 3UL, 8UL ); // The matrix for the right singular vectors
gesvdx( A, s, V, 0, 2 ); // Computes the first three eigenvalues

For more information on the gesvdx() functions (i.e. sgesvdx(), dgesvdx(), cgesvdx(), and zgesvdx()) see the LAPACK online documentation browser:

http://www.netlib.org/lapack/explore-html/

Note
This function can only be used if a fitting LAPACK library, which supports this function, is available and linked to the executable. Otherwise a call to this function will result in a linker error.