|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
37 Eigen::JacobiSVD< Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor> > svd(
toEigen(in), Eigen::ComputeThinU | Eigen::ComputeThinV);
39 U.
resize(svd.matrixU().rows(),svd.matrixU().cols());
42 S.
resize(svd.singularValues().size());
43 toEigen(S) = svd.singularValues();
45 V.
resize(svd.matrixV().rows(),svd.matrixV().cols());
51 int m = in.
rows(), n = in.
cols(), k = m<n?m:n;
58 for (
int c=0;c<k; c++)
60 Spinv(c,c) = 1/Sdiag(c);
66 int m = in.
rows(), n = in.
cols(), k = m<n?m:n;
73 for (
int c=0;c<k; c++)
75 Spinv(c,c) = 1/Sdiag(c);
81 int m = in.
rows(), n = in.
cols(), k = m<n?m:n;
89 for (
int c=0;c<k; c++)
98 int m = in.
rows(), n = in.
cols(), k = m<n?m:n;
100 if((
int)sv.
size()!=k)
106 for (
int c=0;c<k; c++)
108 Spinv(c,c) = 1/sv(c);
138 int m = in.
rows(), n = in.
cols(), k = m<n?m:n;
140 if((
int)sv.
size()!=k)
146 double damp2 = damp*damp;
147 for (
int c=0;c<k; c++)
148 Spinv(c,c) = sv(c) / (sv(c)*sv(c) + damp2);
164 int k = std::min(m, n);
170 for(
int c = 0; c < k; c++) {
171 if(Sdiag(c) <= tol) {
189 int k = std::min(m, n);
195 for (
int c = 0; c < k; c++) {
196 if (Sdiag(c) <= tol) {
void resize(size_t size) override
Resize the vector.
yarp::sig::Vector zeros(int s)
Creates a vector of zeros (defined in Math.h).
yarp::sig::Matrix pinvDamped(const yarp::sig::Matrix &in, yarp::sig::Vector &sv, double damp)
Perform the damped pseudo-inverse of a matrix (defined in SVD.h).
Matrix transposed() const
Return the transposed of the matrix.
size_t rows() const
Return number of rows.
yarp::sig::Matrix eye(int r, int c)
Build an identity matrix (defined in Math.h).
void SVDJacobi(const yarp::sig::Matrix &in, yarp::sig::Matrix &U, yarp::sig::Vector &S, yarp::sig::Matrix &V)
Perform SVD decomposition on a matrix using the Jacobi method (defined in SVD.h).
yarp::sig::Matrix pinv(const yarp::sig::Matrix &in, double tol=0.0)
Perform the moore-penrose pseudo-inverse of a matrix (defined in SVD.h).
void SVD(const yarp::sig::Matrix &in, yarp::sig::Matrix &U, yarp::sig::Vector &S, yarp::sig::Matrix &V)
Factorize the M-by-N matrix 'in' into the singular value decomposition in = U S V^T (defined in SVD....
void SVDMod(const yarp::sig::Matrix &in, yarp::sig::Matrix &U, yarp::sig::Vector &S, yarp::sig::Matrix &V)
Perform SVD decomposition on a MxN matrix (for M >= N) (defined in SVD.h).
size_t cols() const
Return number of columns.
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
bool setRow(size_t row, const Vector &r)
Set a row of the matrix copying the values from a vector: the vector length must be equal to the numb...
Eigen::Map< Eigen::VectorXd > toEigen(yarp::sig::Vector &yarpVector)
Convert a yarp::sig::Vector to a Eigen::Map<Eigen::VectorXd> object.
yarp::sig::Matrix nullspaceProjection(const yarp::sig::Matrix &A, double tol=0.0)
Compute the nullspace projection matrix of A, that is defined as the difference between the identity ...
yarp::sig::Matrix projectionMatrix(const yarp::sig::Matrix &A, double tol=0.0)
Compute the projection matrix of A, that is defined as A times its pseudoinverse: A*pinv(A) (defined ...