Changeset 89 for foam/trunk/vision/src/SVD.cpp
 Timestamp:
 06/03/2009 10:01:22 AM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

foam/trunk/vision/src/SVD.cpp
r86 r89 57 57 #include <stdlib.h> 58 58 #include <math.h> 59 #include <algorithm> 60 #include <list> 59 61 #include "SVD.h" 62 63 using namespace std; 60 64 61 65 #define SIGN(a, b) ((b) >= 0.0 ? fabs(a) : fabs(a)) 62 66 #define MAX(x,y) ((x)>(y)?(x):(y)) 63 67 64 static double PYTHAG(double a, double b) 65 { 66 double at = fabs(a), bt = fabs(b), ct, result; 67 68 if (at > bt) { ct = bt / at; result = at * sqrt(1.0 + ct * ct); } 69 else if (bt > 0.0) { ct = at / bt; result = bt * sqrt(1.0 + ct * ct); } 70 else result = 0.0; 71 return(result); 72 } 68 /////////////////////////////////////////////////////// 73 69 74 70 Vector<float> SVD(Matrix<float> &m) … … 77 73 Matrix<float> v(m.GetRows(),m.GetCols()); 78 74 dsvd(m, m.GetRows(), m.GetCols(), w.GetRawData(), v); 75 m.SortCols(w); 79 76 return w; 77 } 78 79 /////////////////////////////////////////////////////// 80 81 static double PYTHAG(double a, double b) 82 { 83 double at = fabs(a), bt = fabs(b), ct, result; 84 85 if (at > bt) { ct = bt / at; result = at * sqrt(1.0 + ct * ct); } 86 else if (bt > 0.0) { ct = at / bt; result = bt * sqrt(1.0 + ct * ct); } 87 else result = 0.0; 88 return(result); 80 89 } 81 90
Note: See TracChangeset
for help on using the changeset viewer.