Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Svd.hh

Go to the documentation of this file.
00001 #ifndef SVD_CLASS
00002 #define SVD_CLASS
00003 
00004 // ==== HEADER Svd.hh ====
00005 
00012 // 14-Nov-2001. Andras Aszodi
00013 
00014 // ---- STANDARD HEADERS ----
00015 
00016 #include <stdlib.h>
00017 #include <math.h>
00018 
00019 #ifdef _STANDARD_C_PLUS_PLUS
00020 #include <iostream>
00021 using namespace std;
00022 #else
00023 #include <iostream.h>
00024 #endif
00025 
00026 // ---- INCLUDE FILES ----
00027 
00028 #include "Basemat.hh"
00029 #include "Rectmat.hh"
00030 #include "Vector.hh"
00031 #include "Safety.hh"
00032 #include "Rangedimexc.hh"
00033 
00034 // ==== CLASSES ====
00035 
00036 namespace RazorBack {
00037 
00046 class Svd_
00047 {
00048     // data
00049     private:
00050     
00051     static const Safety_ Safe;  
00052     static const double SVD_EPSILON;    
00053     
00054     Rmatdbl_ U; 
00055     Vecdbl_ W;  
00056     Rmatdbl_ V; 
00057     unsigned int R, Rorig, C;   
00058     
00059     // methods
00060     public:
00061     
00070     explicit Svd_(unsigned int Row=3, unsigned int Col=3);
00071     
00073     const Rmatdbl_& u() const { return(U); }
00074     
00076     const Vecdbl_& w() const { return(W); }
00077     
00079     const Rmatdbl_& v() const { return(V); }
00080     
00082     unsigned int rno() const { return(R); }
00083     
00085     unsigned int cno() const { return(C); }
00086     
00094     void set_size(unsigned int Row=3, unsigned int Col=3);
00095     
00103     void make_decomp(const Rmatdbl_& A);
00104         
00113     unsigned int rank_cond(double Eps=SVD_EPSILON, double *Cond=NULL);
00114     
00124     Vecdbl_ lin_solve(const Vecdbl_& B) const;
00125     
00127     void reset_data() { U.set_values(); W.set_values(); V.set_values(); }
00128     
00130     friend ostream& operator<<(ostream& Out, const Svd_& Svd);
00131     
00132     private:
00133             
00134     void svd_core();
00135     void utb(const Vecdbl_& B, Vecdbl_& Utb) const;
00136 };
00137 // END OF CLASS Svd_
00138 
00143 class Svdexc_: public Utilsexc_
00144 {
00145     public:
00146     explicit Svdexc_(const char *Thnm, const char *Msg, bool F=false):
00147             Utilsexc_(Thnm, F, Msg) {}
00148     private:
00149     Svdexc_();  // no default ctor
00150 };
00151 // END OF CLASS Svdexc_
00152 
00153 } // RazorBack
00154 
00155 // ==== END OF HEADER Svd.hh ====
00156 #endif  // SVD_CLASS

Generated at Wed Aug 21 09:33:22 2002 for The Razorback C++ Library: Linear Algebra by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001