pymor.algorithms.symplectic
¶
Module Contents¶
- class pymor.algorithms.symplectic.SymplecticBasis(E=None, F=None, phase_space=None, check_symplecticity=True)[source]¶
Bases:
pymor.core.base.BasicObject
A canonically-symplectic basis based on pairs of basis vectors (e_i, f_i).
Is either initialized (a) with a pair of
VectorArrays
E and F or (b) with aVectorSpace
. The basis vectors are each contained in aVectorArray
E = (e_i)_{i=1}^n F = (f_i)_{i=1}^n
such that
V = [E, F].
Parameters
- E
A
VectorArray
that represents the first half of basis vectors. May be none if phase_space is specified.- F
A
VectorArray
that represents the second half of basis vectors. May be none if phase_space is specified.- phase_space
A
VectorSpace
that represents the phase space. May be none if E and F are specified.- check_symplecticity
Flag, whether to check symplecticity of E and F in the constructor (if these are not None). Default is True.
Methods
Append another
SymplecticBasis
.Extend the
SymplecticBasis
with vectors from aVectorArray
.Generate
SymplecticBasis
fromVectorArray
.Convert to
VectorArray
.Compute transposed symplectic inverse J_{2N}.T * V * J_{2n}.
- append(other, remove_from_other=False, check_symplecticity=True)[source]¶
Append another
SymplecticBasis
.- other
The
SymplecticBasis
to append.- remove_from_other
Flag, whether to remove vectors from other.
- check_symplecticity
Flag, whether to check symplecticity of E and F in the constructor (if these are not None). Default is True.
- extend(U, method='svd_like', modes=2, product=None)[source]¶
Extend the
SymplecticBasis
with vectors from aVectorArray
.Parameters
- U
The vectors used for the extension as
VectorArray
.- method
- The method used for extension. Available options are
(‘svd_like’, ‘complex_svd’, ‘symplectic_gram_schmidt’).
- modes
Number of modes to extract from U. Has to be even.
- product
A product to use for the projection error. Default is None.
- classmethod from_array(U, check_symplecticity=True)[source]¶
Generate
SymplecticBasis
fromVectorArray
.Parameters
- U
The
VectorArray
.- check_symplecticity
Flag, whether to check symplecticity of E and F in the constructor (if these are not None). Default is True.
Returns
- BASIS
The
SymplecticBasis
.
- to_array()[source]¶
Convert to
VectorArray
.Returns
- BASIS
The
SymplecticBasis
asVectorArray
.
- transposed_symplectic_inverse()[source]¶
Compute transposed symplectic inverse J_{2N}.T * V * J_{2n}.
Returns
- TSI_BASIS
The transposed symplectic inverse as
SymplecticBasis
.
- pymor.algorithms.symplectic.esr(E, F, J=None)[source]¶
Elementary SR factorization. Transforms E and F such that.
[E, F] = S * diag(r11, r22)
Coefficients are chosen such that ||E|| = ||F||. r12 is set to zero.
Parameters
- E
A
VectorArray
of dim=1 from the sameVectorSpace
as F.- F
A
VectorArray
of dim=1 from the sameVectorSpace
as E.- J
A
CanonicalSymplecticFormOperator
operating on the sameVectorSpace
as E and F. Default is CanonicalSymplecticFormOperator(E.space).
Returns
- R
A diagonal numpy.ndarray.
- pymor.algorithms.symplectic.psd_complex_svd(U, modes)[source]¶
Generates a
SymplecticBasis
with the PSD complex SVD.This is an implementation of Algorithm 2 in [PM16].
Parameters
- U
The
VectorArray
for which the PSD SVD-like decomposition is to be computed.- modes
Number of modes (needs to be even).
Returns
- BASIS
The
SymplecticBasis
.
- pymor.algorithms.symplectic.psd_cotangent_lift(U, modes)[source]¶
Generates a
SymplecticBasis
with the PSD cotangent lift.This is an implementation of Algorithm 1 in [PM16].
Parameters
- U
The
VectorArray
for which the PSD SVD-like decomposition is to be computed.- modes
Number of modes (needs to be even).
Returns
- BASIS
The
SymplecticBasis
.
- pymor.algorithms.symplectic.psd_svd_like_decomp(U, modes, balance=True)[source]¶
Generates a
SymplecticBasis
with the PSD SVD-like decomposition.This is an implementation of Algorithm 1 in [BBH19].
Parameters
- U
The
VectorArray
for which the PSD SVD-like decomposition is to be computed.- modes
Number of modes (needs to be even).
- balance
A flag, whether to balance the norms of pairs of basis vectors.
Returns
- BASIS
The
SymplecticBasis
.
- pymor.algorithms.symplectic.symplectic_gram_schmidt(E, F, return_Lambda=False, atol=1e-13, rtol=1e-13, offset=0, reiterate=True, reiteration_threshold=0.9, check=True, check_tol=0.001, copy=True)[source]¶
Symplectify a
VectorArray
using the modified symplectic Gram-Schmidt algorithm.This is an implementation of Algorithm 3.2. in [AA11] with a modified criterion for reiteration.
Decomposition:
[E, F] = S * Lambda
with S symplectic and Lambda a permuted upper-triangular matrix.
Parameters
- E, F
The two
VectorArrays
which are to be symplectified.- return_Lambda
If
True
, the matrixLambda
from the decomposition is returned.- atol
Vectors of norm smaller than
atol
are removed from the array.- rtol
Relative tolerance used to detect non-symplectic subspaces (which are then removed from the array).
- offset
Assume that the first
offset
pairs vectors in E and F are already symplectic and start the algorithm at theoffset + 1
-th vector.- reiterate
If
True
, symplectify again if the symplectic product of the symplectified vectors is much smaller than the symplectic product of the original vector.- reiteration_threshold
If
reiterate
isTrue
, “re-orthonormalize” if the ratio between the symplectic products of the symplectified vectors and the original vectors is smaller than this value.- check
If
True
, check if the resultingVectorArray
is really symplectic.- check_tol
Tolerance for the check.
Returns
- S
The symplectified
VectorArray
.- Lambda
if
return_Lambda
isTrue
.