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

Linls.hh

Go to the documentation of this file.
00001 #ifndef LINLS_CLASS_HEADER
00002 #define LINLS_CLASS_HEADER
00003 
00004 // ==== HEADER Linls.hh ====
00005 
00012 // 9-Aug-2000. Andras Aszodi
00013 
00014 // ==== STANDARD HEADERS ====
00015 
00016 #include <stdlib.h>
00017 #include <float.h>
00018 #include <math.h>
00019 
00020 // ==== MODULE HEADERS ====
00021 
00022 #include "Vector.hh"
00023 #include "Rectmat.hh"
00024 #include "Symmat.hh"
00025 #include "Svd.hh"
00026 
00027 // ==== CLASSES ====
00028 
00029 namespace RazorBack {
00030 
00035 class Linls_
00036 {
00037     // data
00038     private:
00039     
00040     size_t Nm, Np, Nf; 
00041     Svd_ Svd;           
00042     size_t Rank;        
00043     Vecdbl_ Utb;        
00044     Vecdbl_ P, Sdev;    
00045     Smatdbl_ Correl;    
00046     double Chi2;        
00047     
00048     // methods
00049     public:
00050             
00052     explicit Linls_(size_t NM=0, size_t NP=0):
00053             Nm(NM), Np(NP), Svd(NM, NP), Rank(NP), Utb(NP),
00054             P(NP), Sdev(NP), Correl(NP) {}
00055     
00067     double lin_reg(const Rmatdbl_& Xmeas, const Vecdbl_& Ymeas, double Eps=1e-10);
00068     
00070     size_t rank() const { return Rank; }
00071     
00073     double condition() const { return (!rank())? HUGE_VAL: Svd.w()[0]/rank(); }
00074     
00076     size_t deg_freedom() const { return Nf; }
00077     
00079     const Vecdbl_& param() const { return P; }
00080     
00082     const Vecdbl_& sdev() const { return Sdev; }
00083     
00085     const Smatdbl_& correl() const { return Correl; }
00086     
00088     double chi_square() const { return Chi2; }
00089     
00091     double residual_dev() const { return sqrt(Chi2/Nf); }
00092     
00093     // hidden methods
00094     protected:
00095     
00096     void adjust_dimensions(const Rmatdbl_& Xmeas, const Vecdbl_& Ymeas);
00097     void make_utb(const Vecdbl_& B);
00098     size_t calc_rank(const Vecdbl_& B, double Eps) const;
00099     void calc_params(const Rmatdbl_& Xmeas, const Vecdbl_& Ymeas);
00100     double calc_chi2(const Rmatdbl_& Xmeas, const Vecdbl_& Ymeas) const;
00101 
00102 };
00103 // END OF CLASS Linls_
00104 
00105 } // RazorBack
00106 
00107 // ==== END OF HEADER Linls.hh ====
00108 
00109 #endif      // LINLS_CLASS_HEADER

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