# pymor.bindings.pymess¶

## Module Contents¶

class pymor.bindings.pymess.LyapunovEquation(opt, A, E, B)[source]

Bases: pymess.Equation

Lyapunov equation class for pymess

Represents a (generalized) continuous-time algebraic Lyapunov equation:

• if opt.type is pymess.MESS_OP_NONE and E is None:

$A X + X A^T + B B^T = 0,$
• if opt.type is pymess.MESS_OP_NONE and E is not None:

$A X E^T + E X A^T + B B^T = 0,$
• if opt.type is pymess.MESS_OP_TRANSPOSE and E is None:

$A^T X + X A + B^T B = 0,$
• if opt.type is pymess.MESS_OP_TRANSPOSE and E is not None:

$A^T X E + E^T X A + B^T B = 0.$

Parameters

opt

pymess Options structure.

A

The non-parametric Operator A.

E

The non-parametric Operator E or None.

B

The operator B as a VectorArray from A.source.

Methods

 ainv_apply Applies the inverse of $$A$$ to a right hand side. It has to return apeinv_apply Applies the inverse of $$A+pE$$ to a right hand side. It has to return apex_apply Applies function the operator of $$A+pE$$. It has to return $$x=(A+pE)y$$. ax_apply Applies $$A$$ to a right hand side. It has to return einv_apply Applies the inverse of $$E$$ to a right hand side. It has to return ex_apply Applies $$E$$ to a right hand side. It has to return parameter The parmeter function has to return the shift parameters. If None
ainv_apply(op, y)[source]

Applies the inverse of $$A$$ to a right hand side. It has to return the solution of $$Ax =y$$.

apeinv_apply(op, p, idx_p, y)[source]

Applies the inverse of $$A+pE$$ to a right hand side. It has to return the solution of $$(A+pE)x = y$$.

apex_apply(op, p, idx_p, y)[source]

Applies function the operator of $$A+pE$$. It has to return $$x=(A+pE)y$$.

ax_apply(op, y)[source]

Applies $$A$$ to a right hand side. It has to return the result of $$x = Ay$$.

einv_apply(op, y)[source]

Applies the inverse of $$E$$ to a right hand side. It has to return the solution of $$Ex = y$$.

ex_apply(op, y)[source]

Applies $$E$$ to a right hand side. It has to return the result of $$x = Ey$$.

parameter(arp_p, arp_m, B=None, K=None)[source]

The parmeter function has to return the shift parameters. If None is returned shift paramter will be automatically determined. The Shift parameter strategy is determined by the options structure.

class pymor.bindings.pymess.RiccatiEquation(opt, A, E, B, C)[source]

Bases: pymess.Equation

Riccati equation class for pymess

Represents a Riccati equation

• if opt.type is pymess.MESS_OP_NONE and E is None:

$A X + X A^T - X C^T C X + B B^T = 0,$
• if opt.type is pymess.MESS_OP_NONE and E is not None:

$A X E^T + E X A^T - E X C^T C X E^T + B B^T = 0,$
• if opt.type is pymess.MESS_OP_TRANSPOSE and E is None:

$A^T X + X A - X B B^T X + C^T C = 0,$
• if opt.type is pymess.MESS_OP_TRANSPOSE and E is not None:

$A^T X E + E^T X A - E X B B^T X E^T + C^T C = 0.$

Parameters

opt

pymess Options structure.

A

The non-parametric Operator A.

E

The non-parametric Operator E or None.

B

The operator B as a VectorArray from A.source.

C

The operator C as a VectorArray from A.source.

Methods

 ainv_apply Applies the inverse of $$A$$ to a right hand side. It has to return apeinv_apply Applies the inverse of $$A+pE$$ to a right hand side. It has to return apex_apply Applies function the operator of $$A+pE$$. It has to return $$x=(A+pE)y$$. ax_apply Applies $$A$$ to a right hand side. It has to return einv_apply Applies the inverse of $$E$$ to a right hand side. It has to return ex_apply Applies $$E$$ to a right hand side. It has to return parameter The parmeter function has to return the shift parameters. If None
ainv_apply(op, y)[source]

Applies the inverse of $$A$$ to a right hand side. It has to return the solution of $$Ax =y$$.

apeinv_apply(op, p, idx_p, y)[source]

Applies the inverse of $$A+pE$$ to a right hand side. It has to return the solution of $$(A+pE)x = y$$.

apex_apply(op, p, idx_p, y)[source]

Applies function the operator of $$A+pE$$. It has to return $$x=(A+pE)y$$.

ax_apply(op, y)[source]

Applies $$A$$ to a right hand side. It has to return the result of $$x = Ay$$.

einv_apply(op, y)[source]

Applies the inverse of $$E$$ to a right hand side. It has to return the solution of $$Ex = y$$.

ex_apply(op, y)[source]

Applies $$E$$ to a right hand side. It has to return the result of $$x = Ey$$.

parameter(arp_p, arp_m, B=None, K=None)[source]

The parmeter function has to return the shift parameters. If None is returned shift paramter will be automatically determined. The Shift parameter strategy is determined by the options structure.

pymor.bindings.pymess.dense_nm_gmpcare_solver_options(linesearch=False, maxit=50, absres_tol=1e-11, relres_tol=1e-12, nrm=0)[source]

Return available Riccati solvers with default options for the pymess backend.

Also see lradi_solver_options.

Parameters

linesearch

See pymess.dense_nm_gmpcare.

maxit

See pymess.dense_nm_gmpcare.

absres_tol

See pymess.dense_nm_gmpcare.

relres_tol

See pymess.dense_nm_gmpcare.

nrm

See pymess.dense_nm_gmpcare.

Returns

