npplus.solveper module¶
Periodic variants of solve_banded.
Adds corner elements to banded matrix connecting final elements of x to first equations and first elements of x to final equations.
Also include solves_banded, a variant of solveh_banded that does not require a positive definite symmetric matrix.
- solve_periodic(l_and_u, ab, b, overwrite_ab=False, overwrite_b=False, check_finite=True)[source]¶
Variant of solve_banded which includes matrix corner elements.
Layout of banded matrix ab is:
ab[u+i-j, j] == a[i, j] ab[i, j] == a[i+j-u, j]
Example (l,u)=(2,1) for 6x6:
A50 a01 a12 a23 a34 a45 a00 a11 a22 a33 a44 a55 a10 a21 a32 a43 a54 A05 a20 a31 a42 a53 A04 A15 A50 0 0 x x x copy last row before first a00 a01 0 0 A04 A05 <-- matrix begins here a10 a11 a12 0 0 A15 a20 a21 a22 a23 0 0 0 a31 a32 a33 a34 0 0 0 a42 a43 a44 a45 A50 0 0 a53 a54 a55 <-- matrix ends here x x 0 0 A04 A05 copy first two rows after last x x x 0 0 A15
See also
scipy.linalg.solve_banded
for description of parameters and returns
Notes
Outline of the algorithm:
Solve ab without the corner elements using solve_banded.
Solve ab without corner elements for
b=0
except 1 for each of the first u equations and last l equations, a total ofu+l
solves with one more call to solve_banded.Construct a dense
u+l
square matrix and solve to find the linear combination of the results of (2) which compensates for the corner elements omitted in (1).
- solves_banded(ab, b, overwrite_ab=False, overwrite_b=False, lower=False, check_finite=True)[source]¶
Variant of solve_banded for arbitrary symmetric matrices.
Upper form unless keyword lower is false. Upper and lower forms are the same as scipy.linalg.solveh_banded, except input to solves_periodic need not be positive definite, and the entire ab array is used:
A40 A51 a02 a13 a24 a35 upper form A50 a01 a12 a23 a34 a45 a00 a11 a22 a33 a44 a55 a00 a11 a22 a33 a44 a55 lower form a10 a21 a32 a43 a54 A05 a20 a31 a42 a53 A04 A15
See also
scipy.linalg.solveh_banded
for description of parameters and returns
Notes
Use solveh_banded if the matrix is known to be positive definite.
- solves_periodic(ab, b, overwrite_ab=False, overwrite_b=False, lower=False, check_finite=True)[source]¶
Variant of solve_periodic for symmetric matrices.
Upper form unless keyword lower is false. Upper and lower forms are the same as scipy.linalg.solveh_banded, except input to solves_periodic need not be positive definite, and the entire ab array is used:
A40 A51 a02 a13 a24 a35 upper form A50 a01 a12 a23 a34 a45 a00 a11 a22 a33 a44 a55 a00 a11 a22 a33 a44 a55 lower form a10 a21 a32 a43 a54 A05 a20 a31 a42 a53 A04 A15
See also
scipy.linalg.solveh_banded
for description of parameters and returns
solve_periodic
for more details