Changeset 2569 in Sophya for trunk/SophyaLib/TArray
- Timestamp:
- Jul 27, 2004, 1:44:24 PM (21 years ago)
- Location:
- trunk/SophyaLib/TArray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tarray.cc
r2564 r2569 305 305 if (pack) { 306 306 sa_size_t siz[BASEARRAY_MAXNDIMS]; 307 for(int ksz=0; ksz<BASEARRAY_MAXNDIMS; ksz++) siz[ksz] = a.Size(ksz); 307 int ksz; 308 for(ksz=0; ksz<a.NbDimensions(); ksz++) siz[ksz] = a.Size(ksz); 309 for(ksz=a.NbDimensions(); ksz<BASEARRAY_MAXNDIMS; ksz++) siz[ksz] = 1; 308 310 if (!UpdateSizes(a.NbDimensions(), siz, 1, 0, exmsg)) throw( ParmError(exmsg) ); 311 SetMemoryMapping(a.GetMemoryMapping()); 309 312 mNDBlock.ReSize(totsize_, fzero); 310 313 } -
trunk/SophyaLib/TArray/tarray.h
r2564 r2569 58 58 59 59 void ReSize(int_4 ndim, sa_size_t * siz, sa_size_t step=1, bool fzero=true); 60 void ReSize(const BaseArray& a, bool pack= true, bool fzero=true);60 void ReSize(const BaseArray& a, bool pack=false, bool fzero=true); 61 61 //! a synonym (alias) for method ReSize(int_4, ...) 62 62 inline void SetSize(int_4 ndim, sa_size_t * siz, sa_size_t step=1, bool fzero=true) 63 63 { ReSize(ndim, siz, step, fzero); } 64 64 //! a synonym (alias) for method ReSize(const BaseArray&) 65 inline void SetSize(const BaseArray& a, bool pack= true, bool fzero=true)65 inline void SetSize(const BaseArray& a, bool pack=false, bool fzero=true) 66 66 { ReSize(a, pack, fzero); } 67 67 void Realloc(int_4 ndim, sa_size_t * siz, sa_size_t step=1, bool force=false); … … 221 221 template <class T> inline TArray<T> operator + (const TArray<T>& a, T b) 222 222 {TArray<T> result; result.SetTemp(true); 223 a.Add (b, result); return result;}223 a.AddCst(b, result); return result;} 224 224 225 225 /*! \ingroup TArray \fn operator+(T,const TArray<T>&) … … 227 227 template <class T> inline TArray<T> operator + (T b,const TArray<T>& a) 228 228 {TArray<T> result; result.SetTemp(true); 229 a.Add (b, result); return result;}229 a.AddCst(b, result); return result;} 230 230 231 231 /*! \ingroup TArray \fn operator-(const TArray<T>&,T) … … 233 233 template <class T> inline TArray<T> operator - (const TArray<T>& a, T b) 234 234 {TArray<T> result; result.SetTemp(true); 235 a.Sub (b,result); return result;}235 a.SubCst(b,result); return result;} 236 236 237 237 /*! \ingroup TArray \fn operator-(T,const TArray<T>&) … … 239 239 template <class T> inline TArray<T> operator - (T b,const TArray<T>& a) 240 240 {TArray<T> result; result.SetTemp(true); 241 a.Sub (b,result,true); return result;}241 a.SubCst(b,result,true); return result;} 242 242 243 243 /*! \ingroup TArray \fn operator*(const TArray<T>&,T) … … 257 257 template <class T> inline TArray<T> operator / (const TArray<T>& a, T b) 258 258 {TArray<T> result; result.SetTemp(true); 259 a.Div (b,result); return result;}259 a.DivCst(b,result); return result;} 260 260 261 261 /*! \ingroup TArray \fn operator/(T,const TArray<T>&) … … 263 263 template <class T> inline TArray<T> operator / (T b, const TArray<T>& a) 264 264 {TArray<T> result; result.SetTemp(true); 265 a.Div (b, result, true); return result;}265 a.DivCst(b, result, true); return result;} 266 266 267 267 //////////////////////////////////////////////////////////////// … … 272 272 the original array elements. */ 273 273 template <class T> inline TArray<T> operator - (const TArray<T>& a) 274 {TArray<T> result; result. CloneOrShare(a); result.SetTemp(true);275 result.NegateElt(); return result;}274 {TArray<T> result; result.SetTemp(true); 275 a.NegateElt(result); return result;} 276 276 277 277 ////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.