Changeset 759 for trunk/yat/utility


Ignore:
Timestamp:
Feb 19, 2007, 8:41:25 PM (15 years ago)
Author:
Jari Häkkinen
Message:

Fixes #171 and addresses #2. A few more GSL_error exceptions. Removed Jari comments.

Location:
trunk/yat/utility
Files:
6 edited

Legend:

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

    r687 r759  
    5353  {
    5454    for (unsigned int i=0; i<data_.rows(); i++) {
    55       // Jari, avoid copying in next line
    5655      std::vector<std::pair<u_int,double> > distance=calculate_distances(i);
    5756      std::sort(distance.begin(),distance.end(),
     
    6463        for (std::vector<u_int>::const_iterator k=knn.begin(); k!=knn.end();
    6564             ++k) {
    66           // Jari, a small number needed here, use something standardized.
    6765          // Avoid division with zero (perfect match vectors)
    6866          double d=(distance[*k].second ? distance[*k].second : 1e-10);
  • trunk/yat/utility/kNNI.cc

    r687 r759  
    5858  {
    5959    for (unsigned int i=0; i<mv_rows_.size(); i++) {
    60       // Jari, avoid copying in next line
    6160      std::vector<std::pair<u_int,double> > distance=
    6261        calculate_distances(mv_rows_[i]);
     
    7069          for (std::vector<u_int>::const_iterator k=knn.begin(); k!=knn.end();
    7170               ++k) {
    72             // Jari, a small number needed here, use something standardized.
    7371            // Avoid division with zero (perfect match vectors)
    7472            double d=(distance[*k].second ? distance[*k].second : 1e-10);
  • trunk/yat/utility/matrix.cc

    r755 r759  
    7878    : view_(NULL)
    7979  {
    80     // Markus to Jari, somewhere we should check that quiet_NaNs are supported
    81     // std::numeric_limits<double>::has_quiet_NaN has to be true.
    82     // Also in vector
    83 
    8480    // read the data file and store in stl vectors (dynamically
    8581    // expandable)
     
    114110        }
    115111        else {
    116           // Jari, this should be communicated with as an exception.
    117           std::cerr << "Warning: '" << element
    118                     << "' is not accepted as a matrix element." << std::endl;
     112          std::stringstream ss("Warning: '");
     113          ss << element << "' is not accepted as a matrix element.";
     114          throw IO_error(ss.str());
    119115        }
    120116      }           
  • trunk/yat/utility/matrix.h

    r755 r759  
    137137       file marker.
    138138
    139        \throw GSL_error if memory allocation fails.
     139       \throw GSL_error if memory allocation fails, IO_error if
     140       unexpected input is found in the input stream.
    140141    */
    141142    explicit matrix(std::istream &, char sep='\0')
     
    189190    /// @return A const pointer to the internal GSL matrix.
    190191    ///
    191     const gsl_matrix* gsl_matrix_p(void) const;
     192    const gsl_matrix* gsl_matrix_p(void) const;
    192193
    193194    ///
    194195    /// @return A pointer to the internal GSL matrix.
    195196    ///
    196     // Jari, is this needed?
    197     gsl_matrix* gsl_matrix_p(void);
     197    gsl_matrix* gsl_matrix_p(void);
    198198
    199199    ///
  • trunk/yat/utility/vector.cc

    r758 r759  
    145145        }
    146146        else {
    147           // Jari, this should be communicated with as an exception.
    148           // std::cerr << "Warning: '" << element
    149           //           << "' is not an integer." << std::endl;
     147          std::stringstream ss("Warning: '");
     148          ss << element << "' is not an integer.";
     149          throw IO_error(ss.str());
    150150        }
    151151      }
  • trunk/yat/utility/vector.h

    r755 r759  
    204204       to the vector is at end of file marker.
    205205
    206        \throw GSL_error if memory allocation fails.
     206       \throw GSL_error if memory allocation fails, IO_error if
     207       unexpected input is found in the input stream.
    207208    */
    208209    explicit vector(std::istream &, char sep='\0')
     
    263264    /// @return The maximum value of the vector.
    264265    ///
    265     // Jari, doxygen group as Finding maximum and minimum elements
    266266    double max(void) const;
    267267
     
    270270    /// vector. The lowest index has precedence.
    271271    ///
    272     // Jari, doxygen group as Finding maximum and minimum elements
    273272    size_t max_index(void) const;
    274273
     
    276275    /// @return The minimum value of the vector.
    277276    ///
    278     // Jari, doxygen group as Finding maximum and minimum elements
    279277    double min(void) const;
    280278
     
    283281    /// vector. The lowest index has precedence.
    284282    ///
    285     // Jari, doxygen group as Finding maximum and minimum elements
    286283    size_t min_index(void) const;
    287284
     
    291288    /// respectively.
    292289    ///
    293     // Jari, doxygen group as Finding maximum and minimum elements
    294290    std::pair<double,double> minmax(void) const;
    295291
     
    299295    /// \a pair, respectively. The lowest index has precedence.
    300296    ///
    301     // Jari, doxygen group as Finding maximum and minimum elements
    302297    std::pair<size_t,size_t> minmax_index(void) const;
    303298
     
    334329    /// Set all elements to \a value.
    335330    ///
    336     // Jari, doxygen group as Initializing vector elements
    337331    void set_all(const double& value);
    338332
     
    342336    /// one.
    343337    ///
    344     // Jari, doxygen group as Initializing vector elements
    345338    void set_basis(const size_t i);
    346339   
     
    348341    /// Set all elements to zero.
    349342    ///
    350     // Jari, doxygen group as Initializing vector elements
    351343    void set_zero(void);
    352344
     
    361353    /// Bug in gsl: if vector contains NaN an infinite loop is entered.
    362354    ///
    363     // Markus to Jari, doxygen group as Exchanging elements ????
    364355    void sort(void);
    365356
     
    422413    /// @return Reference to element \a i.
    423414    ///
    424     // Jari, doxygen group as Accessing vector elements
    425415    double& operator[](size_t i);
    426416
     
    430420    /// @return The value of element \a i.
    431421    ///
    432     // Jari, doxygen group as Accessing vector elements
    433422    const double& operator[](size_t i) const;
    434423
Note: See TracChangeset for help on using the changeset viewer.