Index: trunk/npstat/stat/DiscreteGaussCopulaSmoother.cc =================================================================== --- trunk/npstat/stat/DiscreteGaussCopulaSmoother.cc (revision 679) +++ trunk/npstat/stat/DiscreteGaussCopulaSmoother.cc (revision 680) @@ -1,89 +1,91 @@ #include #include #include #include #include #include "npstat/nm/PtrBufferHandle.hh" #include "npstat/stat/DiscreteGaussCopulaSmoother.hh" #include "npstat/stat/DiscreteGauss1DBuilder.hh" static std::vector effectiveBwValues( const npstat::Matrix& bandwidthsToUse) { const unsigned nFilters = bandwidthsToUse.nRows(); const unsigned dim = bandwidthsToUse.nColumns(); std::vector bwvec(nFilters); for (unsigned ifilt=0; ifilt& bandwidthsToUse) : CVCopulaSmoother( nBinsInEachDim, dim, marginTolerance, nNormCycles, effectiveBwValues(bandwidthsToUse), cvCalc, assumeCvCalcOwnership, true) { typedef std::pair Key; typedef std::shared_ptr BuilderPtr; typedef std::map BuilderMap; const unsigned nFilters = bandwidthsToUse.nRows(); if (nFilters) { if (dim != bandwidthsToUse.nColumns()) throw std::invalid_argument( "In npstat::DescreteGaussCopulaSmoother constructor: " "incompatible matrix of polynomial degrees"); if (bandwidthsToUse.minValue() < 0.0) throw std::invalid_argument( "In npstat::DescreteGaussCopulaSmoother constructor: " "all bandwidth values must be nonnegative"); // Generate all filters. Making "DiscreteGauss1DBuilder" // objects is relatively expensive, so we will memoize // them in the hope that they can be reused. BuilderMap bmap; for (unsigned ifilt=0; ifilt f1d(dim, 0); Private::PtrBufferHandle handle(&f1d[0], dim); for (unsigned idim=0; idimsecond)); f1d[idim] = new LocalPolyFilter1D(0, 0, *builder, nbins); } // Generate the filter Filter* f = new SequentialPolyFilterND(&f1d[0], dim, true); handle.release(); this->setFilter(ifilt, f); } } } }