gram_schmidt
qoptcraft.math.gram_schmidt
Stable Gram-Schmidt algorithm.
gram_schmidt(basis)
Gram-Schmidt algorithm to orthonormalize a basis.
Note
It turns out that the normal Gram-Schmidt algorithm suffers from numerical instability: Round-off errors can accumulate and destroy orthogonality of the resulting vectors. We introduce the modified Gram-Schmidt procedure to help remedy this issue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
basis |
list[spmatrix]
|
basis to orthonormalize. |
required |
Returns:
Type | Description |
---|---|
list[spmatrix] | list[NDArray]
|
list[spmatrix]: orthonormalized basis. |
References
Algorithm can be found in https://www.math.uci.edu/~ttrogdon/105A/html/Lecture23.html
Source code in qoptcraft/math/gram_schmidt.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
gram_schmidt_generator(basis)
Gram-Schmidt algorithm to orthonormalize a basis.
Note
It turns out that the normal Gram-Schmidt algorithm suffers from numerical instability: Round-off errors can accumulate and destroy orthogonality of the resulting vectors. We introduce the modified Gram-Schmidt procedure to help remedy this issue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
basis |
list[spmatrix]
|
basis to orthonormalize. |
required |
Yields:
Type | Description |
---|---|
list[spmatrix] | list[NDArray]
|
NDArray or spmatrix: orthonormalized basis element. |
References
Algorithm can be found in https://www.math.uci.edu/~ttrogdon/105A/html/Lecture23.html
Source code in qoptcraft/math/gram_schmidt.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|