Changeset 787


Ignore:
Timestamp:
Mar 9, 2007, 10:40:34 AM (15 years ago)
Author:
Peter
Message:

removed v_const in vector since it never used for anything but only assigned here and there

Location:
trunk/yat/utility
Files:
2 edited

Legend:

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

    r784 r787  
    55  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    7   Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2007 Jari Häkkinen
     7  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    98
    109  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
     
    4241
    4342  vector::vector(void)
    44     : v_(NULL), v_const_(NULL), view_(NULL), view_const_(NULL), proxy_v_(NULL)
     43    : v_(NULL), view_(NULL), view_const_(NULL), proxy_v_(NULL)
    4544  {
    4645  }
     
    4847
    4948  vector::vector(size_t n, double init_value)
    50     : v_(gsl_vector_alloc(n)), v_const_(NULL), view_(NULL), view_const_(NULL),
     49    : v_(gsl_vector_alloc(n)), view_(NULL), view_const_(NULL),
    5150      proxy_v_(v_)
    5251  {
     
    5958
    6059  vector::vector(const vector& other)
    61     : v_(other.create_gsl_vector_copy()), v_const_(NULL), view_(NULL),
     60    : v_(other.create_gsl_vector_copy()), view_(NULL),
    6261      view_const_(NULL), proxy_v_(v_)
    6362  {
     
    6665
    6766  vector::vector(vector& v, size_t offset, size_t n, size_t stride)
    68     : v_const_(NULL), view_const_(NULL)
     67    : view_const_(NULL)
    6968  {
    7069    view_ = new gsl_vector_view(gsl_vector_subvector_with_stride(v.v_,offset,
     
    8382    if (!view_const_)
    8483      throw utility::GSL_error("vector::vector failed to setup view");
    85     proxy_v_ = v_const_ = &(view_const_->vector);
     84    proxy_v_ = &(view_const_->vector);
     85    const_cast<const gsl_vector*>(proxy_v_);
    8686  }
    8787
    8888
    8989  vector::vector(matrix& m, size_t i, bool row)
    90     : v_const_(NULL), view_const_(NULL)
     90    : view_const_(NULL)
    9191  {
    9292    view_=new gsl_vector_view(row ?
     
    107107    if (!view_const_)
    108108      throw utility::GSL_error("vector::vector failed to setup view");
    109     proxy_v_ = v_const_ = &(view_const_->vector);
     109    proxy_v_ = &(view_const_->vector);
    110110  }
    111111
     
    113113  vector::vector(std::istream& is, char sep)
    114114    throw (utility::IO_error, std::exception)
    115     : v_const_(NULL), view_(NULL), view_const_(NULL)
     115    : view_(NULL), view_const_(NULL)
    116116  {
    117117    // read the data file and store in stl vectors (dynamically
     
    347347      else if ( v_ )
    348348        gsl_vector_free( v_ );
    349       v_const_=NULL;
    350349      proxy_v_ = v_ = other.create_gsl_vector_copy();
    351350    }
  • trunk/yat/utility/vector.h

    r785 r787  
    88  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
    99  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    10   Copyright (C) 2006, 2007 Jari Häkkinen
     10  Copyright (C) 2006 Jari Häkkinen
     11  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    1112
    1213  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
     
    413414
    414415    gsl_vector* v_;
    415     const gsl_vector* v_const_;
    416416    gsl_vector_view* view_;
    417417    const gsl_vector_const_view* view_const_;
    418     // proxy_v_ is used to access the proper underlying v_ or v_const_
     418    // proxy_v_ is used to access the proper underlying gsl_vector
    419419    // in all const member functions. It is not used by design for
    420420    // non-const vector functions and operators. This is to make sure
Note: See TracChangeset for help on using the changeset viewer.