gemseo / algos / linear_solvers

lib_scipy_linalg module

Wrappers for scipy’s linear solvers.

Classes:

ScipyLinalgAlgos()

Wrapper for scipy linalg sparse linear solvers.

class gemseo.algos.linear_solvers.lib_scipy_linalg.ScipyLinalgAlgos[source]

Bases: gemseo.algos.linear_solvers.linear_solver_lib.LinearSolverLib

Wrapper for scipy linalg sparse linear solvers.

Return type

None

save_fpath

The path to the file to saved the problem when it is not converged and the option save_when_fail is active.

Type

str

methods_map

The mapping between the solver names and the solvers methods in scipy.sparse.

Type

Dict[str, Callable]

Attributes:

BASE_INFO_MSG

INTERNAL_NAME

LGMRES_SPEC_OPTS

LHS_CAN_BE_LINEAR_OPERATOR

LHS_MUST_BE_POSITIVE_DEFINITE

LHS_MUST_BE_SYMMETRIC

LIB

OPTIONS_DIR

OPTIONS_MAP

PROBLEM_TYPE

SAVE_WHEN_FAIL

algorithms

The available algorithms.

solution

The solution of the problem.

Methods:

driver_has_option(option_key)

Check if the option key exists.

execute(problem[, algo_name])

Executes the driver.

filter_adapted_algorithms(problem)

Filter the algorithms capable of solving the problem.

get_default_properties(algo_name)

Return the properties of the algorithm.

init_options_grammar(algo_name)

Initialize the options grammar.

is_algorithm_suited(algo_dict, problem)

Check if the algorithm is suited to the problem according to algo_dict.

solve(linear_problem, algo_name, **options)

Solve the linear system.

BASE_INFO_MSG = 'scipy linear solver algorithm stop info: '
INTERNAL_NAME = 'internal_algo_name'
LGMRES_SPEC_OPTS = ('inner_m', 'outer_k', 'outer_v', 'store_outer_av', 'prepend_outer_v')
LHS_CAN_BE_LINEAR_OPERATOR = 'LHS_linear_operator'
LHS_MUST_BE_POSITIVE_DEFINITE = 'LHS_positive_definite'
LHS_MUST_BE_SYMMETRIC = 'LHS_symmetric'
LIB = 'lib'
OPTIONS_DIR = 'options'
OPTIONS_MAP = {'max_iter': 'maxiter', 'preconditioner': 'M', 'store_outer_av': 'store_outer_Av'}
PROBLEM_TYPE = 'problem_type'
SAVE_WHEN_FAIL = 'save_when_fail'
property algorithms

The available algorithms.

driver_has_option(option_key)

Check if the option key exists.

Parameters

option_key (str) – The name of the option.

Returns

Whether the option is in the grammar.

Return type

bool

execute(problem, algo_name=None, **options)

Executes the driver.

Parameters
  • problem (Any) – The problem to be solved.

  • algo_name (Optional[str]) –

    The name of the algorithm> If None, use the algo_name attribute which may have been set by the factory.

    By default it is set to None.

  • options – The options dict for the algorithm.

  • **options (Any) –

Return type

None

filter_adapted_algorithms(problem)

Filter the algorithms capable of solving the problem.

Parameters

problem (Any) – The opt_problem to be solved.

Returns

The list of adapted algorithms names.

Return type

bool

classmethod get_default_properties(algo_name)[source]

Return the properties of the algorithm.

It states if it requires symmetric, or positive definite matrices for instance.

Parameters

algo_name (str) – The algorithm name.

Returns

The properties of the solver.

Return type

Dict[str, Union[bool, str]]

init_options_grammar(algo_name)

Initialize the options grammar.

Parameters

algo_name (str) – The name of the algorithm.

Return type

gemseo.core.grammars.json_grammar.JSONGrammar

static is_algorithm_suited(algo_dict, problem)

Check if the algorithm is suited to the problem according to algo_dict.

Parameters
Returns

Whether the algorithm suits.

Return type

bool

property solution

The solution of the problem.

solve(linear_problem, algo_name, **options)

Solve the linear system.

Parameters
Returns

The execution result.

Return type

Any