Ignore:
Timestamp:
Feb 1, 2008, 5:35:32 PM (13 years ago)
Author:
Peter
Message:

changing class names vectorView => VectorView? and vectorBase => VectorBase?. Refs #256

File:
1 moved

Legend:

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

    r1013 r1015  
    8686  */
    8787
    88   class vectorBase
     88  class VectorBase
    8989  {
    9090  public:
    9191
    92     /// \brief vectorBase::iterator
    93     typedef Iterator<double&, vectorBase> iterator;
    94 
    95     /// \brief vectorBase::const_iterator
    96     typedef Iterator<const double, const vectorBase> const_iterator;
     92    /// \brief VectorBase::iterator
     93    typedef Iterator<double&, VectorBase> iterator;
     94
     95    /// \brief VectorBase::const_iterator
     96    typedef Iterator<const double, const VectorBase> const_iterator;
    9797
    9898    /**
    9999       \brief default constructor
    100100    */
    101     vectorBase(void);
     101    VectorBase(void);
    102102
    103103    /**
    104104       \brief Constructor.
    105105    */
    106     vectorBase(gsl_vector*);
     106    VectorBase(gsl_vector*);
    107107
    108108    /**
    109109       \brief Constructor.
    110110    */
    111     vectorBase(const gsl_vector*);
     111    VectorBase(const gsl_vector*);
    112112
    113113    ///
    114114    /// The destructor.
    115115    ///
    116     virtual ~vectorBase(void);
     116    virtual ~VectorBase(void);
    117117
    118118    ///
     
    122122
    123123    /**
    124        \return mutable iterator to start of vectorBase
     124       \return mutable iterator to start of VectorBase
    125125     */
    126126    iterator begin(void);
    127127
    128128    /**
    129        \return read-only iterator to start of vectorBase
     129       \return read-only iterator to start of VectorBase
    130130     */
    131131    const_iterator begin(void) const;
     
    137137       \throw GSL_error if dimensions mis-match.
    138138    */
    139     void div(const vectorBase& other);
    140 
    141     /**
    142        \return mutable iterator to end of vectorBase
     139    void div(const VectorBase& other);
     140
     141    /**
     142       \return mutable iterator to end of VectorBase
    143143     */
    144144    iterator end(void);
    145145
    146146    /**
    147        \return read-only iterator to end of vectorBase
     147       \return read-only iterator to end of VectorBase
    148148     */
    149149    const_iterator end(void) const;
    150150
    151151    /**
    152        \brief Check whether vectorBases are equal within a user defined
     152       \brief Check whether VectorBases are equal within a user defined
    153153       precision, set by \a precision.
    154154
    155155       \return True if each element deviates less or equal than \a
    156        d. If any vectorBase contain a NaN, false is always returned.
     156       d. If any VectorBase contain a NaN, false is always returned.
    157157
    158158       \see operator== and operator!=
    159159    */
    160     bool equal(const vectorBase&, const double precision=0) const;
     160    bool equal(const VectorBase&, const double precision=0) const;
    161161
    162162    ///
     
    186186       \throw GSL_error if dimensions mis-match.
    187187    */
    188     void mul(const vectorBase& other);
    189 
    190     /**
    191        \brief Reverse the order of elements in the vectorBase.
     188    void mul(const VectorBase& other);
     189
     190    /**
     191       \brief Reverse the order of elements in the VectorBase.
    192192    */
    193193    void reverse(void);
    194194
    195195    ///
    196     /// @return the number of elements in the vectorBase.
     196    /// @return the number of elements in the VectorBase.
    197197    ///
    198198    size_t size(void) const;
     
    201201       \brief Exchange elements \a i and \a j.
    202202
    203        \throw GSL_error if vectorBase lengths differs.
     203       \throw GSL_error if VectorBase lengths differs.
    204204    */
    205205    void swap(size_t i, size_t j);
     
    240240       \return True if all elements are equal otherwise false.
    241241
    242        \see equal(const vectorBase&, const double precision=0)
    243     */
    244     bool operator==(const vectorBase&) const;
     242       \see equal(const VectorBase&, const double precision=0)
     243    */
     244    bool operator==(const VectorBase&) const;
    245245
    246246    /**
     
    253253       \return False if all elements are equal otherwise true.
    254254
    255        \see equal(const vectorBase&, const double precision=0)
    256     */
    257     bool operator!=(const vectorBase&) const;
     255       \see equal(const VectorBase&, const double precision=0)
     256    */
     257    bool operator!=(const VectorBase&) const;
    258258
    259259    ///
    260260    /// @return The dot product.
    261261    ///
    262     double operator*(const vectorBase&) const;
     262    double operator*(const VectorBase&) const;
    263263
    264264    /**
    265265       \brief The assignment operator.
    266266
    267        Dimensions of the vectorBases must match. If the LHS vectorBase is a
     267       Dimensions of the VectorBases must match. If the LHS VectorBase is a
    268268       view, the underlying data will be changed.
    269269
    270        \return A const reference to the resulting vectorBase.
    271 
    272        \see void set(const vectorBase&).
     270       \return A const reference to the resulting VectorBase.
     271
     272       \see void set(const VectorBase&).
    273273
    274274       \throw GSL_error if dimensions mis-match.
    275275    */
    276     //const vectorBase& operator=(vectorBase&);
     276    //const VectorBase& operator=(VectorBase&);
    277277
    278278    /**
     
    280280       this_i = this_i + other_i \; \forall i \f$.
    281281
    282        \return A const reference to the resulting vectorBase.
     282       \return A const reference to the resulting VectorBase.
    283283
    284284       \throw GSL_error if dimensions mis-match.
    285285    */
    286     const vectorBase& operator+=(const vectorBase&);
    287 
    288     /**
    289        \brief Add a constant to a vectorBase, \f$ this_i = this_i + d \;
     286    const VectorBase& operator+=(const VectorBase&);
     287
     288    /**
     289       \brief Add a constant to a VectorBase, \f$ this_i = this_i + d \;
    290290       \forall i \f$.
    291291
    292        \return A const reference to the resulting vectorBase.
    293     */
    294     const vectorBase& operator+=(double d);
     292       \return A const reference to the resulting VectorBase.
     293    */
     294    const VectorBase& operator+=(double d);
    295295
    296296    /**
     
    298298       this_i = this_i - other_i \; \forall i \f$.
    299299
    300        \return A const reference to the resulting vectorBase.
     300       \return A const reference to the resulting VectorBase.
    301301
    302302       \throw GSL_error if dimensions mis-match.
    303303    */
    304     const vectorBase& operator-=(const vectorBase&);
    305 
    306     /**
    307        \brief Subtract a constant to a vectorBase, \f$ this_i = this_i - d
     304    const VectorBase& operator-=(const VectorBase&);
     305
     306    /**
     307       \brief Subtract a constant to a VectorBase, \f$ this_i = this_i - d
    308308       \; \forall i \f$.
    309309
    310        \return A const reference to the resulting vectorBase.
    311     */
    312     const vectorBase& operator-=(double d);
     310       \return A const reference to the resulting VectorBase.
     311    */
     312    const VectorBase& operator-=(double d);
    313313
    314314    /**
     
    316316       this_i * d \; \forall i \f$.
    317317
    318        \return A const reference to the resulting vectorBase.
    319     */
    320     const vectorBase& operator*=(double d);
     318       \return A const reference to the resulting VectorBase.
     319    */
     320    const VectorBase& operator*=(double d);
    321321
    322322
     
    335335  private:
    336336    // copy assignment no allowed
    337     const vectorBase& operator=(const vectorBase&);
     337    const VectorBase& operator=(const VectorBase&);
    338338  public:
    339339    /**
     
    344344
    345345  /**
    346      \brief Check if all elements of the vectorBase are zero.
    347 
    348      \return True if all elements in the vectorBase is zero, false
     346     \brief Check if all elements of the VectorBase are zero.
     347
     348     \return True if all elements in the VectorBase is zero, false
    349349     othwerwise.
    350350  */
    351   bool isnull(const vectorBase&);
    352 
    353   /**
    354      \brief Get the maximum value of the vectorBase.
    355 
    356      \return The maximum value of the vectorBase.
    357   */
    358   double max(const vectorBase&);
    359 
    360   /**
    361      \brief Locate the maximum value in the vectorBase.
    362 
    363      \return The index to the maximum value of the vectorBase.
     351  bool isnull(const VectorBase&);
     352
     353  /**
     354     \brief Get the maximum value of the VectorBase.
     355
     356     \return The maximum value of the VectorBase.
     357  */
     358  double max(const VectorBase&);
     359
     360  /**
     361     \brief Locate the maximum value in the VectorBase.
     362
     363     \return The index to the maximum value of the VectorBase.
    364364
    365365     \note Lower index has precedence.
    366366  */
    367   size_t max_index(const vectorBase&);
    368 
    369   /**
    370      \brief Get the minimum value of the vectorBase.
    371 
    372      \return The minimum value of the vectorBase.
    373   */
    374   double min(const vectorBase&);
    375 
    376   /**
    377      \brief Locate the minimum value in the vectorBase.
    378 
    379      \return The index to the minimum value of the vectorBase.
     367  size_t max_index(const VectorBase&);
     368
     369  /**
     370     \brief Get the minimum value of the VectorBase.
     371
     372     \return The minimum value of the VectorBase.
     373  */
     374  double min(const VectorBase&);
     375
     376  /**
     377     \brief Locate the minimum value in the VectorBase.
     378
     379     \return The index to the minimum value of the VectorBase.
    380380
    381381     \note Lower index has precedence.
    382382  */
    383   size_t min_index(const vectorBase&);
    384 
    385   /**
    386      \brief Create a vectorBase \a flag indicating NaN's in another vectorBase
     383  size_t min_index(const VectorBase&);
     384
     385  /**
     386     \brief Create a VectorBase \a flag indicating NaN's in another VectorBase
    387387     \a templat.
    388388
    389      The \a flag vectorBase is changed to contain 1's and 0's only. A 1
    390      means that the corresponding element in the \a templat vectorBase is
     389     The \a flag VectorBase is changed to contain 1's and 0's only. A 1
     390     means that the corresponding element in the \a templat VectorBase is
    391391     valid and a zero means that the corresponding element is a NaN.
    392392
    393      \note Space for vectorBase \a flag is reallocated to fit the size of
    394      vectorBase \a templat if sizes mismatch.
    395 
    396      \return True if the \a templat vectorBase contains at least one NaN.
    397   */
    398   bool nan(const vectorBase& templat, vector& flag);
    399 
    400   /**
    401      Randomly shuffles the elements in vectorBase \a invec
    402   */
    403   void shuffle(vectorBase& invec);
    404 
    405   /**
    406      Sort the elements in the vectorBase.
    407   */
    408   void sort(vectorBase&);
     393     \note Space for VectorBase \a flag is reallocated to fit the size of
     394     VectorBase \a templat if sizes mismatch.
     395
     396     \return True if the \a templat VectorBase contains at least one NaN.
     397  */
     398  bool nan(const VectorBase& templat, vector& flag);
     399
     400  /**
     401     Randomly shuffles the elements in VectorBase \a invec
     402  */
     403  void shuffle(VectorBase& invec);
     404
     405  /**
     406     Sort the elements in the VectorBase.
     407  */
     408  void sort(VectorBase&);
    409409
    410410  /**
    411411     Create a vector \a sort_index containing the indeces of
    412      elements in a another vectorBase \a invec.  The elements of \a
    413      sort_index give the index of the vectorBase element which would
    414      have been stored in that position if the vectorBase had been sorted
     412     elements in a another VectorBase \a invec.  The elements of \a
     413     sort_index give the index of the VectorBase element which would
     414     have been stored in that position if the VectorBase had been sorted
    415415     in place. The first element of \a sort_index gives the index of the least
    416416     element in \a invec, and the last element of \a sort_index gives the
    417      index of the greatest element in \a invec . The vectorBase \a invec
     417     index of the greatest element in \a invec . The VectorBase \a invec
    418418     is not changed.
    419419  */
    420   void sort_index(std::vector<size_t>& sort_index, const vectorBase& invec);
     420  void sort_index(std::vector<size_t>& sort_index, const VectorBase& invec);
    421421
    422422  /**
    423       Similar to sort_index but creates a vectorBase with indices to the \a k
     423      Similar to sort_index but creates a VectorBase with indices to the \a k
    424424  smallest elements in \a invec. 
    425425  */
    426426  void sort_smallest_index(std::vector<size_t>& sort_index, size_t k,
    427                            const vectorBase& invec);
     427                           const VectorBase& invec);
    428428
    429429  /**
    430       Similar to sort_index but creates a vectorBase with indices to the \a k
     430      Similar to sort_index but creates a VectorBase with indices to the \a k
    431431  largest elements in \a invec. 
    432432  */
    433433  void sort_largest_index(std::vector<size_t>& sort_index, size_t k,
    434                           const vectorBase& invec);
    435 
    436   /**
    437      \brief Calculate the sum of all vectorBase elements.
     434                          const VectorBase& invec);
     435
     436  /**
     437     \brief Calculate the sum of all VectorBase elements.
    438438
    439439     \return The sum.
    440440  */
    441   double sum(const vectorBase&);
     441  double sum(const VectorBase&);
    442442
    443443  /**
     
    451451
    452452  /**
    453      \brief The output operator for the vectorBase class.
    454   */
    455   std::ostream& operator<<(std::ostream&, const vectorBase&);
     453     \brief The output operator for the VectorBase class.
     454  */
     455  std::ostream& operator<<(std::ostream&, const VectorBase&);
    456456
    457457}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.