45 #include <visp/vpConfig.h>
46 #include <visp/vpMatrix.h>
47 #include <visp/vpColVector.h>
48 #include <visp/vpMatrixException.h>
64 double denom = ((double)(A.
getRows()));
66 if(denom <= std::numeric_limits<double>::epsilon())
70 double sigma2 = (b - (A * x)).t() * (b - (A * x));
93 for(
unsigned int i = 0 ; i < W.
getCols() ; i++){
95 W2[i][i] = W[i][i]*W[i][i];
98 if(denom <= std::numeric_limits<double>::epsilon())
102 double sigma2 = (W * b - (W * A * x)).t() * (W*b - (W * A * x));
105 return (A.
t()*(W2)*A).pseudoInverse(A.
getCols()*std::numeric_limits<double>::epsilon())*sigma2;
Definition of the vpMatrix class.
static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
unsigned int getCols() const
Return the number of columns of the matrix.
error that can be emited by the vpMatrix class and its derivates
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
unsigned int getRows() const
Return the number of rows of the matrix.