@@ -79,10 +79,10 @@ static void svd_lapack( const char jobz, const int M, const int N,
if(info!=0)
throwstd::runtime_error("The LAPACK dgesdd function returned a non-zero value. You may consider using LAPACK dgsevd instead (see #171) by enabling the 'safe' option.");
}
// Defining the sign of the eigenvectors
// Approch extracted from page 8 - http://prod.sandia.gov/techlib/access-control.cgi/2007/076422.pdf
if(U[0]<0){
// Approch extracted from page 8 - http://prod.sandia.gov/techlib/access-control.cgi/2007/076422.pdf
if(U[0]<0){
intucol=0;ucol=(jobz=='A')?M:std::min(M,N);
for(inti=0;i<ldu*ucol;i++){
U[i]=-1*U[i];
...
...
@@ -114,17 +114,6 @@ void bob::math::svd(const blitz::Array<double,2>& A, blitz::Array<double,2>& U,
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`scatter`."
"Use it when you are sure your input matrices sizes match.\n\n"
"Computes the scatter matrix of a 2D array *considering data is organized row-wise* (each sample is a row, each feature is a column). "
"The resulting array ``s`` is squared with extents equal to the number of columns in ``a``. "
"The resulting array ``m`` is a 1D array with the row means of ``a``. "
"This function supports many calling modes, but you should provide, at least, the input data matrix ``a``. "
"All non-provided arguments will be allocated internally and returned."
)
.add_prototype("a, s, m")
.add_parameter("a","array_like (float, 2D)","The sample matrix, *considering data is organized row-wise* (each sample is a row, each feature is a column)")
.add_parameter("s","array_like (float, 2D)","The scatter matrix, squared with extents equal to the number of columns in ``a``")
.add_parameter("m","array_like (float,1D)","The mean matrix, with with the row means of ``a``")
.add_return("m","array_like (float, 1D)","The mean matrix, representing the ensemble mean with no prior (i.e., biased towards classes with more samples)")
"Computes :math:`S_w` and :math:`S_b` scatter matrices of a set of 2D arrays.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`scatters`. "
"Use it when you are sure your input matrices sizes match.\n\n"
"For a detailed description of the function, please see :func:`scatters`."
)
.add_prototype("data, sw, sb, m")
.add_prototype("data, sw, sb")
.add_parameter("data","[array_like (float, 2D)]","The list of sample matrices. "
"In each sample matrix the data is organized row-wise (each sample is a row, each feature is a column). "
"Each matrix stores the data of a particular class. "
"**Every matrix in ``data`` must have exactly the same number of columns.**")
.add_parameter("sw","array_like (float, 2D)","The within-class scatter matrix :math:`S_w`, squared with extents equal to the number of columns in ``data``")
.add_parameter("sb","array_like (float, 2D)","The between-class scatter matrix :math:`S_b`, squared with extents equal to the number of columns in ``data``")
.add_parameter("m","array_like (float,1D)","The mean matrix, representing the ensemble mean with no prior (i.e., biased towards classes with more samples)")