pymor.algorithms.basic
¶
Module containing some basic but generic linear algebra algorithms.
Module Contents¶
- 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
U
andV
are compared in pairs for almost equality. Two vectorsu
andv
are considered almost equal iff||u - v|| <= atol + ||v|| * rtol.
The norm to be used can be specified via the
product
orsup_norm
parameters.If the length of
U
resp.V
is 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
VectorArrays
to be compared.- product
If specified, use this inner product
Operator
to 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.contains_zero_vector(vector_array, rtol=None, atol=None)[source]¶
Return
True
iff any vector in the array float_compares to 0s of the same dim.Parameters
- vector_array
a
VectorArray
implementation- rtol
relative tolerance for float_cmp
- atol
absolute tolerance for float_cmp
- pymor.algorithms.basic.project_array(U, basis, product=None, orthonormal=True)[source]¶
Orthogonal projection of
VectorArray
onto subspace.Parameters
- U
The
VectorArray
to project.- basis
VectorArray
of basis vectors for the subspace onto which to project.- product
Inner product
Operator
w.r.t. which to project.- orthonormal
If
True
, the vectors inbasis
are assumed to be orthonormal w.r.t.product
.
Returns
The projected
VectorArray
.