87 assert (y.
getSize () == i && i >= 3);
91 for (i = 0; i <=
n; i++) {
99 assert (y.
getSize () == i && i >= 3);
103 for (i = 0; i <=
n; i++) {
115 for (i = 0; i <=
n; i++) {
125 f0 =
new nr_double_t[
n+1];
127 x =
new nr_double_t[
n+1];
129 if (
f1) {
delete[]
f1;
f1 = NULL; }
130 if (
f2) {
delete[]
f2;
f2 = NULL; }
131 if (
f3) {
delete[]
f3;
f3 = NULL; }
139 nr_double_t *
h =
new nr_double_t[
n+1];
140 for (i = 0; i <
n; i++) {
141 h[
i] =
x[i+1] -
x[
i];
152 nr_double_t * b =
new nr_double_t[n+1];
153 for (i = 1; i <
n; i++) {
154 nr_double_t _n =
f0[i+1] * h[i-1] -
f0[
i] * (h[
i] + h[i-1]) +
156 nr_double_t _d = h[i-1] * h[
i];
165 b[0] = 3 * ((
f0[1] -
f0[0]) / h[0] -
d0);
166 b[
n] = 3 * (
dn - (
f0[
n] -
f0[n-1]) / h[n-1]);
169 nr_double_t * u =
new nr_double_t[n+1];
175 u[0] = h[0] / (2 * h[0]);
176 z[0] = b[0] / (2 * h[0]);
179 for (i = 1; i <
n; i++) {
180 nr_double_t p = 2 * (h[
i] + h[i-1]) - h[i-1] * u[i-1];
182 z[
i] = (b[
i] - z[i-1] * h[i-1]) / p;
187 nr_double_t p = h[n-1] * (2 - u[n-1]);
188 z[
n] = (b[
n] - z[n-1] * h[n-1]) / p;
197 for (i = n - 1; i >= 0; i--) {
199 f1[
i] = (
f0[i+1] -
f0[
i]) / h[i] - h[i] * (f2[i+1] + 2 * f2[i]) / 3;
200 f3[
i] = (f2[i+1] - f2[
i]) / (3 * h[i]);
216 nr_double_t * z =
new nr_double_t[n+1];
218 nr_double_t
B = h[0] + h[1];
219 nr_double_t
A = 2 *
B;
220 nr_double_t b[2],
det;
221 b[0] = 3 * ((
f0[2] -
f0[1]) / h[1] - (
f0[1] -
f0[0]) / h[0]);
222 b[1] = 3 * ((
f0[1] -
f0[2]) / h[0] - (
f0[2] -
f0[1]) / h[1]);
224 z[1] = ( A * b[0] - B * b[1]) / det;
225 z[2] = (-B * b[0] + A * b[1]) / det;
234 for (i = 0; i < n - 1; i++) {
236 d(i) = 2 * (h[i+1] + h[
i]);
237 b(i) = 3 * ((
f0[i+2] -
f0[i+1]) / h[i+1] - (
f0[i+1] -
f0[i]) / h[
i]);
240 d(i) = 2 * (h[0] + h[
i]);
241 b(i) = 3 * ((
f0[1] -
f0[i+1]) / h[0] - (
f0[i+1] -
f0[i]) / h[
i]);
250 f1 =
new nr_double_t[n+1];
253 for (i = n - 1; i >= 0; i--) {
254 f1[
i] = (
f0[i+1] -
f0[
i]) / h[i] - h[i] * (z[i+1] + 2 * z[i]) / 3;
255 f3[
i] = (z[i+1] - z[
i]) / (3 * h[i]);
266 int half, len = last - first;
267 nr_double_t * centre;
278 len = len - half - 1;
287 #ifndef PERIOD_DISABLED
290 nr_double_t period =
x[
n] -
x[0];
291 while (t > x[
n]) t -= period;
292 while (t < x[0]) t += period;
297 nr_double_t y0, y1, y2;
299 nr_double_t dx = t -
x[0];
300 y0 =
f0[0] + dx *
f1[0];
302 return poly (t, y0, y1);
305 int i = here -
x - 1;
306 nr_double_t dx = t - x[
i];
310 y1 =
f1[
i] + dx * (2 *
f2[
i] + 3 * dx *
f3[
i]);
312 y2 = 2 *
f2[
i] + 6 * dx *
f3[
i];
313 return poly (t, y0, y1, y2);
poly evaluate(nr_double_t)
void setDiagonal(tvector< nr_type_t > *)
void setData(nr_type_t *, int)
matrix real(matrix a)
Real part matrix.
void vectors(qucs::vector, qucs::vector)
nr_complex_t det(matrix a)
Compute determinant of the given matrix.
nr_double_t * upper_bound(nr_double_t *, nr_double_t *, nr_double_t)
void setOffDiagonal(tvector< nr_type_t > *)
void logprint(int level, const char *format,...)
void setRHS(tvector< nr_type_t > *)