Ignore:
Timestamp:
Feb 17, 2007, 1:25:36 PM (16 years ago)
Author:
Jari Häkkinen
Message:

Addresses #2. Continued adding GSL_error exceptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/SVD.h

    r719 r751  
    3434namespace utility {
    3535
    36   // Jari check that interface is complete
    37 
    3836  /**
    3937     Class encapsulating GSL methods for singular value decomposition,
     
    4745     V = Orthogonal matrix, size NxN\n
    4846  */
    49 
    5047  class SVD
    5148  {
    5249  public:
    5350
    54     ///
    55     /// A number of SVD algorithms are implemented in GSL. They have
    56     /// their strengths and weaknesses, check the GSL documentation.
    57     ///
    58     /// There are restrictions on the matrix dimensions depending on
    59     /// which SVD algorithm is used. From the GSL's SVD source code
    60     /// one finds that the Golub-Reinsch algorithm implementation will
    61     /// not work on matrices with fewer rows than columns, the same is
    62     /// also true for the modified Golub-Reinsch algorithm.
    63     ///
    64     /// @see GSL's SVD documentation.
    65     ///
     51    /**
     52      A number of SVD algorithms are implemented in GSL. They have
     53      their strengths and weaknesses, check the GSL documentation.
     54   
     55      There are restrictions on the matrix dimensions depending on
     56       which SVD algorithm is used. From the GSL's SVD source code one
     57       finds that the Golub-Reinsch algorithm implementation will not
     58       work on matrices with fewer rows than columns, the same is also
     59      true for the modified Golub-Reinsch algorithm.
     60   
     61       \see GSL's SVD documentation.
     62    */
    6663    enum SVDalgorithm {
    6764      GolubReinsch,
     
    7067    };
    7168
    72     ///
    73     /// Constructs an SVD object using the matrix Ain as only input. The
    74     /// input matrix is copied for further use in the object.
    75     ///
     69    /**
     70       \brief Constructs an SVD object using the matrix Ain as only
     71       input. The input matrix is copied for further use in the
     72       object.
     73    */
    7674    SVD(const utility::matrix& Ain);
    7775
    78     ///
    79     /// @brief The destructor
    80     ///
     76    /**
     77       \brief The destructor
     78    */
    8179    ~SVD(void);
    8280
    83     ///
    84     /// This function will perform SVD with the method specified by \a
    85     /// algo.
    86     ///
    87     /// @return Whatever GSL returns.
    88     ///
    89     int decompose(SVDalgorithm algo=GolubReinsch);
     81    /**
     82       \brief This function will perform SVD with the method specified
     83       by \a algo.
    9084
    91     ///
    92     /// @brief Access to the s vector.
    93     ///
    94     /// @return A copy of the s vector.
    95     ///
    96     /// @note If decompose() has not been run the outcome of the call
    97     /// is undefined.
    98     ///
     85       \throw GSL_error if the underlying GSL function fails.
     86    */
     87    void decompose(SVDalgorithm algo=GolubReinsch);
     88
     89    /**
     90       \brief Access to the s vector.
     91
     92       \return A copy of the s vector.
     93
     94       \note If decompose() has not been run the outcome of the call
     95       is undefined.
     96    */
    9997    const utility::vector& s(void) const;
    10098
    101     ///
    102     /// @brief Solve the system \f$ Ax=b \f$ using the decomposition
    103     /// of A.
    104     ///
    105     /// @note If decompose() has not been run the outcome of the call
    106     /// is undefined.
    107     ///
    108     /// @return Whatever GSL returns.
    109     ///
    110     int solve(const utility::vector& b, utility::vector& x);
     99    /**
     100       \brief Solve the system \f$ Ax=b \f$ using the decomposition of
     101       A.
    111102
    112     ///
    113     /// @brief Access to the U matrix.
    114     ///
    115     /// @return A copy of the U matrix.
    116     ///
    117     /// @note If decompose() has not been run the outcome of the call
    118     /// is undefined.
    119     ///
     103       \note If decompose() has not been run the outcome of the call
     104       is undefined.
     105
     106       \throw GSL_error if the underlying GSL function fails.
     107    */
     108    void solve(const utility::vector& b, utility::vector& x);
     109
     110    /**
     111       \brief Access to the U matrix.
     112
     113       \return A copy of the U matrix.
     114
     115       \note If decompose() has not been run the outcome of the call
     116       is undefined.
     117    */
    120118    const utility::matrix& U(void) const;
    121119
    122     ///
    123     /// @brief Access to the V matrix.
    124     ///
    125     /// @return A copy of the V matrix.
    126     ///
    127     /// @note If decompose() has not been run the outcome of the call
    128     /// is undefined.
    129     ///
     120    /**
     121       \brief Access to the V matrix.
     122
     123       \return A copy of the V matrix.
     124
     125       \note If decompose() has not been run the outcome of the call
     126      is undefined.
     127    */
    130128    const utility::matrix& V(void) const;
    131129
    132130  private:
     131    /**
     132       \brief Call GSL's Jacobi algorithm for SVD.
     133
     134       \return gsl_error status.
     135    */
    133136    int jacobi(void);
     137
     138    /**
     139       \brief Call GSL's Golub-Reinsch algorithm for SVD.
     140
     141       \return gsl_error status.
     142    */
    134143    int golub_reinsch(void);
     144
     145    /**
     146       \brief Call GSL's modified Golub-Reinch algorithm for SVD.
     147
     148       \return gsl_error status.
     149    */
    135150    int modified_golub_reinsch(void);
    136151
Note: See TracChangeset for help on using the changeset viewer.