Changeset 787 for trunk/yat/utility/vector.cc
- Timestamp:
- Mar 9, 2007, 10:40:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.cc
r784 r787 5 5 Copyright (C) 2004 Jari Häkkinen, Peter Johansson 6 6 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 9 8 10 9 This file is part of the yat library, http://lev.thep.lu.se/trac/yat … … 42 41 43 42 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) 45 44 { 46 45 } … … 48 47 49 48 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), 51 50 proxy_v_(v_) 52 51 { … … 59 58 60 59 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), 62 61 view_const_(NULL), proxy_v_(v_) 63 62 { … … 66 65 67 66 vector::vector(vector& v, size_t offset, size_t n, size_t stride) 68 : v _const_(NULL), view_const_(NULL)67 : view_const_(NULL) 69 68 { 70 69 view_ = new gsl_vector_view(gsl_vector_subvector_with_stride(v.v_,offset, … … 83 82 if (!view_const_) 84 83 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_); 86 86 } 87 87 88 88 89 89 vector::vector(matrix& m, size_t i, bool row) 90 : v _const_(NULL), view_const_(NULL)90 : view_const_(NULL) 91 91 { 92 92 view_=new gsl_vector_view(row ? … … 107 107 if (!view_const_) 108 108 throw utility::GSL_error("vector::vector failed to setup view"); 109 proxy_v_ = v_const_ =&(view_const_->vector);109 proxy_v_ = &(view_const_->vector); 110 110 } 111 111 … … 113 113 vector::vector(std::istream& is, char sep) 114 114 throw (utility::IO_error, std::exception) 115 : v _const_(NULL), view_(NULL), view_const_(NULL)115 : view_(NULL), view_const_(NULL) 116 116 { 117 117 // read the data file and store in stl vectors (dynamically … … 347 347 else if ( v_ ) 348 348 gsl_vector_free( v_ ); 349 v_const_=NULL;350 349 proxy_v_ = v_ = other.create_gsl_vector_copy(); 351 350 }
Note: See TracChangeset
for help on using the changeset viewer.