Changeset 1058
- Timestamp:
- Feb 8, 2008, 10:26:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.h
r1036 r1058 48 48 @brief This is the yat interface to GSL vector. 49 49 50 For time being 'double' is the only type supported.51 52 50 \par File streams: 53 51 Reading and writing vectors to file streams are of course … … 55 53 and thus binary read and write to streams are not supported. 56 54 57 \par Vector views: 58 GSL vector views are supported and these are disguised as 59 ordinary utility::vectors. A support function is added, 60 utility::vector::isview(), that can be used to check if a vector 61 object is a view. Note that view vectors do not own the 62 underlying data, and a view is not valid if the vector/matrix 63 owing the data is deallocated. 55 \par Vector views: GSL vector views are supported in classes 56 VectorView and VectorConstView 64 57 65 \par66 Currently there is no restriction on how a vector is used when67 the vector is a const view into another vector or matrix. To68 avoid unexpected runtime errors, the programmer must declare69 const view vectors as 'const' in order to get compile time70 diagnostics about improper use of a const view vector object. If71 'const' is not used and the const view vector is used erroneously72 (such as on the left hand side in assignments), the compiler will73 not catch the error and runtime error will occur. assert(3) is74 used to catch the runtime error during development. Example on75 bad and proper use of const view vectors:76 @code77 const vector vm(13,1.0);78 vector v1(vm,2,4); // bad code! not const!79 v1(0)=-123; // accepted by compiler, runtime abort will occur80 // or catched by assert depending on compiler flags81 const vector v2(vm,2,4); // proper code82 v2(0)=-123; // not acceptable for the compiler83 @endcode84 58 */ 85 59 … … 87 61 { 88 62 public: 89 90 63 /** 91 64 \brief The default constructor. … … 104 77 \brief The copy constructor. 105 78 106 \note If the object to be copied is a vector view, the values107 of the view will be copied, i.e. the view is not copied.108 109 79 \throw A GSL_error is indirectly thrown if memory allocation 110 80 fails. … … 113 83 114 84 /** 115 \brief The copy constructor. 116 117 \note If the object to be copied is a vector view, the values 118 of the view will be copied, i.e. the view is not copied. 85 \brief Copy a VectorBase. 119 86 120 87 \throw A GSL_error is indirectly thrown if memory allocation … … 158 125 private: 159 126 const vector& assign(const VectorBase& other); 160 //const VectorBase& assign(VectorBase& other);161 127 162 128 /**
Note: See TracChangeset
for help on using the changeset viewer.