Changeset 3857 in Sophya for trunk/SophyaLib/TArray/tvector.cc
- Timestamp:
- Aug 12, 2010, 12:22:17 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tvector.cc
r3853 r3857 1 // $Id: tvector.cc,v 1.2 6 2010-08-11 22:59:10ansari Exp $1 // $Id: tvector.cc,v 1.27 2010-08-12 10:22:17 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "sopnamsp.h" … … 16 16 17 17 The TVector class specializes the TMatrix class for representing 18 row or column vectors. 18 row or column vectors. TVector<T> objects can be initialised or converted 19 to std::vector<T>. 19 20 20 21 \b Vector is a typedef for double precision floating point vectors ( TVector<r_8> ). … … 245 246 for(sa_size_t i=0;i<n;i++) v.push_back((*this)(i)); 246 247 return n; 248 } 249 250 /* 251 \brief to std::vector<T> conversion function 252 253 Returns an std::vector<T> with the same size as the original vector and with elements std::vec[i]=(*this)(i) 254 */ 255 template <class T> 256 vector<T> TVector<T>::ConvertTostdvec() 257 { 258 sa_size_t n = Size(); 259 std::vector<T> rv(n); 260 for(sa_size_t i=0;i<n;i++) rv[i]=(*this)(i); 261 return rv; 247 262 } 248 263
Note:
See TracChangeset
for help on using the changeset viewer.