Changeset 11 for trunk/src/SVD.h


Ignore:
Timestamp:
Jun 3, 2003, 6:21:31 PM (19 years ago)
Author:
daniel
Message:

Hmm...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SVD.h

    r7 r11  
    44#define _THEP_CPPTOOLS_SVD_
    55
    6 //GSLwrap includes
    7 //////////////////
    8 #include <gslwrap/matrix_double.h>
    9 #include <gslwrap/vector_double.h>
     6// C++ tools include
     7/////////////////////
     8#include "matrix.h"
     9#include "vector.h"
     10#include <gsl/gsl_vector.h>
     11
     12
     13// Standard includes
     14////////////////////
     15#include <iostream>
     16#include <cmath>   
     17#include <cstdlib> //To include srand() and rand()
     18#include <ctime>
    1019
    1120
     
    2635  class SVD
    2736  {   
    28     static const double MAXTOL = 1E-10;
     37    static const double MAXTOL = 1E-6;
    2938
    3039    enum SVDtypes
     
    3847  public:
    3948    /**
     49       The default constructor should only be used for testing!!!
     50    */
     51    SVD();
     52
     53   
     54    /**
    4055       Constructs an SVD object using the matrix A as only
    4156       input. The input matrix is copied for further use in the
    4257       object.
    4358    */
    44     SVD( const gsl::matrix& );
     59    SVD( const thep_gsl_api::matrix& );
    4560   
    4661    /**
    4762       Constructor initializing the SVD object for Solver. 
    48        Solver requires an extra-vector paramter \a b: $Ax = b$
    49        The $x$ vector will be reached using the get_x()
     63       Solver requires an extra-vector paramter \a b: \f$Ax = b\f$
     64       The \f$x\f$ vector will be reached using the get_x()
    5065       function.
    5166       @see get_x() function.
    5267    */
    5368
    54     SVD( const gsl::matrix&, const gsl::vector& b);
     69    SVD( const thep_gsl_api::matrix&, const thep_gsl_api::vector& b);
    5570    ~SVD();
    5671
     
    6176       Modified: This method is faster when M>>N. (see GSL documentation
    6277       about gsl_linalg_SV_decomp_mod function)\n
    63        Jakoby: Computes singular values to higer accuracy than default method
     78       Jacobi: Computes singular values to higer accuracy than default method
    6479       (see GSL documentation about gsl_linalg_SV_decomp_jacobi.\n
    6580       Solver: Using Unmodified to perform SVD and then solves the system \f$Ax=b\f$
     
    7186       executed.
    7287    */
    73     gsl::matrix get_u() const { return A_; }
     88    thep_gsl_api::matrix get_u() const { return A_; }
    7489
    7590    /**
     
    7792       executed.
    7893    */
    79     gsl::matrix get_v() const { return V_; }
     94    thep_gsl_api::matrix get_v() const { return V_; }
    8095
    8196
     
    87102    */
    88103
    89     gsl::vector get_x() const { return x_; }
     104    thep_gsl_api::vector get_x() const { return x_; }
    90105
    91106    /**
     
    93108       executed.
    94109    */
    95     gsl::matrix get_s() const;
     110    thep_gsl_api::matrix get_s() const;
     111
    96112
    97113    /**
    98        This method will execute Default, Unmodified and Jakoby methods one at a time
     114       Function returning diagonal matrix S in vector form.
     115    */
     116    thep_gsl_api::vector get_s_vec() const { return s_; }
     117
     118
     119    /**
     120       This method will execute Default, Unmodified and Jacobi methods one at a time
    99121       and calculate the error, \f$ e = \left\Vert A - USV^{T} \right\Vert_{2} \f$.
    100        The method will return "true" if \f$e < 10^{-10}\f$ else false. A test program
     122       The method will return "true" if \f$e < 10^{-6}\f$ else false. A test program
    101123       is available that executes this method, c++_tools/test/svd_test. No test is
    102124       performed for solver but the aim is to add one in the future.
     
    105127   
    106128  private:
    107     SVD();
    108129
    109     gsl::matrix A_, V_;   
    110     gsl::vector s_, b_, x_;
     130    thep_gsl_api::matrix A_, V_;   
     131    thep_gsl_api::vector s_, b_, x_;
    111132    bool loaded_, solver_;
    112133
Note: See TracChangeset for help on using the changeset viewer.