"git@git.fmrib.ox.ac.uk:fsl/pytreat-practicals-2020.git" did not exist on "4216287ca00b6aa0ff6bf585dce14a4248f04522"
Newer
Older
/* cspline
Cubic spline fitting and interpolation
Tim Behrens, FMRIB Image Analysis Group
Copyright (C) 1999-2000 University of Oxford */
/* CCOPYRIGHT */
#if !defined(__cspline_h)
#define __cspline_h
#include <string>
#include <iostream>
#include <fstream>
#include "newmatap.h"
#include "newmatio.h"
#define WANT_STREAM
#define WANT_MATH
using namespace NEWMAT;
using namespace std;
///////////////////////////////////////////////////////
namespace MISCMATHS {
class Cspline{
public:
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Cspline(ColumnVector& pnodes,ColumnVector& pvals):
nodes(pnodes),
vals(pvals),
n(nodes.Nrows())
{
fit();
fitted=true;
}
Cspline(ColumnVector& pnodes, Matrix& pcoefs) :
nodes(pnodes),
coefs(pcoefs),
n(nodes.Nrows())
{ fitted=true;}
~Cspline(){
fitted=false;
};
void set(ColumnVector& pnodes,ColumnVector& pvals);
void set(ColumnVector& pnodes, Matrix& pcoefs);
void fit();
float interpolate(float xx) const;
float interpolate(float xx,int ind) const;
ColumnVector interpolate(const ColumnVector& x) const;
ColumnVector interpolate(const ColumnVector& x, const ColumnVector& indvec) const;
protected:
bool fitted;
ColumnVector nodes;
ColumnVector vals;
Matrix coefs;
int n;
void diff(const ColumnVector& x, ColumnVector& dx );
};
}
#endif