Changeset 715


Ignore:
Timestamp:
Dec 22, 2006, 9:42:39 AM (17 years ago)
Author:
Jari Häkkinen
Message:

Addresses #170.

Location:
trunk/yat/utility
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/Option.cc

    r687 r715  
    4141
    4242
     43  Option::argument_type Option::arg_type(void) const
     44  {
     45    return arg_type_;
     46  }
     47
     48
     49  std::string Option::long_name(void) const
     50  {
     51    return long_name_;
     52  }
     53
     54
     55  std::string Option::name(void) const
     56  {
     57    return !long_name_.empty() ? long_name_ : std::string(&short_name_) ;
     58  }
     59
     60
     61  bool& Option::present(void)
     62  {
     63    return present_;
     64  }
     65
     66
    4367  void Option::print(void) const
    4468  {
     
    6185  }
    6286
     87
     88  char Option::short_name(void) const
     89  {
     90    return short_name_;
     91  }
     92
     93
     94  std::string Option::value(void)
     95  {
     96    return value_;
     97  }
     98
    6399}}} // of namespace utility, yat, and theplu
  • trunk/yat/utility/Option.h

    r687 r715  
    5656    Option(char short_name, std::string long_name,
    5757           argument_type arg, std::string desc);
    58            
    5958
    6059    ///
    6160    /// @return argument type for option
    6261    ///
    63     inline const argument_type& arg_type(void) const { return arg_type_; }
     62    argument_type arg_type(void) const;
    6463   
     64    ///
     65    /// @return long name
     66    ///
     67    std::string long_name(void) const;
     68
    6569    ///
    6670    /// @return long name unless long name is empty in which case the
    6771    /// short one character name is returned.
    6872    ///
    69     inline std::string name(void) const
    70     { return !long_name_.empty() ? long_name_ : std::string(&short_name_) ; }
     73    std::string name(void) const;
    7174
    7275    ///
    73     /// @return short name
     76    /// @brief Get or set the present status.
    7477    ///
    75     inline char short_name(void) const { return short_name_; }
    76 
     78    /// @return true if option has been detected in parsing
    7779    ///
    78     /// @return long name
    79     ///
    80     inline const std::string& long_name(void) const { return long_name_; }
     80    bool& present(void);
    8181
    8282    ///
     
    8888
    8989    ///
    90     /// @return true if option has been detected in parsing
     90    /// @return short name
    9191    ///
    92     inline bool& present(void) { return present_; }
     92    char short_name(void) const;
    9393
    9494    ///
    9595    /// @return argument value
    9696    ///
    97     inline std::string& value(void) { return value_; }
     97    std::string value(void);
    9898
    9999
  • trunk/yat/utility/PCA.cc

    r703 r715  
    3737    : A_(A), process_(false), explained_calc_(false)
    3838  {
     39  }
     40
     41
     42  utility::vector PCA::get_eigenvector(size_t i) const
     43  {
     44    return utility::vector(eigenvectors_,i);
     45  }
     46
     47
     48  double PCA::get_eigenvalue(size_t i) const
     49  {
     50    return eigenvalues_[i];
    3951  }
    4052
  • trunk/yat/utility/PCA.h

    r703 r715  
    7474       @return Eigenvector \a i.
    7575    */
    76     inline utility::vector get_eigenvector(size_t i) const
    77       { return utility::vector(eigenvectors_,i); }
     76    utility::vector get_eigenvector(size_t i) const;
    7877
    7978    /**
     
    8180       \f$ C = \frac{1}{N^2}A^TA \f$
    8281    */
    83     inline double get_eigenvalue(size_t i) const { return eigenvalues_[i]; }
     82    double get_eigenvalue(size_t i) const;
    8483
    8584    /**
     
    125124       intensity
    126125    */
    127     void calculate_explained_intensity();
     126    void calculate_explained_intensity(void);
    128127  }; // class PCA 
    129128
  • trunk/yat/utility/SVD.cc

    r703 r715  
    5050          return jacobi();
    5151    }
    52     // the program should never end up here, return values should be
     52    // Jari, the program should never end up here, return values should be
    5353    // something different from normal GSL return values, or maybe
    5454    // throw an exception.
    5555    return 0;
    5656  }
    57 
    5857
    5958
     
    6564  }
    6665
     66
     67  int SVD::jacobi(void)
     68  {
     69    return gsl_linalg_SV_decomp_jacobi(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
     70                                       s_.gsl_vector_p());
     71  }
    6772
    6873
     
    7782
    7883
     84  const utility::vector& SVD::s(void) const
     85  {
     86    return s_;
     87  }
     88
     89
     90  int SVD::solve(const utility::vector& b, utility::vector x)
     91  {
     92    return gsl_linalg_SV_solve(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
     93                               s_.gsl_vector_p(), b.gsl_vector_p(),
     94                               x.gsl_vector_p());
     95  }
     96
     97
     98  const utility::matrix& SVD::U(void) const
     99  {
     100    return U_;
     101  }
     102
     103
     104  const utility::matrix& SVD::V(void) const
     105  {
     106    return V_;
     107  }
     108
    79109}}} // of namespace utility, yat, and theplu
  • trunk/yat/utility/SVD.h

    r703 r715  
    9797    /// is undefined.
    9898    ///
    99     inline const utility::vector& s(void) const { return s_; }
     99    const utility::vector& s(void) const;
    100100
    101101    ///
     
    108108    /// @return Whatever GSL returns.
    109109    ///
    110     inline int solve(utility::vector b, utility::vector x)
    111       { return gsl_linalg_SV_solve(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
    112                                    s_.gsl_vector_p(), b.gsl_vector_p(),
    113                                    x.gsl_vector_p()); }
     110    int solve(const utility::vector& b, utility::vector x);
    114111
    115112    ///
     
    121118    /// is undefined.
    122119    ///
    123     inline const utility::matrix& U(void) const { return U_; }
     120    const utility::matrix& U(void) const;
    124121
    125122    ///
     
    131128    /// is undefined.
    132129    ///
    133     inline const utility::matrix& V(void) const { return V_; }
     130    const utility::matrix& V(void) const;
    134131
    135132  private:
    136     inline int jacobi(void)
    137       { return gsl_linalg_SV_decomp_jacobi(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
    138                                            s_.gsl_vector_p()); }
     133    int jacobi(void);
    139134    int golub_reinsch(void);
    140135    int modified_golub_reinsch(void);
  • trunk/yat/utility/stl_utility.cc

    r680 r715  
    6161
    6262
    63 
    6463  bool read_to_int(std::istream& is, std::vector<int>& vec)
    6564  {
     
    8786
    8887
    89 
    9088  bool read_to_string(std::istream& is, std::vector<std::string>& vec)
    9189  {
     
    103101  }
    104102
     103
     104  void to_lower(std::string& s)
     105  {
     106    transform(s.begin(),s.end(), s.begin(), tolower);
     107  }
     108
     109
     110  void to_upper(std::string& s)
     111  {
     112    transform(s.begin(),s.end(), s.begin(), toupper);
     113  }
     114
    105115}}} // end of namespace utility, yat and thep
  • trunk/yat/utility/stl_utility.h

    r703 r715  
    122122  /// @brief Function converting a string to lower case
    123123  ///
    124   inline void to_lower(std::string& s) {
    125     transform(s.begin(),s.end(), s.begin(), tolower);
    126   }
     124  void to_lower(std::string& s);
    127125
    128126  ///
    129127  /// @brief Function converting a string to upper case
    130128  ///
    131   inline void to_upper(std::string& s) {
    132     transform(s.begin(),s.end(), s.begin(), toupper);
    133   }
    134 
     129  void to_upper(std::string& s);
    135130
    136131}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.