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
VectorArrayusing the modified Gram-Schmidt algorithm.- Parameters:
A – The
VectorArraywhich is to be orthonormalized.product – The inner product
Operatorw.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
atolare 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
offsetvectors 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
reiterateisTrue, 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 resultingVectorArrayis really orthonormal.check_tol – Tolerance for the check.
copy – If
True, create a copy ofAinstead of modifyingAin-place.
- Returns:
Q – The orthonormalized
VectorArray.R – The upper-triangular/trapezoidal matrix (if
return_RisTrue).
- 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
VectorArraysusing 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
VandWare almost orthogonal.- Parameters:
V – The
VectorArrayswhich are to be biorthonormalized.W – The
VectorArrayswhich are to be biorthonormalized.product – The inner product
Operatorw.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
reiterateisTrue, 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 resultingVectorArrayis really orthonormal.check_tol – Tolerance for the check.
copy – If
True, create a copy ofVandWinstead of modifyingVandWin-place.
- Returns:
The biorthonormalized |VectorArrays|.