A dict of available solvers with default solver options.

Return available adi solver options with default values for the pymess backend.

Parameters

See pymess.OptionsAdi.

See pymess.OptionsAdi.

See pymess.OptionsAdi.

See pymess.OptionsAdi.

See pymess.OptionsAdi.

See pymess.OptionsAdi.

See pymess.OptionsAdiShifts.

See pymess.OptionsAdiShifts.

See pymess.OptionsAdiShifts.

See pymess.OptionsAdiShifts.

See pymess.OptionsAdiShifts.

See pymess.OptionsAdiShifts.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.lrnm_solver_options(newton_gstep=0, newton_k0=None, newton_linesearch=0, newton_maxit=30, newton_output=1, newton_res2_tol=1e-10, newton_singleshifts=0)[source]

Return available adi solver options with default values for the pymess backend.

Parameters

newton_gstep

See pymess.OptionsNewton.

newton_k0

See pymess.OptionsNewton.

newton_linesearch

See pymess.OptionsNewton.

newton_maxit

See pymess.OptionsNewton.

newton_output

See pymess.OptionsNewton.

newton_res2_tol

See pymess.OptionsNewton.

newton_singleshifts

See pymess.OptionsNewton.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.lyap_dense_solver_options()[source]

Return available Lyapunov solvers with default options for the pymess backend.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.lyap_lrcf_solver_options()[source]

Return available Lyapunov solvers with default options for the pymess backend.

Also see lradi_solver_options.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.pos_ricc_lrcf_solver_options()[source]

Return available positive Riccati solvers with default options for the pymess backend.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.ricc_lrcf_solver_options()[source]

Return available Riccati solvers with default options for the pymess backend.

Returns

A dict of available solvers with default solver options.

pymor.bindings.pymess.solve_lyap_dense(A, E, B, trans=False, cont_time=True, options=None)[source]

Compute the solution of a Lyapunov equation.

See

for a general description.

This function uses pymess.glyap.

Parameters

A

The matrix A as a 2D NumPy array.

E

The matrix E as a 2D NumPy array or None.

B

The matrix B as a 2D NumPy array.

trans

Whether the first operator in the Lyapunov equation is transposed.

cont_time

Whether the continuous- or discrete-time Lyapunov equation is solved. Only the continuous-time case is implemented.

options

The solver options to use (see lyap_dense_solver_options).

Returns

X

Lyapunov equation solution as a NumPy array.

pymor.bindings.pymess.solve_lyap_lrcf(A, E, B, trans=False, cont_time=True, options=None, default_solver=None)[source]

Compute an approximate low-rank solution of a Lyapunov equation.

See

for a general description.

This function uses pymess.glyap and pymess.lradi. For both methods, to_numpy and from_numpy need to be implemented for A.source. Additionally, since glyap is a dense solver, it expects to_matrix to work for A and E.

If the solver is not specified using the options or default_solver arguments, glyap is used for small problems (smaller than defined with mat_eqn_sparse_min_size) and lradi for large problems.

Parameters

A

The non-parametric Operator A.

E

The non-parametric Operator E or None.

B

The operator B as a VectorArray from A.source.

trans

Whether the first Operator in the Lyapunov equation is transposed.

cont_time

Whether the continuous- or discrete-time Lyapunov equation is solved. Only the continuous-time case is implemented.

options

The solver options to use (see lyap_lrcf_solver_options).

default_solver

Default solver to use (pymess_lradi, pymess_glyap). If None, choose solver depending on the dimension of A.

Returns

Z

Low-rank Cholesky factor of the Lyapunov equation solution, VectorArray from A.source.

pymor.bindings.pymess.solve_pos_ricc_lrcf(A, E, B, C, R=None, trans=False, options=None)[source]

Compute an approximate low-rank solution of a positive Riccati equation.

See pymor.algorithms.riccati.solve_pos_ricc_lrcf for a general description.

This function uses pymess.dense_nm_gmpcare.

Parameters

A

The non-parametric Operator A.

E

The non-parametric Operator E or None.

B

The operator B as a VectorArray from A.source.

C

The operator C as a VectorArray from A.source.

R

The matrix R as a 2D NumPy array or None.

trans

Whether the first Operator in the Riccati equation is transposed.

options

The solver options to use (see pos_ricc_lrcf_solver_options).

Returns

Z

Low-rank Cholesky factor of the Riccati equation solution, VectorArray from A.source.

pymor.bindings.pymess.solve_ricc_lrcf(A, E, B, C, R=None, trans=False, options=None, default_solver=None)[source]

Compute an approximate low-rank solution of a Riccati equation.

See pymor.algorithms.riccati.solve_ricc_lrcf for a general description.

This function uses pymess.dense_nm_gmpcare and pymess.lrnm. For both methods, to_numpy and from_numpy need to be implemented for A.source. Additionally, since dense_nm_gmpcare is a dense solver, it expects to_matrix to work for A and E.

If the solver is not specified using the options or default_solver arguments, dense_nm_gmpcare is used for small problems (smaller than defined with mat_eqn_sparse_min_size) and lrnm for large problems.

Parameters

A

The non-parametric Operator A.

E

The non-parametric Operator E or None.

B

The operator B as a VectorArray from A.source.

C

The operator C as a VectorArray from A.source.

R

The matrix R as a 2D NumPy array or None.

trans

Whether the first Operator in the Riccati equation is transposed.

options

The solver options to use (see ricc_lrcf_solver_options).

default_solver

Default solver to use (pymess_lrnm, pymess_dense_nm_gmpcare). If None, chose solver depending on dimension A.

Returns

Z

Low-rank Cholesky factor of the Riccati equation solution, VectorArray from A.source.