-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterpolation.cpp
More file actions
73 lines (64 loc) · 2.25 KB
/
Copy pathinterpolation.cpp
File metadata and controls
73 lines (64 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
//---------------------------------------------------------------------------
#pragma hdrstop
#include <math.h>
#include "interpolation.h"
using namespace std;
namespace Aloschil
{
//----------------------------------------------------------------------------
// This is a protected API. Refer to matrix.h for details.
//----------------------------------------------------------------------------
Matrix Spline::T(unsigned int n,double t)
{
Matrix result;
result.setSize(n,1);
for(unsigned int i=0;i<n+1;++i)
{
result[i]=pow(double(i),t);
}
return result;
}
//----------------------------------------------------------------------------
// This is a protected API. Refer to matrix.h for details.
//----------------------------------------------------------------------------
Matrix Spline::V(unsigned int n,double k)
{
Matrix result;
result.setSize(n,1);
result[0]=0;
for(unsigned int i=1;i<n+1;++i)
{
result[i] =double(i) * pow(k,double(i-1));
}
return result;
}
//----------------------------------------------------------------------------
// This is a protected API. Refer to matrix.h for details.
//----------------------------------------------------------------------------
Matrix Spline::Q(unsigned int N)
{
Matrix result;
result.setSize(4*N,4*N);
for(unsigned int i=0;i<N;++i)
{
for(unsigned int j=0;j<3;++j)
{
result.at(i*4,i*3 + j) = 1;
for(unsigned int k=1;k<4;++k)
{
result.at(i*4 + k,i*3 + j) = pow(double(j),double(k));
}
}
}
return result;
}
//----------------------------------------------------------------------------
// This is a protected API. Refer to matrix.h for details.
//----------------------------------------------------------------------------
void Spline::initializeWith(vector<Matrix> U)
{
Q(3).PrintToFile("Q3.mtx");
}
}
//---------------------------------------------------------------------------
#pragma package(smart_init)