generateTestBandComplex¶
Generates test matrices of class \(E_c(n,c)\). Returns in band or band symmetric format.
Synopsis¶
generateTestBandComplex (n, c)
Required Arguments¶
- int
n
(Input) - Number of rows in the matrix.
- int
c
(Input) - Parameter used to alter structure, also the number of upper/lower codiagonals
Return Value¶
A vector of type f_complex. If no test was generated, then None
is
returned.
Optional Arguments¶
symmetricStorage
,- Return matrix stored in band symmetric format.
Description¶
We use the same nomenclature as Østerby and Zlatev (1982). Test matrices of
class \(E(n,c)\), to which we will generally refer to as E-matrices,
are symmetric, positive definite matrices of order n
with (6.0, 0.0) in
the diagonal, (-1.0, 1.0) in the superdiagonal and (-1.0, -1.0) subdiagonal.
In addition there are two bands at a distance c
from the diagonal with
(-1.0, 1.0) in the upper codiagonal and (-1.0, − 1.0) in the lower
codiagonal. More precisely:
\(a_{i,i}=6\) | 0 ≤ i < n |
\(a_{i,i+1}=-1-i\) | 0 ≤ i < n −1 |
\(a_{i+1,}i=-1-i\) | 0 ≤ i < n − 1 |
\(a_{i,i+c}=-1+i\) | 0 ≤ i < n − c |
\(a_{i+c,i}=-1+i\) | 0 ≤ i < n − c |
for any \(n\geq 3\) and \(2\leq c\leq n-1\).
E-matrices are similar to those obtained from the five-point formula in the discretization of elliptic partial differential equations.
By default, generateTestBandComplex
returns an E-matrix in band
storage mode. Option symmetricStorage
returns a matrix in band symmetric
storage mode.
Example¶
This example generates the following matrix and prints the result:
from pyimsl.math.generateTestBandComplex import generateTestBandComplex
from pyimsl.math.writeMatrixComplex import writeMatrixComplex
a = generateTestBandComplex(5, 3)
writeMatrixComplex("E(5, 3) in band storage: ", a)
Output¶
E(5, 3) in band storage:
1 2
1 ( 0, 0) ( 0, 0)
2 ( 0, 0) ( 0, 0)
3 ( 0, 0) ( -1, 1)
4 ( 6, 0) ( 6, 0)
5 ( -1, -1) ( -1, -1)
6 ( 0, 0) ( 0, 0)
7 ( -1, -1) ( -1, -1)
3 4
1 ( 0, 0) ( -1, 1)
2 ( 0, 0) ( 0, 0)
3 ( -1, 1) ( -1, 1)
4 ( 6, 0) ( 6, 0)
5 ( -1, -1) ( -1, -1)
6 ( 0, 0) ( 0, 0)
7 ( 0, 0) ( 0, 0)
5
1 ( -1, 1)
2 ( 0, 0)
3 ( -1, 1)
4 ( 6, 0)
5 ( 0, 0)
6 ( 0, 0)
7 ( 0, 0)