pymor.algorithms.gram_schmidt
¶
Module Contents¶
- pymor.algorithms.gram_schmidt.gram_schmidt(A, product=None, return_R=False, atol=1e-13, rtol=1e-13, offset=0, reiterate=True, reiteration_threshold=0.9, check=True, check_tol=0.001, copy=True)[source]¶
Orthonormalize a
VectorArray
using the modified Gram-Schmidt algorithm.Parameters
- A
The
VectorArray
which is to be orthonormalized.- product
The inner product
Operator
w.r.t. which to orthonormalize. IfNone
, the Euclidean product is used.- return_R
If
True
, the R matrix from QR decomposition is returned.- atol
Vectors of norm smaller than
atol
are removed from the array.- rtol
Relative tolerance used to detect linear dependent vectors (which are then removed from the array).
- offset
Assume that the first
offset
vectors are already orthonormal and start the algorithm at theoffset + 1
-th vector.- reiterate
If
True
, orthonormalize again if the norm of the orthogonalized vector is much smaller than the norm of the original vector.- reiteration_threshold
If
reiterate
isTrue
, re-orthonormalize if the ratio between the norms of the orthogonalized vector and the original vector is smaller than this value.- check
If
True
, check if the resultingVectorArray
is really orthonormal.- check_tol
Tolerance for the check.
- copy
If
True
, create a copy ofA
instead of modifyingA
in-place.
Returns
- Q
The orthonormalized
VectorArray
.- R
The upper-triangular/trapezoidal matrix (if
return_R
isTrue
).
- pymor.algorithms.gram_schmidt.gram_schmidt_biorth(V, W, product=None, reiterate=True, reiteration_threshold=0.1, check=True, check_tol=0.001, copy=True)[source]¶
Biorthonormalize a pair of
VectorArrays
using the biorthonormal Gram-Schmidt process.See Algorithm 1 in [BKohlerS11].
Note that this algorithm can be significantly less accurate compared to orthogonalization, in particular, when
V
andW
are almost orthogonal.Parameters
- V, W
The
VectorArrays
which are to be biorthonormalized.- product
The inner product
Operator
w.r.t. which to biorthonormalize. IfNone
, the Euclidean product is used.- reiterate
If
True
, orthonormalize again if the norm of the orthogonalized vector is much smaller than the norm of the original vector.- reiteration_threshold
If
reiterate
isTrue
, re-orthonormalize if the ratio between the norms of the orthogonalized vector and the original vector is smaller than this value.- check
If
True
, check if the resultingVectorArray
is really orthonormal.- check_tol
Tolerance for the check.
- copy
If
True
, create a copy ofV
andW
instead of modifyingV
andW
in-place.
Returns
The biorthonormalized
VectorArrays
.