34 #include <visp3/core/vpConfig.h>
35 #include <visp3/core/vpMatrix.h>
37 #if defined(VISP_HAVE_SIMDLIB)
38 #include <Simd/SimdLib.h>
41 #ifdef VISP_HAVE_LAPACK
43 #include <gsl/gsl_eigen.h>
44 #include <gsl/gsl_linalg.h>
45 #include <gsl/gsl_math.h>
46 #elif defined(VISP_HAVE_MKL)
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
56 unsigned int ncols,
double svThreshold,
vpMatrix &Ap,
int &rank_out,
int *rank_in,
59 Ap.
resize(ncols, nrows,
true,
false);
66 unsigned int sv_size = sv.
size();
67 for (
unsigned int i = 0; i < sv_size; ++i) {
68 if (sv[i] >(maxsv * svThreshold)) {
73 unsigned int rank =
static_cast<unsigned int>(rank_out);
75 rank =
static_cast<unsigned int>(*rank_in);
78 for (
unsigned int i = 0; i < ncols; ++i) {
79 for (
unsigned int j = 0; j < nrows; ++j) {
80 for (
unsigned int k = 0; k < rank; ++k) {
81 Ap[i][j] += (V[i][k] * U[j][k]) / sv[k];
90 for (
unsigned int i = 0; i < nrows; ++i) {
91 for (
unsigned int j = 0; j < rank; ++j) {
92 (*imA)[i][j] = U[i][j];
100 for (
unsigned int i = 0; i < ncols; ++i) {
101 for (
unsigned int j = 0; j < rank; ++j) {
102 (*imAt)[i][j] = V[i][j];
109 kerAt->
resize(ncols - rank, ncols);
111 unsigned int v_rows = V.
getRows();
112 for (
unsigned int k = 0; k < (ncols - rank); ++k) {
113 unsigned j = k + rank;
114 for (
unsigned int i = 0; i < v_rows; ++i) {
115 (*kerAt)[k][i] = V[i][j];
184 #if defined(VISP_HAVE_LAPACK)
186 #elif defined(VISP_HAVE_EIGEN3)
188 #elif defined(VISP_HAVE_OPENCV)
194 "Install Lapack, Eigen3 or OpenCV 3rd party"));
264 #if defined(VISP_HAVE_LAPACK)
266 #elif defined(VISP_HAVE_EIGEN3)
268 #elif defined(VISP_HAVE_OPENCV)
274 "Install Lapack, Eigen3 or OpenCV 3rd party"));
334 #if defined(VISP_HAVE_LAPACK)
336 #elif defined(VISP_HAVE_EIGEN3)
338 #elif defined(VISP_HAVE_OPENCV)
343 "Install Lapack, Eigen3 or OpenCV 3rd party"));
403 #if defined(VISP_HAVE_LAPACK)
405 #elif defined(VISP_HAVE_EIGEN3)
407 #elif defined(VISP_HAVE_OPENCV)
412 "Install Lapack, Eigen3 or OpenCV 3rd party"));
483 #if defined(VISP_HAVE_LAPACK)
485 #elif defined(VISP_HAVE_EIGEN3)
487 #elif defined(VISP_HAVE_OPENCV)
494 "Install Lapack, Eigen3 or OpenCV 3rd party"));
570 #if defined(VISP_HAVE_LAPACK)
572 #elif defined(VISP_HAVE_EIGEN3)
574 #elif defined(VISP_HAVE_OPENCV)
581 "Install Lapack, Eigen3 or OpenCV 3rd party"));
864 #if defined(VISP_HAVE_LAPACK)
866 #elif defined(VISP_HAVE_EIGEN3)
868 #elif defined(VISP_HAVE_OPENCV)
878 "Install Lapack, Eigen3 or OpenCV 3rd party"));
995 #if defined(VISP_HAVE_LAPACK)
997 #elif defined(VISP_HAVE_EIGEN3)
999 #elif defined(VISP_HAVE_OPENCV)
1009 "Install Lapack, Eigen3 or OpenCV 3rd party"));
1033 double lambda = ratioOfMaxSvd * maxSingularValue;
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getRows() const
unsigned int colNum
Number of columns in the array.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Implementation of a matrix and operations on matrices.
vpMatrix pseudoInverseOpenCV(double svThreshold=1e-6) const
vpMatrix pseudoInverseEigen3(double svThreshold=1e-6) const
vpMatrix dampedInverse(const double &ratioOfMaxSvd=1e-4) const
vpMatrix inverseByLU() const
void svd(vpColVector &w, vpMatrix &V)
vpMatrix pseudoInverseLapack(double svThreshold=1e-6) const
vpMatrix pseudoInverse(double svThreshold=1e-6) const
vpMatrix transpose() const