The topic
Calculating spline curves requires the solution of linear equation systems, where the number of equations is close to the number of grid points. For cubic splines the matrices of the corresponding equation systems are occupied only along the diagonal and the subdiagonal on both sides. For such systems, simple solutions are common.
For higher order splinefunktionen or other border condition problems it may prove useful to be able to solve systems with two subdiagonals on each side (2-2-band matrices). Such a solution is derived and demonstrated below.
LU-Decomposition
The solution of the equation system is based upon the LU decomposition and the fact - the proof being omitted in this context - that the decomposition is again a 2-2 band matrix.
Let's consider an initial2-2 band matrix A and take a look at the first two steps of the decomposition:
Step 1
The first step transforms matrix A = A(1) into matrix A(2)
Which elements are modified and how?
- Row 1 remains unaltered
- Column 1 from row 2 results by dividing the elements a21...an1 by a11, and given the band structure, only a21 and a31 are considered, the others are zero
- The submatrix a(2)22 bis a(2)33 results by subtracting the dyadic vector product of vektors [a(2)21, a(2)31]T mit [a(1)12, a(1)13] from [[a(1)22, a(1)23], [a(1)32, a(1)33]]
a(2)22 = a(1)22 – (a(1)12a(1)21)/a(1)11 usw. - Column 4, coloured in orange in the image, also results from column 4 by subtraction of the product of the column 1 vector with element a14. The latter contains zero, leaving column 4 unaltered, and the same holds for the columns up to n.
- Analog for row 4, coloured in yellow, und the other rows down to n
In summary, only the elemente of sub matrix A(1)2..3,1..3 are modified.
Step 2
Step 2 transforms matrix A(2) into A(3) , and again only the elemetns in a 2x3 block are altered.
Which elements are modified and how?
- Row 2 remains unaltered
- Column 2, elements a(3)32 and a(3)42 result from a(2)32 und a(2)42 by dividing by a(2)22 from step 1. Both manipulations need to be contained in the formula:
a(3)32 = (a(1)32 – (a(2)12a(2)31)/a(2)11)/a(2)22) usw. - Sub matrix a(3)33 to a(3)44 results by subtracting the dyadic vektor produkts of vektors [a(3)32, a(3)42]T and [a(2)23, a(2)24] from [[a(2)33, a(2)34], [a(2)43, a(2)44]]
Element a(3)33 needs special mention, obtained from a(2)33. Element a(2)33 cannot be stored intermediately, the calculation formula thus includes Step 1 of a(1)33 into a(2)33. For the elements in row and column 4 the input values can be taken from the original matrix.
For the remaining steps k the input values are available either from A(k-1), that is in the calculation range, or from the originalmatrix A.
Example
Equation system Ax - b = 0
Matrix A and condition vector b
The calculation schema implemented holds up to 20 equations, also less. No pivot elements are searched. In the input range of A columns a2 and a1 are the lower secondary diagonals, columns c1 and c2 the upper ones.
LU decomposition and vektor y
The LU decomposition of A in a format similar to the memory saving convolution of the full matrix form: The L-Matrix, designated M bezeichnet, has only ones in the diagonal which are not stored but contained in the calculation formulae.
Solution vector x
The solution of the equation system.
Comments :