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.BasicObjectA canonically-symplectic basis based on pairs of basis vectors (e_i, f_i).
Is either initialized (a) with a pair of
VectorArraysE and F or (b) with aVectorSpace. The basis vectors are each contained in aVectorArrayE = (e_i)_{i=1}^n F = (f_i)_{i=1}^n
such that
V = [E, F].
- Parameters:
E – A
VectorArraythat represents the first half of basis vectors. May be none if phase_space is specified.F – A
VectorArraythat represents the second half of basis vectors. May be none if phase_space is specified.phase_space – A
VectorSpacethat 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
SymplecticBasiswith vectors from aVectorArray.Generate
SymplecticBasisfromVectorArray.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
SymplecticBasisto 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
SymplecticBasiswith 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
SymplecticBasisfromVectorArray.- 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
SymplecticBasisasVectorArray.
- 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
VectorArrayof dim=1 from the sameVectorSpaceas F.F – A
VectorArrayof dim=1 from the sameVectorSpaceas E.J – A
CanonicalSymplecticFormOperatoroperating on the sameVectorSpaceas 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
SymplecticBasiswith the PSD complex SVD.This is an implementation of Algorithm 2 in [PM16].
- Parameters:
U – The
VectorArrayfor 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
SymplecticBasiswith the PSD cotangent lift.This is an implementation of Algorithm 1 in [PM16].
- Parameters:
U – The
VectorArrayfor 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
SymplecticBasiswith the PSD SVD-like decomposition.This is an implementation of Algorithm 1 in [BBH19].
- Parameters:
U – The
VectorArrayfor 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
VectorArrayusing 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 – The two
VectorArrayswhich are to be symplectified.F – The two
VectorArrayswhich are to be symplectified.return_Lambda – If
True, the matrixLambdafrom the decomposition is returned.atol – Vectors of norm smaller than
atolare 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
offsetpairs 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
reiterateisTrue, “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 resultingVectorArrayis really symplectic.check_tol – Tolerance for the check.
- Returns:
S – The symplectified
VectorArray.Lambda – if
return_LambdaisTrue.