Changeset 1036


Ignore:
Timestamp:
Feb 5, 2008, 6:25:52 PM (16 years ago)
Author:
Peter
Message:

fixes #291

Location:
trunk/yat/utility
Files:
2 edited

Legend:

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

    r1027 r1036  
    180180
    181181
    182   void vector::resize(size_t n, double init_value)
    183   {
    184     delete_allocated_memory();
    185     const_vec_ = vec_ = gsl_vector_alloc(n);
    186     if (!vec_)
    187       throw utility::GSL_error("vector::vector failed to allocate memory");
    188     all(init_value);
    189    
    190   }
    191 
    192 
    193182  /*
    194183  //Peter use swap idiom
     
    220209  const vector& vector::assign(const VectorBase& other)
    221210  {
     211    delete_allocated_memory();
    222212    if (!other.size())
    223213      vec_=NULL;
    224214    else  {   
    225215      if (size()!=other.size())
    226         resize(other.size(),0.0);
     216        vec_ = gsl_vector_alloc(other.size());
     217      if (!vec_)
     218        throw utility::GSL_error("vector failed to allocate memory");
    227219      gsl_vector_memcpy(vec_,other.gsl_vector_p());
    228220    }
  • trunk/yat/utility/vector.h

    r1027 r1036  
    149149
    150150    /**
    151        @brief Resize vector
    152        
    153        All elements are set to @a init_value.
    154 
    155        \note Underlying GSL vector is destroyed and a view into this
    156        vector becomes invalid.
    157     */
    158     void resize(size_t n, double init_value);
    159 
    160     //    using VectorBase::operator=;
    161 
    162     /**
    163151       \brief The assignment operator.
    164152
Note: See TracChangeset for help on using the changeset viewer.