#include <math.h>
#include <assert.h>
#include <kdl/pinv.hpp>
#include <iostream>
#include <algorithm>
Go to the source code of this file.
Classes |
class | SVD_Ordering |
Functions |
double | PYTHAG (double a, double b) |
double | SIGN (double a, double b) |
int | svdcmp (double *a, int stridea, int m, int n, double *w, double *v, int stridev, int NrIts, double *vec) |
Function Documentation
double PYTHAG |
( |
double |
a, |
|
|
double |
b |
|
) |
| [inline] |
double SIGN |
( |
double |
a, |
|
|
double |
b |
|
) |
| [inline] |
int svdcmp |
( |
double * |
a, |
|
|
int |
stridea, |
|
|
int |
m, |
|
|
int |
n, |
|
|
double * |
w, |
|
|
double * |
v, |
|
|
int |
stridev, |
|
|
int |
NrIts, |
|
|
double * |
vec |
|
) |
| |
- this routine computes its singular value decomposition, a = u*w*v'
- the dimensions of a are m*n, m >= n, otherwise fill a up to square with zero rows in that case take only the mxm part of the v matrix. and the mxm of w
- The singular values are not ordered in descending order!! So, also the columns of U and V are not ordered!!
- The algorithm does not calculate a full m xm matrix U! only an mxn one ! ARGUMENTS : a,stridea,int m,int n : description of matrix a[1..m][1..n], input: matrix a output: matrix u w : w[1..n] output : singular values (not sorted) v,stridev : description of matrix v[1..n][1..n] output : the matrix v NrIts : max nr of iterations vec : temporary storage with max dimension of a ( ie m)
RETURNS: 0 if no errors occured during computations; 1 if `m' < `n'; 2 if maximum number of iterations is exceeded.
Based on the book NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) http://www.library.cornell.edu/nr/bookcpdf.html
Definition at line 83 of file pinv.cpp.