Changeset 829 for trunk/src/MathUtils2.cc
- Timestamp:
- 02/17/06 15:04:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MathUtils2.cc
r452 r829 41 41 42 42 template <class T> 43 void mathutil::hanning(Vector<T>& out, Vector<Bool>& outmask, 44 const Vector<T>& in, const Vector<Bool>& mask, 43 void mathutil::hanning(Vector<T>& out, Vector<Bool>& outmask, 44 const Vector<T>& in, const Vector<Bool>& mask, 45 45 Bool relaxed, Bool ignoreOther) { 46 46 … … 54 54 vals[0] = 0.5; vals[1] = 0.0; vals[2] = 0.5; weights[5] = vals;// TFT 55 55 vals[0] = 0.0; vals[1] = 2.0/3.0; vals[2] = 1.0/3.0; weights[6] = vals;// FTT 56 vals[0] = 0.25; vals[1] = 0.5; vals[2] = 0.25; weights[7] = vals;// TTT 56 vals[0] = 0.25; vals[1] = 0.5; vals[2] = 0.25; weights[7] = vals;// TTT 57 57 // Chris' case 58 Vector<Bool> weighted(8); 58 Vector<Bool> weighted(8); 59 59 if (relaxed) { 60 60 weighted = False; … … 65 65 weighted[0] = False; 66 66 } 67 67 68 68 out.resize(in.nelements()); 69 69 outmask.resize(mask.nelements()); … … 91 91 } 92 92 } 93 94 template <class T>95 uInt mathutil::addEntry (Vector<T>& list, T val)96 {97 uInt n = list.nelements();98 if (n>0) {99 for (uInt i=0; i<n; i++) {100 if (near(list[i],val)) {101 return i;102 }103 }104 }105 //106 n++;107 list.resize(n,True);108 list(n-1) = val;109 return n-1;110 }111 112 template <class T>113 void mathutil::extendLastArrayAxis(casa::Array<T>& out,114 const casa::Array<T>& in,115 const T& initVal)116 {117 118 IPosition ipin = in.shape();119 IPosition ipout = ipin; // copy?120 // extend the axis by 1121 uInt axis = in.ndim()-1;122 ipout[axis] = ipin[axis]+1;123 out.resize(ipout);124 out = initVal;125 ArrayIterator<T> itout(out,axis);126 ReadOnlyArrayIterator<T> itin(in,axis);127 while ( !itin.pastEnd() ) {128 itout.array() = itin.array(); // copy vector by vector129 itin.next(); itout.next();130 }131 }
Note: See TracChangeset
for help on using the changeset viewer.