MA27 Interface

class InteriorPointMA27Interface(cntl_options=None, icntl_options=None, iw_factor=1.2, a_factor=2)

Bases: LinearSolverInterface

An interface to HSL’s MA27 routines for use with Parapint’s interior point algorithm. See http://www.hsl.rl.ac.uk/archive/specs/ma27.pdf for details on the use of MA27.

Note

The pivot tolerance, cntl(1), should be selected carefully. Larger values result in better precision but smaller values result in better performance.

Parameters
cntl_options: dict

See http://www.hsl.rl.ac.uk/archive/specs/ma27.pdf

icntl_options: dict

See http://www.hsl.rl.ac.uk/archive/specs/ma27.pdf

iw_factor: float

The factor for memory allocation of the integer working arrays used by MA27. This value is increased by the increase_memory_allocation method.

a_factor: float

The factor for memory allocation of the A array used by MA28. This value is increased by the increase_memory_allocation_method.

do_symbolic_factorization(matrix, raise_on_error=True, timer=None)

Perform symbolic factorization. This calls the MA27A/AD routines.

Parameters
matrix: scipy.sparse.spmatrix or pyomo.contrib.pynumero.sparse.block_matrix.BlockMatrix

The matrix to factorize

raise_on_error: bool

If False, an error will not be raised if an error occurs during symbolic factorization. Instead the status attribute of the results object will indicate an error ocurred.

timer: HierarchicalTimer
Returns
res: LinearSolverResults

A LinearSolverResults object with a status attribute for the LinearSolverStatus

do_numeric_factorization(matrix, raise_on_error=True, timer=None)

Perform numeric factorization. This calls the MA27B/BD routines.

Parameters
matrix: scipy.sparse.spmatrix or pyomo.contrib.pynumero.sparse.block_matrix.BlockMatrix

The matrix to factorize

raise_on_error: bool

If False, an error will not be raised if an error occurs during numeric factorization. Instead the status attribute of the results object will indicate an error ocurred.

timer: HierarchicalTimer
Returns
res: LinearSolverResults

A LinearSolverResults object with a status attribute for the LinearSolverStatus

increase_memory_allocation(factor)

Increas the memory allocation for factorization. This method should only be called if the results status from do_symbolic_factorization or do_numeric_factorization is LinearSolverStatus.not_enough_memory.

Parameters
factor: float

The factor by which to increase memory allocation. Should be greater than 1.

do_back_solve(rhs)

Performs a back solve with the factorized matrix. Should only be called after do_numeric_factorization.

Parameters
rhs: numpy.ndarray or BlockVector
Returns
result: numpy.ndarray or BlockVector
get_inertia()

Get the inertia. Should only be called after do_numeric_factorization.

Returns
num_pos: int

The number of positive eigenvalues of A

num_neg: int

The number of negative eigenvalues of A

num_zero: int

The number of zero eigenvalues of A

set_icntl(key, value)

Set the value for an icntl option.

Parameters
key: int
value: int
set_cntl(key, value)

Set the value for a cntl option.

Parameters
key: int
value: float
get_icntl(key)

Get the value for an icntl option.

Parameters
key: int
Returns
val: int
get_cntl(key)

Get the value for a cntl option.

Parameters
key: int
Returns
val: float