using namespace std;
#include "hsavitzkygolay.h"
#include "hludecomposer.h"
#include <assert.h>
#include "TMath.h"
#include <iostream>
#include <iomanip>
HSavitzkyGolay::HSavitzkyGolay(void) {
}
HSavitzkyGolay::~HSavitzkyGolay(void) {
}
void HSavitzkyGolay::calcCoefficients(HRtVector &out,
Int_t nl,Int_t nr,Int_t ld,Int_t m) {
assert( !(nl<0 || nr<0 || ld>m || nl+nr<m) );
Int_t ipj,j,k,mm;
Float_t fac,sum;
Int_t np = nl + nr +1;
HRtMatrix a(m+1,m+1);
HRtVector b(m+1);
HLuDecomposer lu;
out.resizeTo(np);
for (Int_t i=0; i<=m; i++) {
for (j=0; j<=m; j++) {
ipj = i+j;
sum = 0.;
for (k=-nl;k<=nr;k++) sum += TMath::Power(k,ipj);
a(i,j) = sum;
}
}
lu.decompose(a);
b.zero();
b(ld) = 1.;
lu.backSubstitute(b);
for (k=-nl; k<=nr; k++) {
sum = b(0);
fac = 1.;
for (mm=0;mm<m;mm++) sum += b(mm+1)*(fac *= k);
out(k+nl) = sum;
}
}
ClassImp(HSavitzkyGolay)
Last change: Sat May 22 13:13:06 2010
Last generated: 2010-05-22 13:13
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.