Changeset 139 for trunk/src


Ignore:
Timestamp:
12/24/04 13:21:30 (20 years ago)
Author:
mar637
Message:

Added inSitu version of multiply/scale

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r130 r139  
    204204}
    205205
     206void SDMath::multiplyInSitu(SDMemTable* in, Float factor) {
     207  SDMemTable* sdmt = new SDMemTable(*in);
     208  Table t = sdmt->table();
     209  ArrayColumn<Float> spec(t,"SPECTRA"); 
     210  for (uInt i=0; i < t.nrow(); i++) {
     211    MaskedArray<Float> marr(sdmt->rowAsMaskedArray(i));
     212    marr *= factor;
     213    spec.put(i, marr.getArray());
     214  }
     215  in = sdmt;
     216  delete sdmt;sdmt=0;
     217}
     218
    206219CountedPtr<SDMemTable>
    207220SDMath::multiply(const CountedPtr<SDMemTable>& in, Float factor)
  • trunk/src/SDMath.h

    r130 r139  
    4646  casa::CountedPtr<SDMemTable> quotient(const casa::CountedPtr<SDMemTable>& on,
    4747                                         const casa::CountedPtr<SDMemTable>& off);
     48  void multiplyInSitu(SDMemTable* in, casa::Float factor);
     49
    4850  casa::CountedPtr<SDMemTable> multiply(const casa::CountedPtr<SDMemTable>& in,
    4951                                  casa::Float factor);
  • trunk/src/SDMathWrapper.h

    r131 r139  
    5757    return SDMemTableWrapper(SDMath::multiply(in.getCP(),factor));
    5858  }
     59  void scaleInSitu(SDMemTableWrapper& in, casa::Float factor) {
     60    SDMemTable* sdmt = in.getPtr();
     61    SDMath::multiplyInSitu(in.getPtr(),factor);
     62  }
    5963
    6064  SDMemTableWrapper add(const SDMemTableWrapper& in,
Note: See TracChangeset for help on using the changeset viewer.