Source
xxxxxxxxxx
virtual void updateWeights(Vector<Double> &data, Vector<Double> &model, Vector<Double> &weights);
//# DenoisingLib.h: This file contains the interface definition of the MSTransformManager class.
//#
//# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
//# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
//# Copyright (C) European Southern Observatory, 2011, All rights reserved.
//#
//# This library is free software; you can redistribute it and/or
//# modify it under the terms of the GNU Lesser General Public
//# License as published by the Free software Foundation; either
//# version 2.1 of the License, or (at your option) any later version.
//#
//# This library is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY, without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//# Lesser General Public License for more details.
//#
//# You should have received a copy of the GNU Lesser General Public
//# License along with this library; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
//# MA 02111-1307 USA
//# $Id: $
// casacore containers
// logger
// GSL includes
using namespace casacore;
namespace casa { //# NAMESPACE CASA - BEGIN
namespace denoising { //# NAMESPACE DENOISING - BEGIN
void GslVectorWrap(Vector<Double> casa_vector, gsl_vector &wrapper);
void GslMatrixWrap(Matrix<Double> &casa_matrix, gsl_matrix &wrapper, size_t ncols=0);
//////////////////////////////////////////////////////////////////////////
// GslLinearModelBase class
//////////////////////////////////////////////////////////////////////////
template<class T> class GslLinearModelBase
{
public:
GslLinearModelBase(size_t ndata, size_t ncomponents)
{
ndata_p = ndata;
ncomponents_p = ncomponents;
model_p.resize(ncomponents_p,ndata_p, false);
}
size_t ndata() {return ndata_p;}
size_t ncomponents() {return ncomponents_p;}
Matrix<T>& getModelMatrix(){return model_p;}
Vector<T> getModelAt(size_t pos){return model_p.column(pos);}
protected:
Matrix<T> model_p;
size_t ndata_p;
size_t ncomponents_p;
};
//////////////////////////////////////////////////////////////////////////
// GslPolynomialModel class
//////////////////////////////////////////////////////////////////////////
template<class T> class GslPolynomialModel : public GslLinearModelBase<T>
{
using GslLinearModelBase<T>::model_p;
using GslLinearModelBase<T>::ndata_p;
using GslLinearModelBase<T>::ncomponents_p;
public:
GslPolynomialModel(size_t ndata, size_t order) :
GslLinearModelBase<T>(ndata,order+1)
{
// Initialize model
model_p.row(0) = 1.0;
// Populate linear components