Changeset 1706


Ignore:
Timestamp:
02/18/10 21:53:16 (15 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes (CAS-1800)

Ready to Release: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sdfit

Description: bug fix for Lorentzian profile class


Location:
branches/alma/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/src/Lorentzian1D.h

    r1700 r1706  
    3333#include "Lorentzian1DParam.h"
    3434#include <scimath/Functionals/Function1D.h>
    35 //#include <scimath/Mathematics/AutoDiff.h>
    36 //#include <scimath/Mathematics/AutoDiffMath.h>
     35#include <scimath/Mathematics/AutoDiff.h>
     36#include <scimath/Mathematics/AutoDiffMath.h>
    3737
    3838namespace casa { //# NAMESPACE CASA - BEGIN
     
    176176  // <group>
    177177  virtual Function<T> *clone() const { return new Lorentzian1D<T>(*this); };
    178 //  virtual Function<typename FunctionTraits<T>::DiffType> *cloneAD() const {
    179 //    return new Lorentzian1D<typename FunctionTraits<T>::DiffType>(*this); };
    180 //  virtual Function<typename FunctionTraits<T>::BaseType> *cloneNonAD() const {
    181 //    return new Lorentzian1D<typename FunctionTraits<T>::BaseType>(*this); };
     178  virtual Function<typename FunctionTraits<T>::DiffType> *cloneAD() const {
     179    return new Lorentzian1D<typename FunctionTraits<T>::DiffType>(*this); };
     180  virtual Function<typename FunctionTraits<T>::BaseType> *cloneNonAD() const {
     181    return new Lorentzian1D<typename FunctionTraits<T>::BaseType>(*this); };
    182182  // </group>
    183183
     
    193193
    194194
    195 //#define Lorentzian1D_PS Lorentzian1D
    196 //
    197 //// <summary> Partial specialization of Lorentzian1D for <src>AutoDiff</src>
    198 //// </summary>
    199 //
    200 //// <synopsis>
    201 //// <note role=warning> The name <src>Lorentzian1D_PS</src> is only for cxx2html
    202 //// documentation problems. Use <src>Lorentzian1D</src> in your code.</note>
    203 //// </synopsis>
    204 //
    205 //template <class T> class Lorentzian1D_PS<AutoDiff<T> > :
    206 //public Lorentzian1DParam<AutoDiff<T> >
    207 //{
    208 //public:
    209 //  //# Constructors
    210 //  // Constructs one dimensional Lorentzians.
    211 //  // <group>
    212 //  Lorentzian1D_PS() : Lorentzian1DParam<AutoDiff<T> >() {};
    213 //  explicit Lorentzian1D_PS(const AutoDiff<T> &height) :
    214 //    Lorentzian1DParam<AutoDiff<T> >(height) {};
    215 //  Lorentzian1D_PS(const AutoDiff<T> &height, const AutoDiff<T> &center) :
    216 //    Lorentzian1DParam<AutoDiff<T> >(height, center) {};
    217 //  Lorentzian1D_PS(const AutoDiff<T> &height, const AutoDiff<T> &center,
    218 //                const AutoDiff<T> &width) :
    219 //    Lorentzian1DParam<AutoDiff<T> >(height, center, width) {};
    220 //  // </group>
    221 //
    222 //  // Copy constructor (deep copy)
    223 //  // <group>
    224 //  Lorentzian1D_PS(const Lorentzian1D_PS &other) :
    225 //    Lorentzian1DParam<AutoDiff<T> >(other) {};
    226 //  template <class W>
    227 //  Lorentzian1D_PS(const Lorentzian1D_PS<W> &other) :
    228 //    Lorentzian1DParam<AutoDiff<T> >(other) {};
    229 //  // </group>
    230 //
    231 //  // Copy assignment (deep copy)
    232 //  Lorentzian1D_PS<AutoDiff<T> > &
    233 //    operator=(const Lorentzian1D_PS<AutoDiff<T> > &other) {
    234 //    Lorentzian1DParam<AutoDiff<T> >::operator=(other); return *this; };
    235 //   
    236 //  // Destructor
    237 //  virtual ~Lorentzian1D_PS() {};
    238 //
    239 //  //# Operators   
    240 //  // Evaluate the Lorentzian and its derivatives at <src>x</src>.
    241 //  // <group>
    242 //  virtual AutoDiff<T> eval(typename Function<AutoDiff<T> >::FunctionArg x) const;
    243 //  // </group>
    244 //
    245 //  //# Member functions
    246 //  // Return a copy of this object from the heap. The caller is responsible
    247 //  // for deleting this pointer.
    248 //  // <group>
    249 //  virtual Function<AutoDiff<T> > *clone() const {
    250 //    return new Lorentzian1D<AutoDiff<T> >(*this); };
    251 //  virtual Function<typename FunctionTraits<AutoDiff<T> >::DiffType>
    252 //    *cloneAD() const {
    253 //    return new Lorentzian1D<typename FunctionTraits<AutoDiff<T> >::DiffType>
    254 //      (*this); };
    255 //  virtual Function<typename FunctionTraits<AutoDiff<T> >::BaseType>
    256 //    *cloneNonAD() const {
    257 //    return new Lorentzian1D<typename FunctionTraits<AutoDiff<T> >::BaseType>
    258 //      (*this); };
    259 //  // </group>
    260 //
    261 //  //# Make members of parent classes known.
    262 //protected:
    263 //  using Lorentzian1DParam<AutoDiff<T> >::param_p;
    264 //public:
    265 //  using Lorentzian1DParam<AutoDiff<T> >::HEIGHT;
    266 //  using Lorentzian1DParam<AutoDiff<T> >::CENTER;
    267 //  using Lorentzian1DParam<AutoDiff<T> >::WIDTH;
    268 //  using Lorentzian1DParam<AutoDiff<T> >::fwhm2int;
    269 //};
    270 //
    271 //#undef Lorentzian1D_PS
     195#define Lorentzian1D_PS Lorentzian1D
     196
     197// <summary> Partial specialization of Lorentzian1D for <src>AutoDiff</src>
     198// </summary>
     199
     200// <synopsis>
     201// <note role=warning> The name <src>Lorentzian1D_PS</src> is only for cxx2html
     202// documentation problems. Use <src>Lorentzian1D</src> in your code.</note>
     203// </synopsis>
     204
     205template <class T> class Lorentzian1D_PS<AutoDiff<T> > :
     206public Lorentzian1DParam<AutoDiff<T> >
     207{
     208public:
     209  //# Constructors
     210  // Constructs one dimensional Lorentzians.
     211  // <group>
     212  Lorentzian1D_PS() : Lorentzian1DParam<AutoDiff<T> >() {};
     213  explicit Lorentzian1D_PS(const AutoDiff<T> &height) :
     214    Lorentzian1DParam<AutoDiff<T> >(height) {};
     215  Lorentzian1D_PS(const AutoDiff<T> &height, const AutoDiff<T> &center) :
     216    Lorentzian1DParam<AutoDiff<T> >(height, center) {};
     217  Lorentzian1D_PS(const AutoDiff<T> &height, const AutoDiff<T> &center,
     218                  const AutoDiff<T> &width) :
     219    Lorentzian1DParam<AutoDiff<T> >(height, center, width) {};
     220  // </group>
     221
     222  // Copy constructor (deep copy)
     223  // <group>
     224  Lorentzian1D_PS(const Lorentzian1D_PS &other) :
     225    Lorentzian1DParam<AutoDiff<T> >(other) {};
     226  template <class W>
     227  Lorentzian1D_PS(const Lorentzian1D_PS<W> &other) :
     228    Lorentzian1DParam<AutoDiff<T> >(other) {};
     229  // </group>
     230
     231  // Copy assignment (deep copy)
     232  Lorentzian1D_PS<AutoDiff<T> > &
     233    operator=(const Lorentzian1D_PS<AutoDiff<T> > &other) {
     234    Lorentzian1DParam<AutoDiff<T> >::operator=(other); return *this; };
     235   
     236  // Destructor
     237  virtual ~Lorentzian1D_PS() {};
     238
     239  //# Operators   
     240  // Evaluate the Lorentzian and its derivatives at <src>x</src>.
     241  // <group>
     242  virtual AutoDiff<T> eval(typename Function<AutoDiff<T> >::FunctionArg x) const;
     243  // </group>
     244
     245  //# Member functions
     246  // Return a copy of this object from the heap. The caller is responsible
     247  // for deleting this pointer.
     248  // <group>
     249  virtual Function<AutoDiff<T> > *clone() const {
     250    return new Lorentzian1D<AutoDiff<T> >(*this); };
     251  virtual Function<typename FunctionTraits<AutoDiff<T> >::DiffType>
     252    *cloneAD() const {
     253    return new Lorentzian1D<typename FunctionTraits<AutoDiff<T> >::DiffType>
     254      (*this); };
     255  virtual Function<typename FunctionTraits<AutoDiff<T> >::BaseType>
     256    *cloneNonAD() const {
     257    return new Lorentzian1D<typename FunctionTraits<AutoDiff<T> >::BaseType>
     258      (*this); };
     259  // </group>
     260
     261  //# Make members of parent classes known.
     262protected:
     263  using Lorentzian1DParam<AutoDiff<T> >::param_p;
     264public:
     265  using Lorentzian1DParam<AutoDiff<T> >::HEIGHT;
     266  using Lorentzian1DParam<AutoDiff<T> >::CENTER;
     267  using Lorentzian1DParam<AutoDiff<T> >::WIDTH;
     268  using Lorentzian1DParam<AutoDiff<T> >::fwhm2int;
     269};
     270
     271#undef Lorentzian1D_PS
    272272
    273273
     
    276276#ifndef CASACORE_NO_AUTO_TEMPLATES
    277277#include "Lorentzian1D.tcc"
     278#include "Lorentzian1D2.tcc"
    278279#endif //# CASACORE_NO_AUTO_TEMPLATES
    279280#endif
  • branches/alma/src/Lorentzian1DParam.h

    r1700 r1706  
    161161  //# Member functions
    162162  // Give name of function
    163   virtual const String &name() const { static String x("gaussian1d");
     163  virtual const String &name() const { static String x("lorentzian1d");
    164164    return x; };
    165165
  • branches/alma/src/Scantable.cpp

    r1703 r1706  
    708708    Vector<Float> spcs = specCol_(i);
    709709    Vector<uChar> flgs = flagsCol_(i);
    710     if (spcs.nelements() != nchan()) {
     710    uInt nchannel = nchan();
     711    if (spcs.nelements() != nchannel) {
    711712      throw(AipsError("Data has incorrect number of channels"));
    712713    }
     
    716717    }
    717718    if (clipoutside) {
    718       for (uInt j = 0; j < nchan(); ++j) {
     719      for (uInt j = 0; j < nchannel; ++j) {
    719720        Float spc = spcs(j);
    720721        if ((spc >= uthres) || (spc <= dthres)) {
     
    723724      }
    724725    } else {
    725       for (uInt j = 0; j < nchan(); ++j) {
     726      for (uInt j = 0; j < nchannel; ++j) {
    726727        Float spc = spcs(j);
    727728        if ((spc < uthres) && (spc > dthres)) {
Note: See TracChangeset for help on using the changeset viewer.