Changeset 4035 in Sophya for trunk/SophyaLib/TArray/tvector.cc
- Timestamp:
- Nov 14, 2011, 5:28:25 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tvector.cc
r3869 r4035 1 // $Id: tvector.cc,v 1.2 8 2010-08-12 15:01:47ansari Exp $1 // $Id: tvector.cc,v 1.29 2011-11-14 16:28:25 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "sopnamsp.h" … … 56 56 /*! 57 57 \param n : number of elements 58 \param lcv : line or column vector ?58 \param lcv : line or column vector (BaseArray::AutoVectorType / SameVectorType / ColumnVector / RowVector) 59 59 \param mm : memory mapping type 60 60 \param fzero : if \b true , set vector elements to zero … … 108 108 : TMatrix<T>(a, share) 109 109 { 110 arrtype_ = 2; // Type = Vector 111 if (a.NbDimensions() == 0) return; // Reza-Nov 2011: we allow copy contrsuctor on non allocated arrays 110 112 if ( (size_[0] != 1) && (size_[1] != 1) ) 111 113 throw SzMismatchError("TVector<T>::TVector(const TArray<T>& a) NRows()!=1 && NCols()!=1 "); 112 arrtype_ = 2; // Type = Vector113 114 if ( (size_[0] == 1) && (size_[1] == 1) ) { 114 115 if (lcv == SameVectorType) lcv = a.GetVectorType(); … … 119 120 120 121 //! Constructor of a vector from a TArray \b a , with a different data type 121 template <class T> 122 TVector<T>::TVector(const BaseArray& a) 123 : TMatrix<T>(a) 124 { 122 /*! 123 vector size and memory layout are copied from the array \b a, or a packed vector is created if \b pack==true. 124 \param a : original array, to copy sizes and data from 125 \param pack : if \b true , create a packed vector, else same memory layout as \b a. 126 */ 127 template <class T> 128 TVector<T>::TVector(const BaseArray& a, bool pack) 129 : TMatrix<T>(a,pack) 130 { 131 arrtype_ = 2; // Type = Vector 132 if (a.NbDimensions() == 0) return; // Reza-Nov 2011: we allow copy contrsuctor on non allocated arrays 125 133 if ( (size_[0] != 1) && (size_[1] != 1) ) 126 throw SzMismatchError("TVector<T>::TVector(const BaseArray& a) NRows()!=1 && NCols()!=1 "); 127 arrtype_ = 2; // Type = Vector 134 throw SzMismatchError("TVector<T>::TVector(const BaseArray& a,bool) NRows()!=1 && NCols()!=1 "); 128 135 } 129 136
Note:
See TracChangeset
for help on using the changeset viewer.