34#include <visp3/core/vpConfig.h>
36#include "private/vpMatrix_pseudo_inverse.h"
38#ifdef VISP_HAVE_LAPACK
40#include <gsl/gsl_eigen.h>
41#include <gsl/gsl_linalg.h>
42#include <gsl/gsl_math.h>
43#elif defined(VISP_HAVE_MKL)
50#ifndef DOXYGEN_SHOULD_SKIP_THIS
52#if defined(VISP_HAVE_LAPACK)
105 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out,
nullptr,
nullptr,
nullptr,
nullptr);
156 unsigned int nrows =
getRows();
157 unsigned int ncols =
getCols();
166 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out,
nullptr,
nullptr,
nullptr,
nullptr);
168 return static_cast<unsigned int>(rank_out);
224 unsigned int nrows =
getRows();
225 unsigned int ncols =
getCols();
230 Ap.
resize(ncols, nrows,
false,
false);
235 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out,
nullptr,
nullptr,
nullptr,
nullptr);
237 return static_cast<unsigned int>(rank_out);
353 unsigned int nrows =
getRows();
354 unsigned int ncols =
getCols();
359 U.
resize(ncols, ncols,
true);
368 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out,
nullptr, &imA, &imAt, &kerAt);
370 return static_cast<unsigned int>(rank_out);
415 unsigned int nrows =
getRows();
416 unsigned int ncols =
getCols();
418 double svThreshold = 1
e-26;
426 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out, &rank_in,
nullptr,
nullptr,
nullptr);
483 unsigned int nrows =
getRows();
484 unsigned int ncols =
getCols();
486 double svThreshold = 1
e-26;
494 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out, &rank_in,
nullptr,
nullptr,
nullptr);
558 unsigned int nrows =
getRows();
559 unsigned int ncols =
getCols();
561 double svThreshold = 1
e-26;
564 Ap.
resize(ncols, nrows,
false,
false);
569 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out, &rank_in,
nullptr,
nullptr,
nullptr);
692 unsigned int nrows =
getRows();
693 unsigned int ncols =
getCols();
695 double svThreshold = 1
e-26;
699 U.
resize(ncols, ncols,
true);
708 compute_pseudo_inverse(U, sv, V, nrows, ncols, svThreshold, Ap, rank_out, &rank_in, &imA, &imAt, &kerAt);
unsigned int getCols() const
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int getRows() const
Implementation of column vector and the associated operations.
Implementation of a matrix and operations on matrices.
void svdLapack(vpColVector &w, vpMatrix &V)
vpMatrix pseudoInverseLapack(double svThreshold=1e-6) const
void insert(const vpMatrix &A, unsigned int r, unsigned int c)