# `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. If `None`, 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 the `offset + 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` is `True`, 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 resulting `VectorArray` is really orthonormal.

check_tol

Tolerance for the check.

copy

If `True`, create a copy of `A` instead of modifying `A` in-place.

Returns

Q

The orthonormalized `VectorArray`.

R

The upper-triangular/trapezoidal matrix (if `return_R` is `True`).

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 .

Note that this algorithm can be significantly less accurate compared to orthogonalization, in particular, when `V` and `W` are almost orthogonal.

Parameters

V, W

The `VectorArrays` which are to be biorthonormalized.

product

The inner product `Operator` w.r.t. which to biorthonormalize. If `None`, 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` is `True`, 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 resulting `VectorArray` is really orthonormal.

check_tol

Tolerance for the check.

copy

If `True`, create a copy of `V` and `W` instead of modifying `V` and `W` in-place.

Returns

The biorthonormalized `VectorArrays`.