Public Member Functions | Public Attributes | Private Attributes
PseudoInverse Class Reference

handles (weighted) pseudo-inverses and related operations. More...

#include <pinv.hpp>

List of all members.

Public Member Functions

double derivsv (const double *Adot, int strideAdot, int svnr)
void inverse (const double *y, double *x, double eps)
void inverseWithNullSpace (const double *y, double *x, const double *xd, double eps)
int prepare (const double *_A, int _strideA, int _m, int _n, const double *_Ly, const double *_Lx, int nrOfIts)
 prepares for solving Ax=y by calculating the singular value decomposition.
 PseudoInverse (int _maxsize)
int smallestSV (double eps)
 Smallest eigenvalue larger then eps.
 ~PseudoInverse ()

Public Attributes

const double * A
const double * Lx
const double * Ly
int m
int n
int * ndx
bool prepared
 the prepare method() has been called
double * S
int strideA
int strideU
 the stride for U.
int strideV
 the stride for V
double * U
 left orthonormal matrix when prepare() is called, U contains the left orthonormal matrix of the singular value decomposition.
double * V
 right orthonormal matrix when prepare is called, V contains the right orthonormal matrix of the singular value decomposition.

Private Attributes

int maxsize
double * tmp
double * y2

Detailed Description

handles (weighted) pseudo-inverses and related operations.

Definition at line 49 of file pinv.hpp.


Constructor & Destructor Documentation

PseudoInverse::PseudoInverse ( int  _maxsize)

Allocate temporary space for calculating the pseudo-inverse of a matrix with maxrows rows or less , and maxcols collumns or less. maxrows > maxcols, because if nrofrows < nrofcols, extra rows have to be added to the matrix.

Definition at line 304 of file pinv.cpp.

Definition at line 318 of file pinv.cpp.


Member Function Documentation

double PseudoInverse::derivsv ( const double *  Adot,
int  strideAdot,
int  svnr 
)

function to calculate :

\[ \frac{\partial \tilde{\sigma}_r }{\partial x_i} = u^T_r L_y \frac{\partial A }{\partial x_i} L^{-1}_x v_r \]

Parameters:
[in]Adotthe derivative (towards some variable) of the A matrix
[in]strideAdot
[in]svnrindicates for which singular value the derivative is taken.
Warning:
prepare() should have been called

Definition at line 460 of file pinv.cpp.

void PseudoInverse::inverse ( const double *  y,
double *  x,
double  eps 
)
  • solves an equation with the weighted pseudo-inverse
  • given : A.x = y
  • Calculates x = A# y for the prepared matrix and weights.
    Warning:
    first call prepare()
    Parameters:
    [in]yright hand side of the equations
    [out]x
    [in]epstollerance for determining the nullspace. This is lowest value a singular value may have without entering the nullspace.
    Warning:
    uses the U, V, S members
    changes the tmp member

Definition at line 327 of file pinv.cpp.

void PseudoInverse::inverseWithNullSpace ( const double *  y,
double *  x,
const double *  xd,
double  eps 
)
  • given : y = A.x
  • Calculates x = A# y + (I-A# A) xd with A the weighted inverse
  • A is specified with the prepare() method.
  • Method : uses x = A# ( y -A.xd) + xd and calculates this via S.V.D.
    Parameters:
    [in]y
    [out]x
    [in]xd
    [in]epstollerance for determining the nullspace. This is lowest value a singular value may have without entering the nullspace.
    Warning:
    prepare() has to be called first.
    uses inverse method;
    changes y2 members;

Definition at line 356 of file pinv.cpp.

int PseudoInverse::prepare ( const double *  _A,
int  _strideA,
int  _m,
int  _n,
const double *  _Ly,
const double *  _Lx,
int  nrOfIts 
)

prepares for solving Ax=y by calculating the singular value decomposition.

  • prepare calculations for solving equations A.x = y.
    Parameters:
    [in]A
    [in]strideA: stride of A, i.e. the amount of elements in the array between each row of A
    [in]mnumber of rows of A.
    [in]nnumber of columns of A.
    [in]Lyvector describing the square root of the diagonal weight matrix in y-space, has m elements.
    [in]Lxvector describing the square root of the diagonal weight matrix in x-space, has n elements.
    [in]nrOfItsmaximal number of iterations while calculating the singular value decomposition of A.
    Returns:
    0 if successfull.
    Warning:
    a REFERENCE to _A,_Lx,_Ly is kept. So do not change these variables as long as you want to perform additional operations.
  • prepare calculations for solving equations A.x = y.
    Parameters:
    [in]A
    [in]strideA: stride of A, i.e. the amount of elements in the array between each row of A
    [in]mnumber of rows of A.
    [in]nnumber of columns of A.
    [in]Lxvector describing the square root of the diagonal weight matrix in x-space, has n elements.
    [in]Lyvector describing the square root of the diagonal weight matrix in y-space, has m elements.
    Returns:
    0 if successfull.
    Warning:
    changes the U, V, S, tmp members

Definition at line 409 of file pinv.cpp.

int PseudoInverse::smallestSV ( double  eps)

Smallest eigenvalue larger then eps.

Parameters:
eps: tollerance level, singular values smaller than eps are considered to be zero.
Returns:
the index into S of the smallest eigenvalue larger then eps.

Definition at line 451 of file pinv.cpp.


Member Data Documentation

const double* PseudoInverse::A

a reference to the matrix of which you take the pseudo-inverse

Definition at line 58 of file pinv.hpp.

const double* PseudoInverse::Lx

weights in x-space

Definition at line 68 of file pinv.hpp.

const double* PseudoInverse::Ly

weights in y-space

Definition at line 73 of file pinv.hpp.

nr of rows

Definition at line 78 of file pinv.hpp.

int PseudoInverse::maxsize [private]

Definition at line 50 of file pinv.hpp.

nr of columns

Definition at line 83 of file pinv.hpp.

index to determine the sorted singular values : i = ndx[j], where j==1 corresponds to the largest, and j==n corresponds to the smallest singular value and where i corresponds to the index in S.

Definition at line 118 of file pinv.hpp.

the prepare method() has been called

Definition at line 88 of file pinv.hpp.

array containing the diagonal elements of $ \Sigma $

Definition at line 112 of file pinv.hpp.

stride A

Definition at line 63 of file pinv.hpp.

the stride for U.

Definition at line 98 of file pinv.hpp.

the stride for V

Definition at line 108 of file pinv.hpp.

double* PseudoInverse::tmp [private]

Definition at line 51 of file pinv.hpp.

left orthonormal matrix when prepare() is called, U contains the left orthonormal matrix of the singular value decomposition.

Definition at line 94 of file pinv.hpp.

right orthonormal matrix when prepare is called, V contains the right orthonormal matrix of the singular value decomposition.

Definition at line 104 of file pinv.hpp.

double* PseudoInverse::y2 [private]

Definition at line 52 of file pinv.hpp.


The documentation for this class was generated from the following files:


orocos_kdl
Author(s): Ruben Smits, Erwin Aertbelien, Orocos Developers
autogenerated on Sat Dec 28 2013 17:17:26