32 #include <MathAlgo/SVD.hh>
33 #include <Base/Math/Random.hh>
34 #include <Base/Debug/TimeMeasure.hh>
35 #include <MathAlgo/Lapack.hh>
45 unsigned int matdim = 10;
49 for (
unsigned int i=0; i<matdim; i++) {
50 for (
unsigned int j=0; j<matdim; j++) {
56 Cov = factor.Transpose()*factor;
58 cout<<
"Cov is "<< Cov<<endl;
63 double svddist=0,lapackdist=0;
65 for (
unsigned int i=0; i<1000; i++) {
76 cerr <<
"user: "<<(double)tsvd.
GetUserTime() <<
" ms";
77 cerr <<
"real: "<<(double)tsvd.
GetRealTime() <<
" us";
80 cerr <<
"user: "<<(double)tsvd3.
GetUserTime() <<
" ms";
81 cerr <<
"real: "<<(double)tsvd3.
GetRealTime() <<
" us"<<endl;
83 cout<<
"distances are "<<svddist<<
" "<<lapackdist <<endl;
void Print(std::ostream &os=std::cout) const
computes and holds the singular value decomposition of a rectangular (not necessarily quadratic) Matr...
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
double GetRealTime() const
return real time (=wall time clock) in usec JW For Win32: real-time is measured differently from user...
Matrix< double > Invert()
returns pseudoinverse of A = U * S * V^T A^+ = V * S^+ * U^T
double MahalanobisDistance(const BIAS::Matrix< double > &Sigma, const BIAS::Vector< double > &V)
computes squared Mahalanobis distance V^T Sigma^-1 V efficiently using cholesky decomposition and exp...
double GetUserTime() const
return user time (=system usage time) in msec JW For Win32: user-time is the sum over all processes o...
class for producing random numbers from different distributions
class TimeMeasure contains functions for timing real time and cpu time.