pymor.algorithms.basic¶
Module containing some basic but generic linear algebra algorithms.
Module Contents¶
Functions¶
Compare U and V for almost equality. |
|
Compute error between U and V relative to norm of U. |
|
Orthogonal projection of |
|
Return |
- pymor.algorithms.basic.almost_equal(U, V, product=None, sup_norm=False, rtol=1e-14, atol=1e-14)[source]¶
Compare U and V for almost equality.
The vectors of
UandVare compared in pairs for almost equality. Two vectorsuandvare considered almost equal iff||u - v|| <= atol + ||v|| * rtol.
The norm to be used can be specified via the
productorsup_normparameters.If the length of
Uresp.Vis 1, the single specified vector is compared to all vectors of the other array. Otherwise, the lengths of both indexed arrays have to agree.Parameters
- U, V
VectorArraysto be compared.- product
If specified, use this inner product
Operatorto compute the norm. Otherwise, the Euclidean norm is used.- sup_norm
If
True, use the sup norm to compute the error.- rtol
The relative tolerance.
- atol
The absolute tolerance.
- pymor.algorithms.basic.relative_error(U, V, product=None)[source]¶
Compute error between U and V relative to norm of U.
- pymor.algorithms.basic.project_array(U, basis, product=None, orthonormal=True)[source]¶
Orthogonal projection of
VectorArrayonto subspace.Parameters
- U
The
VectorArrayto project.- basis
VectorArrayof basis vectors for the subspace onto which to project.- product
Inner product
Operatorw.r.t. which to project.- orthonormal
If
True, the vectors inbasisare assumed to be orthonormal w.r.t.product.
Returns
The projected
VectorArray.
- pymor.algorithms.basic.contains_zero_vector(vector_array, rtol=None, atol=None)[source]¶
Return
Trueiff any vector in the array float_compares to 0s of the same dim.Parameters
- vector_array
a
VectorArrayimplementation- rtol
relative tolerance for float_cmp
- atol
absolute tolerance for float_cmp