40 template <
class nr_type_t>
42 abov = belo = diag = offdiag = rhs = NULL;
48 template <
class nr_type_t>
60 template <
class nr_type_t>
75 template <
class nr_type_t>
80 template <
class nr_type_t>
86 template <
class nr_type_t>
88 abov = belo = offdiag = v;
92 template <
class nr_type_t>
98 template <
class nr_type_t>
104 template <
class nr_type_t>
114 template <
class nr_type_t>
122 solve_ns_cyc ();
break;
124 solve_s_cyc ();
break;
137 template <
class nr_type_t>
139 d = al = diag->getData ();
140 f = ga = abov->getData ();
141 e = belo->getData ();
142 b =
c =
x = rhs->getData ();
143 int i,
n = diag->getSize ();
147 ga[0] = f[0] / al[0];
148 for (i = 1; i < n - 1; i++) {
149 al[
i] = d[
i] -
e[
i] * ga[i-1];
150 ga[
i] = f[
i] / al[
i];
152 al[n-1] = d[n-1] -
e[n-1] * ga[n-2];
156 for (i = 1; i <
n; i++) {
157 c[
i] = (
b[
i] -
e[
i] *
c[i-1]) / al[i];
162 for (i = n - 2; i >= 0; i--) {
163 x[
i] =
c[
i] - ga[
i] *
x[i+1];
176 template <
class nr_type_t>
178 d = al = diag->getData ();
179 f = ga = abov->getData ();
180 e = be = belo->getData ();
181 b =
x =
c = rhs->getData ();
182 int i,
n = diag->getSize ();
183 de =
new nr_type_t[
n];
184 ep =
new nr_type_t[
n];
188 ga[0] = f[0] / al[0];
189 de[0] =
e[0] / al[0];
190 for (i = 1; i < n - 2; i++) {
191 al[
i] = d[
i] -
e[
i] * ga[i-1];
192 ga[
i] = f[
i] / al[
i];
194 de[
i] = -be[
i] * de[i-1] / al[
i];
196 al[n-2] = d[n-2] -
e[n-2] * ga[n-3];
199 for (i = 3; i <
n; i++) {
200 ep[
i] = -ep[i-1] * ga[i-3];
202 ga[n-2] = (f[n-2] - be[n-2] * de[n-3]) / al[n-2];
203 be[n-1] =
e[n-1] - ep[n-1] * ga[n-3];
204 al[n-1] = d[n-1] - be[n-1] * ga[n-2];
205 for (i = 2; i <
n; i++) {
206 al[n-1] -= ep[
i] * de[i-2];
211 for (i = 1; i < n - 1; i++) {
212 c[
i] = (
b[
i] -
c[i-1] * be[
i]) / al[i];
214 c[n-1] =
b[n-1] - be[n-1] *
c[n-2];
215 for (i = 2; i <
n; i++) {
216 c[n-1] -= ep[
i] * c[i-2];
222 x[n-2] = c[n-2] - ga[n-2] *
x[n-1];
223 for (i = n - 3; i >= 0; i--) {
224 x[
i] = c[
i] - ga[
i] * x[i+1] - de[
i] * x[n-1];
240 template <
class nr_type_t>
242 d = al = diag->getData ();
243 f = ga = offdiag->getData ();
244 b = z =
x =
b = rhs->getData ();
246 int i,
n = diag->getSize ();
247 de =
new nr_type_t[
n];
253 for (i = 1; i < n - 1; i++) {
254 al[
i] = d[
i] - t * ga[i-1];
258 al[n-1] = d[n-1] - t * ga[n-2];
262 for (i = 1; i <
n; i++) {
263 z[
i] =
b[
i] - ga[i-1] * z[i-1];
265 for (i = 0; i <
n; i++) {
271 for (i = n-2; i >= 0; i--) {
272 x[
i] =
c[
i] - ga[
i] *
x[i+1];
287 template <
class nr_type_t>
289 d = al = diag->getData ();
290 f = ga = offdiag->getData ();
291 b =
c = z =
x = rhs->getData ();
293 int i,
n = diag->getSize ();
294 de =
new nr_type_t[
n];
300 de[0] = f[n-1] / al[0];
301 for (i = 1; i < n - 2; i++) {
302 al[
i] = d[
i] - t * ga[i-1];
303 de[
i] = -de[i-1] * t / al[
i];
307 al[n-2] = d[n-2] - t * ga[n-3];
308 ga[n-2] = (f[n-2] - t * de[n-3]) / al[n-2];
309 al[n-1] = d[n-1] - al[n-2] * ga[n-2] * ga[n-2];
310 for (i = 0; i < n - 2; i++) {
311 al[n-1] -= al[
i] * de[
i] * de[
i];
316 for (i = 1; i < n - 1; i++) {
317 z[
i] =
b[
i] - ga[i-1] * z[i-1];
319 z[n-1] =
b[n-1] - ga[n-2] * z[n-2];
320 for (i = 0; i < n - 2; i++) {
321 z[n-1] -= de[
i] * z[
i];
323 for (i = 0; i <
n; i++) {
329 x[n-2] =
c[n-2] - ga[n-2] *
x[n-1];
330 for (i = n - 3; i >= 0; i--) {
331 x[
i] =
c[
i] - ga[
i] * x[i+1] - de[
i] * x[n-1];