# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
A collection of low-level algorithms for solving basic algebra and optimization problem arising in the simulation of nonsmooth dynamical systems.
Example of usage:
>>> import siconos.numerics as sn
>>> help(sn.LCP)
"""
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _pynumerics
else:
import _pynumerics
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_instance_variable(set):
def set_instance_attr(self, name, value):
if name == "thisown":
self.this.own(value)
elif name == "this":
set(self, name, value)
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
set(self, name, value)
else:
raise AttributeError("You cannot add instance attributes to %s" % self)
return set_instance_attr
def _swig_setattr_nondynamic_class_variable(set):
def set_class_attr(cls, name, value):
if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
set(cls, name, value)
else:
raise AttributeError("You cannot add class attributes to %s" % cls)
return set_class_attr
def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper
class _SwigNonDynamicMeta(type):
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
class SwigPyIterator(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _pynumerics.delete_SwigPyIterator
def value(self) -> "PyObject *":
return _pynumerics.SwigPyIterator_value(self)
def incr(self, n: "size_t"=1) -> "swig::SwigPyIterator *":
return _pynumerics.SwigPyIterator_incr(self, n)
def decr(self, n: "size_t"=1) -> "swig::SwigPyIterator *":
return _pynumerics.SwigPyIterator_decr(self, n)
def distance(self, x: "SwigPyIterator") -> "ptrdiff_t":
return _pynumerics.SwigPyIterator_distance(self, x)
def equal(self, x: "SwigPyIterator") -> "bool":
return _pynumerics.SwigPyIterator_equal(self, x)
def copy(self) -> "swig::SwigPyIterator *":
return _pynumerics.SwigPyIterator_copy(self)
def next(self) -> "PyObject *":
return _pynumerics.SwigPyIterator_next(self)
def __next__(self) -> "PyObject *":
return _pynumerics.SwigPyIterator___next__(self)
def previous(self) -> "PyObject *":
return _pynumerics.SwigPyIterator_previous(self)
def advance(self, n: "ptrdiff_t") -> "swig::SwigPyIterator *":
return _pynumerics.SwigPyIterator_advance(self, n)
def __eq__(self, x: "SwigPyIterator") -> "bool":
return _pynumerics.SwigPyIterator___eq__(self, x)
def __ne__(self, x: "SwigPyIterator") -> "bool":
return _pynumerics.SwigPyIterator___ne__(self, x)
def __iadd__(self, n: "ptrdiff_t") -> "swig::SwigPyIterator &":
return _pynumerics.SwigPyIterator___iadd__(self, n)
def __isub__(self, n: "ptrdiff_t") -> "swig::SwigPyIterator &":
return _pynumerics.SwigPyIterator___isub__(self, n)
def __add__(self, n: "ptrdiff_t") -> "swig::SwigPyIterator *":
return _pynumerics.SwigPyIterator___add__(self, n)
def __sub__(self, *args) -> "ptrdiff_t":
return _pynumerics.SwigPyIterator___sub__(self, *args)
def __iter__(self):
return self
# Register SwigPyIterator in _pynumerics:
_pynumerics.SwigPyIterator_swigregister(SwigPyIterator)
SHARED_PTR_DISOWN = _pynumerics.SHARED_PTR_DISOWN
ALLOC_CTRL_I = _pynumerics.ALLOC_CTRL_I
ALLOC_CTRL_P = _pynumerics.ALLOC_CTRL_P
def NM_clean_cs(m: "CSparseMatrix *", alloc_ctrl: "int") -> "void":
return _pynumerics.NM_clean_cs(m, alloc_ctrl)
def NM_clean(M: "NumericsMatrix", alloc_ctrl: "int") -> "int":
return _pynumerics.NM_clean(M, alloc_ctrl)
def sane_pyseq_check(o: "PyObject *") -> "bool":
return _pynumerics.sane_pyseq_check(o)
def _sn_check_nnz(mat: "PyObject **", M: "CSparseMatrix *") -> "void":
return _pynumerics._sn_check_nnz(mat, M)
def _sn_check_shape(mat: "PyObject **", M: "CSparseMatrix *") -> "void":
return _pynumerics._sn_check_shape(mat, M)
def is_Pyobject_scipy_sparse_matrix(o: "PyObject *", scipy_mod: "PyObject *") -> "bool":
return _pynumerics.is_Pyobject_scipy_sparse_matrix(o, scipy_mod)
[docs]def linearComplementarity_driver(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for Linear Complementarity Problems
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: the LinearComplementarityProblem structure which handles the problem (M,q)
:type z: float, in/out
:param z: a n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: info termination value
- 0 : successful
- >0 : otherwise see each solver for more information about the log info
"""
return _pynumerics.linearComplementarity_driver(problem, z, w, options)
[docs]def mlcp_driver(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solver for MLCP problems
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: the MixedLinearComplementarityProblem structure which handles the problem (M,q)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: info termination value,
- 0 : successful
- >0 : otherwise see each solver for more information about the log info
TODO: Sizing the regularization parameter and apply it only on null diagnal term
"""
return _pynumerics.mlcp_driver(problem, z, w, options)
[docs]def fc2d_driver(problem: "FrictionContactProblem", reaction: "double *", velocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for friction-contact 2D problem
:type problem: :py:class:`FrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.fc2d_driver(problem, reaction, velocity, options)
[docs]def fc3d_driver(problem: "FrictionContactProblem", reaction: "double *", velocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for friction-contact 3D problem
:type problem: :py:class:`FrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.fc3d_driver(problem, reaction, velocity, options)
[docs]def rolling_fc3d_driver(problem: "RollingFrictionContactProblem", reaction: "double *", velocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for rolling friction-contact 3D problem
:type problem: :py:class:`RollingFrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.rolling_fc3d_driver(problem, reaction, velocity, options)
[docs]def rolling_fc2d_driver(problem: "RollingFrictionContactProblem", reaction: "double *", velocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for rolling friction-contact 2D problem
:type problem: :py:class:`RollingFrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.rolling_fc2d_driver(problem, reaction, velocity, options)
[docs]def gfc2d_driver(problem: "GlobalFrictionContactProblem", reaction: "double *", velocity: "double *", globalVelocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for global friction-contact 2D problem
:type problem: :py:class:`GlobalFrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type globalVelocity: float, in/out
:param globalVelocity: global vector
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.gfc2d_driver(problem, reaction, velocity, globalVelocity, options)
[docs]def gfc3d_driver(problem: "GlobalFrictionContactProblem", reaction: "double *", velocity: "double *", globalVelocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for global friction-contact 3D problem
:type problem: :py:class:`GlobalFrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type globalVelocity: float, in/out
:param globalVelocity: global vector
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.gfc3d_driver(problem, reaction, velocity, globalVelocity, options)
[docs]def g_rolling_fc3d_driver(problem: "GlobalRollingFrictionContactProblem", reaction: "double *", velocity: "double *", globalVelocity: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for global rolling friction-contact 3D problem
:type problem: :py:class:`GlobalRollingFrictionContactProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type reaction: float, in/out
:param reaction: global vector (n)
:type velocity: float, in/out
:param velocity: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.g_rolling_fc3d_driver(problem, reaction, velocity, globalVelocity, options)
[docs]def variationalInequality_driver(problem: "VI", x: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for friction-contact 3D problem
:type problem: :py:class:`VariationalInequality`, in
:param problem: the structure which handles the Friction-Contact problem
:type x: float, in/out
:param x: global vector (n)
:type w: float, in/out
:param w: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.variationalInequality_driver(problem, x, w, options)
[docs]def avi_driver(problem: "AVI", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for Affine Variational Inequalities (AVI)
:type problem: :py:class:`AffineVariationalInequalities`, in
:param problem: the AffineVariationalInequalities structure which handles the problem (M,q)
:type z: float, in/out
:param z: a n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: info termination value
- 0 : successful
- >0 : otherwise see each solver for more information about the log info
"""
return _pynumerics.avi_driver(problem, z, w, options)
[docs]def mcp_old_driver(problem: "MCP_old", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solver for MCP problems
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: the MixedComplementarityProblem_old structure which handles the problem
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and its(their) parameters
:rtype: int
:return: info termination value 0 : successful, else error.
"""
return _pynumerics.mcp_old_driver(problem, z, w, options)
[docs]def mcp_driver(problem: "MCP", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solver for MCP problems -- new version
:type problem: :py:class:`MixedComplementarityProblem`, in
:param problem: the MixedComplementarityProblem structure which handles the problem
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and its(their) parameters
:rtype: int
:return: info termination value 0 : successful, else error.
"""
return _pynumerics.mcp_driver(problem, z, w, options)
[docs]def ncp_driver(problem: "NCP", z: "double *", F: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solver for NCP problems
:type problem: :py:class:`NonlinearComplementarityProblem`, in
:param problem: the NonlinearComplementarityProblem structure which handles the problem
:type z: float, in/out
:param z: a n-vector of doubles which contains the solution of the problem.
:type F: float, in/out
:param F: a n-vector of doubles which contains value of the function evaluated at the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and its(their) parameters
:rtype: int
:return: info termination value 0 : successful, else error
"""
return _pynumerics.ncp_driver(problem, z, F, options)
[docs]def soclcp_driver(problem: "SecondOrderConeLinearComplementarityProblem", r: "double *", v: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solvers for SOCLCP problem
:type problem: :py:class:`SecondOrderConeLinearComplementarityProblem`, in
:param problem: the structure which handles the Friction-Contact problem
:type r: float, in/out
:param r: global vector (n)
:type v: float, in/out
:param v: global vector (n)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.soclcp_driver(problem, r, v, options)
[docs]def fc3d_LmgcDriver(reaction: "double *", velocity: "double *", q: "double *", mu: "double *", W: "double *", row: "unsigned int *", column: "unsigned int *", nc: "unsigned int", nb: "unsigned int", solver_id: "int", tolerance: "double", itermax: "int", verbose: "int", outputFile: "int", freq_output: "int", ndof: "int") -> "int":
r"""
LMGC interface to solvers for friction-contact 3D problem
:type reaction: float, in/out
:param reaction: global vector (nc*3)
:type velocity: float, in/out
:param velocity: global vector (nc*3)
:type q: float, in
:param q: global vector (nc*3)
:type mu: float, in
:param mu: global vector (nc)
:type W: float, in
:param W: the block matrix in coordinate format
:type row: int, in
:param row: block row indices
:type column: int, in
:param column: block column indices
:type nc: int, in
:param nc: number of contacts
:type nb: int, in
:param nb: number of blocks
:type solver_id: int, in
:param solver_id: id an int to be mapped to actual solver in Numerics
:type tolerance: float, in
:param tolerance: threshold used to validate the solution: if the error is less than this value, the solution is accepted
:type itermax: int, in
:param itermax: the maximum number of iteration
:type verbose: int, in
:param verbose: level 0 : nothing, 1: mid level 2: high level
:type outputFile: int, in
:param outputFile: outputFile option 0 : nothing 1 : dat file 2: FCLIB HDF5 file if FCLIB is found
:type freq_output: int, in
:param freq_output:
:type ndof: int, in
:param ndof: the numbe of dof in the dynamical systems involved in contact (for output in file.)
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.fc3d_LmgcDriver(reaction, velocity, q, mu, W, row, column, nc, nb, solver_id, tolerance, itermax, verbose, outputFile, freq_output, ndof)
[docs]def gfc3d_LmgcDriver(reaction: "double *", velocity: "double *", globalVelocity: "double *", q: "double *", b: "double *", mu: "double *", Mdata: "double *", nzM: "unsigned int", rowM: "unsigned int *", colM: "unsigned int *", Hdata: "double *", nzH: "unsigned int", rowH: "unsigned int *", colH: "unsigned int *", n: "unsigned int", nc: "unsigned int", solver_id: "int", isize: "int", iparam: "int *", dsize: "int", dparam: "double *", verbose: "int", outputFile: "int", freq_output: "int") -> "int":
r"""
LMGC interface to solvers for global friction-contact 3D problem
:type reaction: float, in/out
:param reaction: global vector (nc*3)
:type velocity: float, in/out
:param velocity: global vector (nc*3)
:type globalVelocity: float, in/out
:param globalVelocity: global velocity vector (n)
:type q: float, in
:param q: global vector (n)
:type b: float, in
:param b: global vector (nc*3)
:type mu: float, in
:param mu: global vector (nc)
:type Mdata: float, in
:param Mdata: the sparse matrix in coordinate format
:type nzM: int, in
:param nzM: number of non zeros in Mdata
:type rowM: int, in
:param rowM: row indices of M
:type colM: int, in
:param colM: column indices of M
:type Hdata: float, in
:param Hdata: the sparse matrix in coordinate format
:type nzH: int, in
:param nzH: number of non zeros in Hdata
:type rowH: int, in
:param rowH: row indices of H
:type colH: int, in
:param colH: column indices of H
:type n: int, in
:param n: size of global velocity
:type nc: int, in
:param nc: number of contacts
:type solver_id: int, in
:param solver_id: id an int to be mapped to actual solver in Numerics
:type isize: int, in
:param isize: sive of integer parameters array
:type iparam: int, in
:param iparam: integer parameters array
:type dsize: int, in
:param dsize: sive of double parameters array
:type dparam: float, in
:param dparam: double parameters array
:type verbose: int, in
:param verbose: level 0 : nothing, 1: mid level 2: high level
:type outputFile: int, in
:param outputFile: outputFile option 0 : nothing 1 : C file , 1 : dat file 3: FCLIB HDF5 file if FCLIB is found
:type freq_output: int, in
:param freq_output:
:rtype: int
:return: result (0 if successful otherwise 1).
"""
return _pynumerics.gfc3d_LmgcDriver(reaction, velocity, globalVelocity, q, b, mu, Mdata, nzM, rowM, colM, Hdata, nzH, rowH, colH, n, nc, solver_id, isize, iparam, dsize, dparam, verbose, outputFile, freq_output)
[docs]def relay_driver(problem: "RelayProblem *", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
General interface to solver for relay problems
:type problem: RelayProblem, in
:param problem: the RelayProblem structure which handles the problem (M,q)
:type z: float, in/out
:param z: a n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and its (their) parameters
:rtype: int
:return: info termination value
- 0 : successful
- >0 : otherwise see each solver for more information about the log info
"""
return _pynumerics.relay_driver(problem, z, w, options)
[docs]class Callback(object):
r""" Structure used to store user callbacks inside solvers"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
env = property(_pynumerics.Callback_env_get, _pynumerics.Callback_env_set, doc=r""" general user environment""")
collectStatsIteration = property(_pynumerics.Callback_collectStatsIteration_get, _pynumerics.Callback_collectStatsIteration_set, doc=r"""
pointer on a function
Its signature is: user env, problem size, reaction,
velocity, error at end of solver iteration (when
this makes sense) and an extra data structure
""")
def __init__(self):
_pynumerics.Callback_swiginit(self, _pynumerics.new_Callback())
__swig_destroy__ = _pynumerics.delete_Callback
# Register Callback in _pynumerics:
_pynumerics.Callback_swigregister(Callback)
OPTIONS_PARAM_SIZE = _pynumerics.OPTIONS_PARAM_SIZE
[docs]class SolverOptions(object):
r"""
Structure used to send options (name, parameters and so on) to a specific
solver (mainly from Kernel to Numerics).
Creation, update and destruction:
- solver_options_create()
- solver_options_update_internal()
- solver_options_delete()
Details in users'guide.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
solverId = property(_pynumerics.SolverOptions_solverId_get, _pynumerics.SolverOptions_solverId_set, doc=r""" id number of the solver.""")
isSet = property(_pynumerics.SolverOptions_isSet_get, _pynumerics.SolverOptions_isSet_set, doc=r"""
true(1) if the structure is ready to be used by a numerics
driver.
""")
iSize = property(_pynumerics.SolverOptions_iSize_get, _pynumerics.SolverOptions_iSize_set, doc=r""" iSize size of vector iparam""")
iparam = property(_pynumerics.SolverOptions_iparam_get, _pynumerics.SolverOptions_iparam_set, doc=r"""
list of solver parameters (integer type); Check solvers doc
for details.
""")
dSize = property(_pynumerics.SolverOptions_dSize_get, _pynumerics.SolverOptions_dSize_set, doc=r""" size of vector dparam""")
dparam = property(_pynumerics.SolverOptions_dparam_get, _pynumerics.SolverOptions_dparam_set, doc=r"""
list of solver parameters (double type); Check solvers
doc for details.
""")
filterOn = property(_pynumerics.SolverOptions_filterOn_get, _pynumerics.SolverOptions_filterOn_set, doc=r"""
if true (1), check solution validity after the driver
call. Default = 1. For example if filterOn = 1 for a LCP,
lcp_compute_error() will be called at the end of the
process).
""")
dWorkSize = property(_pynumerics.SolverOptions_dWorkSize_get, _pynumerics.SolverOptions_dWorkSize_set, doc=r""" size of double type internal work array.""")
dWork = property(_pynumerics.SolverOptions_dWork_get, _pynumerics.SolverOptions_dWork_set, doc=r""" internal (double type) work array.""")
iWorkSize = property(_pynumerics.SolverOptions_iWorkSize_get, _pynumerics.SolverOptions_iWorkSize_set, doc=r""" size of integer type internal work array.""")
iWork = property(_pynumerics.SolverOptions_iWork_get, _pynumerics.SolverOptions_iWork_set, doc=r""" internal (integer type) work array.""")
numberOfInternalSolvers = property(_pynumerics.SolverOptions_numberOfInternalSolvers_get, _pynumerics.SolverOptions_numberOfInternalSolvers_set, doc=r"""
the number of internal or local
'sub-solvers' used by the solver (size of
internalSolvers) .
""")
internalSolvers = property(_pynumerics.SolverOptions_internalSolvers_get, _pynumerics.SolverOptions_internalSolvers_set, doc=r""" list of internal solver options""")
callback = property(_pynumerics.SolverOptions_callback_get, _pynumerics.SolverOptions_callback_set, doc=r""" pointer to user-defined callback""")
solverParameters = property(_pynumerics.SolverOptions_solverParameters_get, _pynumerics.SolverOptions_solverParameters_set, doc=r"""
additional parameters specific to the solver
(GAMS and NewtonMethod only)
""")
solverData = property(_pynumerics.SolverOptions_solverData_get, _pynumerics.SolverOptions_solverData_set, doc=r""" additional data specific to the solver""")
def __init__(self, *args):
_pynumerics.SolverOptions_swiginit(self, _pynumerics.new_SolverOptions(*args))
__swig_destroy__ = _pynumerics.delete_SolverOptions
# Register SolverOptions in _pynumerics:
_pynumerics.SolverOptions_swigregister(SolverOptions)
SICONOS_IPARAM_MAX_ITER = _pynumerics.SICONOS_IPARAM_MAX_ITER
SICONOS_IPARAM_ITER_DONE = _pynumerics.SICONOS_IPARAM_ITER_DONE
SICONOS_IPARAM_PREALLOC = _pynumerics.SICONOS_IPARAM_PREALLOC
SICONOS_IPARAM_NSGS_SHUFFLE = _pynumerics.SICONOS_IPARAM_NSGS_SHUFFLE
SICONOS_IPARAM_ERROR_EVALUATION = _pynumerics.SICONOS_IPARAM_ERROR_EVALUATION
SICONOS_IPARAM_PATHSEARCH_STACKSIZE = _pynumerics.SICONOS_IPARAM_PATHSEARCH_STACKSIZE
SICONOS_ERROR_FULL_EVALUATION = _pynumerics.SICONOS_ERROR_FULL_EVALUATION
r""" Complete error computation, including v computation"""
SICONOS_ERROR_LIGHT_EVALUATION = _pynumerics.SICONOS_ERROR_LIGHT_EVALUATION
r"""
Light error computation with incremental values on r verification of
absolute error at the end
"""
SICONOS_ERROR_LIGHT_EVALUATION_NO_UPDATE = _pynumerics.SICONOS_ERROR_LIGHT_EVALUATION_NO_UPDATE
r""" only light error computation, do not update v unknown)"""
SICONOS_DPARAM_TOL = _pynumerics.SICONOS_DPARAM_TOL
SICONOS_DPARAM_RESIDU = _pynumerics.SICONOS_DPARAM_RESIDU
[docs]def solver_options_print(options: "SolverOptions") -> "void":
r"""
screen display of solver parameters
:type options: :py:class:`SolverOptions`
:param options: the structure to be displayed
"""
return _pynumerics.solver_options_print(options)
[docs]def solver_options_delete(options: "SolverOptions") -> "void":
r"""
Clear and free all pointer members of the structure, then
release memory
:type options: :py:class:`SolverOptions`
:param options: the structure to be cleared.
"""
return _pynumerics.solver_options_delete(options)
[docs]def solver_options_create(solverId: "int") -> "SolverOptions *":
r"""
Create and initialize a SolverOptions struct: allocate internal memories,
set default values depending on the id.
:param id: solver id number
It must belong to one of the available ids defined for each formulation,
see users'guide for details
:rtype: :py:class:`SolverOptions`
:return: a pointer to options set, ready to use by a driver.
"""
return _pynumerics.solver_options_create(solverId)
[docs]def solver_options_copy(source: "SolverOptions") -> "SolverOptions *":
r"""
Copy an existing set of options, to create a new one. Warning : callback,
solverData and solverParameters of the new structure are pointer links to
those of the original one!
:type source: :py:class:`SolverOptions`
:param source: an existing solver options structure
:rtype: :py:class:`SolverOptions`
:return: a pointer to options set, ready to use by a driver.
"""
return _pynumerics.solver_options_copy(source)
[docs]def solver_options_update_internal(parent: "SolverOptions", internal_solver_number: "size_t", solver_id: "int") -> "void":
r"""
Change one of the internal solver of a previously defined SolverOptions set.
Allocate internal memories and set default values for the internal solver.
Warning : the actual internal solver in position internal_solver_number and
all its content will be destroyed and replaced by a new one.
:type parent: :py:class:`SolverOptions`
:param parent: the top-level SolverOptions which contains the internal solver
to be updated
:type internal_solver_number: int
:param internal_solver_number: number of the internal solver to
be update (warning : this is the position in the list of internal solvers,
not the id!)
:type solver_id: int
:param solver_id: id number of the new internal solver to be
created/updated
"""
return _pynumerics.solver_options_update_internal(parent, internal_solver_number, solver_id)
[docs]def solver_options_name_to_id(pName: "char const *") -> "int":
r"""
return the id of a solver based on its name
:type pName: string
:param pName: the name of the solver
:rtype: int
:return: the id of the solver or 0 if it failed
"""
return _pynumerics.solver_options_name_to_id(pName)
[docs]def solver_options_id_to_name(Id: "int") -> "char const *":
r"""
return the name of a solver given its id
:type Id: int
:param Id: the id of the solver
:rtype: string
:return: the name of the solver
"""
return _pynumerics.solver_options_id_to_name(Id)
[docs]def solver_options_get_internal_solver(options: "SolverOptions", n: "size_t") -> "SolverOptions *":
r"""
return the internal solver options set
:type options: :py:class:`SolverOptions`
:param options: parent options
:param number: of the targeted solver
:rtype: :py:class:`SolverOptions`
:return: a pointer to the internal solver options set
"""
return _pynumerics.solver_options_get_internal_solver(options, n)
[docs]def solver_options_set_internal_solver(options: "SolverOptions", n: "size_t", NSO: "SolverOptions") -> "void":
r"""
set internal solver
:type options: :py:class:`SolverOptions`
:param options: parent options
:param number: of the targeted solver
:param the: solver options to be used as internal solver number n
"""
return _pynumerics.solver_options_set_internal_solver(options, n, NSO)
NUMERICS_LOG_TO_SCREEN = _pynumerics.NUMERICS_LOG_TO_SCREEN
NUMERICS_LOG_TO_FILE = _pynumerics.NUMERICS_LOG_TO_FILE
NUMERICS_EXTERNAL_LOGGER = _pynumerics.NUMERICS_EXTERNAL_LOGGER
def numerics_set_verbose(newVerboseMode: "int") -> "void":
return _pynumerics.numerics_set_verbose(newVerboseMode)
[docs]def numerics_error(*args) -> "void":
r"""
check IO
msg output and exit with error
:type fn_name: string
:param fn_name: name of the function where error occurs
:type msg: string
:param msg: formatted output msg
"""
return _pynumerics.numerics_error(*args)
[docs]def numerics_error_nonfatal(*args) -> "void":
r"""
log error message without exit
:type fn_name: string
:param fn_name: name of the function where the error occurs
:type msg: string
:param msg: formatted output message
"""
return _pynumerics.numerics_error_nonfatal(*args)
[docs]def numerics_warning(*args) -> "void":
r"""
log warning
:type fn_name: string
:param fn_name: name of the function where warning occurs
:type msg: string
:param msg: formatted output message
"""
return _pynumerics.numerics_warning(*args)
[docs]def numerics_printf(*args) -> "void":
r"""
log message (if verbosity is on)
:type fmt: string
:param fmt: formatted output message
"""
return _pynumerics.numerics_printf(*args)
[docs]def numerics_printf_verbose(*args) -> "void":
r"""
log message if verbose is non null
:type verbose: int
:param verbose: log message is non null
:type fmt: string
:param fmt: formatted output message
"""
return _pynumerics.numerics_printf_verbose(*args)
def isqrt(n: "unsigned int") -> "unsigned int":
return _pynumerics.isqrt(n)
def compiled_in_debug_mode() -> "int":
return _pynumerics.compiled_in_debug_mode()
def set_cstruct(p_env: "uintptr_t", p_struct: "void *") -> "void":
return _pynumerics.set_cstruct(p_env, p_struct)
[docs]class CSparseMatrix_factors(object):
r""" Information used and produced by CSparse for an LU factorization"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
n = property(_pynumerics.CSparseMatrix_factors_n_get, _pynumerics.CSparseMatrix_factors_n_set, doc=r""" size of linear system""")
S = property(_pynumerics.CSparseMatrix_factors_S_get, _pynumerics.CSparseMatrix_factors_S_set, doc=r""" symbolic analysis""")
N = property(_pynumerics.CSparseMatrix_factors_N_get, _pynumerics.CSparseMatrix_factors_N_set, doc=r""" numerics factorization""")
def __init__(self):
_pynumerics.CSparseMatrix_factors_swiginit(self, _pynumerics.new_CSparseMatrix_factors())
__swig_destroy__ = _pynumerics.delete_CSparseMatrix_factors
# Register CSparseMatrix_factors in _pynumerics:
_pynumerics.CSparseMatrix_factors_swigregister(CSparseMatrix_factors)
cvar = _pynumerics.cvar
[docs]def CSparseMatrix_lu_factorization(order: "long", A: "CSparseMatrix const *", tol: "double", cs_lu_A: "CSparseMatrix_factors") -> "int":
r"""
compute a LU factorization of A and store it in a workspace
:type order: int
:param order: control if ordering is used
:type A: CSparseMatrix
:param A: the sparse matrix
:type tol: float
:param tol: the tolerance
:type cs_lu_A: :py:class:`CSparseMatrix_factors`
:param cs_lu_A: the parameter structure that eventually holds the factors
:rtype: int
:return: 1 if the factorization was successful, 1 otherwise
"""
return _pynumerics.CSparseMatrix_lu_factorization(order, A, tol, cs_lu_A)
[docs]def CSparseMatrix_chol_factorization(order: "long", A: "CSparseMatrix const *", cs_chol_A: "CSparseMatrix_factors") -> "int":
r"""
compute a Cholesky factorization of A and store it in a workspace
:type order: int
:param order: control if ordering is used
:type A: CSparseMatrix
:param A: the sparse matrix
:type cs_chol_A: :py:class:`CSparseMatrix_factors`
:param cs_chol_A: the parameter structure that eventually holds the factors
:rtype: int
:return: 1 if the factorization was successful, 1 otherwise
"""
return _pynumerics.CSparseMatrix_chol_factorization(order, A, cs_chol_A)
[docs]def CSparseMatrix_ldlt_factorization(order: "long", A: "CSparseMatrix const *", cs_ldlt_A: "CSparseMatrix_factors") -> "int":
r"""
compute a LDLT factorization of A and store it in a workspace
:type order: int
:param order: control if ordering is used
:type A: CSparseMatrix
:param A: the sparse matrix
:type cs_ldlt_A: :py:class:`CSparseMatrix_factors`
:param cs_ldlt_A: the parameter structure that eventually holds the factors
:rtype: int
:return: 1 if the factorization was successful, 1 otherwise
"""
return _pynumerics.CSparseMatrix_ldlt_factorization(order, A, cs_ldlt_A)
[docs]def CSparseMatrix_solve(cs_lu_A: "CSparseMatrix_factors", x: "double *", b: "double *") -> "long":
r"""
reuse a LU factorization (stored in the cs_lu_A) to solve a linear system Ax = b
:type cs_lu_A: :py:class:`CSparseMatrix_factors`
:param cs_lu_A: contains the LU factors of A, permutation information
:type x: float
:param x: workspace
:type b: float, in/out
:param b: on input RHS of the linear system; on output the solution
:rtype: int
:return: 0 if failed, 1 otherwise
"""
return _pynumerics.CSparseMatrix_solve(cs_lu_A, x, b)
[docs]def CSparseMatrix_spsolve(cs_lu_A: "CSparseMatrix_factors", X: "CSparseMatrix *", B: "CSparseMatrix *") -> "long":
r"""
reuse a LU factorization (stored in the cs_lu_A) to solve a linear system Ax = B
with a sparse r.h.s
:type cs_lu_A: :py:class:`CSparseMatrix_factors`
:param cs_lu_A: contains the LU factors of A, permutation information
:type X: CSparseMatrix
:param X: a csc sparse matrix workspace
:type B: CSparseMatrix, in/out
:param B: on input sparse RHS of the linear system; on output the solution
:rtype: int
:return: 0 if failed, 1 otherwise
"""
return _pynumerics.CSparseMatrix_spsolve(cs_lu_A, X, B)
[docs]def CSparseMatrix_chol_solve(cs_chol_A: "CSparseMatrix_factors", x: "double *", b: "double *") -> "long":
r"""
reuse a Cholesky factorization (stored in the cs_chol_A) to solve a linear system Ax = b
:type cs_chol_A: :py:class:`CSparseMatrix_factors`
:param cs_chol_A: contains the Cholesky factors of A, permutation information
:type x: float
:param x: workspace
:type b: float, in/out
:param b: on input RHS of the linear system; on output the solution
:rtype: int
:return: 0 if failed, 1 otherwise
"""
return _pynumerics.CSparseMatrix_chol_solve(cs_chol_A, x, b)
[docs]def CSparseMatrix_chol_spsolve(cs_chol_A: "CSparseMatrix_factors", X: "CSparseMatrix *", B: "CSparseMatrix *") -> "long":
r"""
reuse a Cholesky factorization (stored in the cs_chol_A) to solve a linear system Ax = B
with a sparse r.h.s
:type cs_chol_A: :py:class:`CSparseMatrix_factors`
:param cs_chol_A: contains the Cholesky factors of A, permutation information
:type X: CSparseMatrix
:param X: a csc sparse matrix workspace
:param b: on input sparse RHS of the linear system; on output the solution
:rtype: int
:return: 0 if failed, 1 otherwise
"""
return _pynumerics.CSparseMatrix_chol_spsolve(cs_chol_A, X, B)
[docs]def CSparseMatrix_ldlt_solve(cs_ldlt_A: "CSparseMatrix_factors", x: "double *", b: "double *") -> "long":
r"""
reuse a LDLT factorization (stored in the cs_ldlt_A) to solve a linear system Ax = b
:type cs_ldlt_A: :py:class:`CSparseMatrix_factors`
:param cs_ldlt_A: contains the LDLT factors of A, permutation information
:type x: float
:param x: workspace
:type b: float, in/out
:param b: on input RHS of the linear system; on output the solution
:rtype: int
:return: 0 if failed, 1 otherwise
"""
return _pynumerics.CSparseMatrix_ldlt_solve(cs_ldlt_A, x, b)
[docs]def CSparseMatrix_free_lu_factors(cs_lu_A: "CSparseMatrix_factors") -> "void":
r"""
Free a workspace related to a LU factorization
:type cs_lu_A: :py:class:`CSparseMatrix_factors`
:param cs_lu_A: the structure to free
"""
return _pynumerics.CSparseMatrix_free_lu_factors(cs_lu_A)
[docs]def CSparseMatrix_aaxpby(alpha: "double const", A: "CSparseMatrix const *", x: "double const *", beta: "double const", y: "double *") -> "int":
r"""
Matrix vector multiplication : y = alpha*A*x+beta*y
:type alpha: float, in
:param alpha: matrix coefficient
:type A: CSparseMatrix, in
:param A: the sparse matrix
:type x: float, in
:param x: pointer on a dense vector of size A->n
:type beta: float, in
:param beta: vector coefficient
:param out]: y pointer on a dense vector of size A->n
:rtype: int
:return: 0 if A x or y is NULL else 1
"""
return _pynumerics.CSparseMatrix_aaxpby(alpha, A, x, beta, y)
[docs]def CSparseMatrix_alloc_for_copy(m: "CSparseMatrix const *const") -> "CSparseMatrix *":
r"""
Allocate a CSparse matrix for future copy (as in NSM_copy)
:type m: CSparseMatrix
:param m: the matrix used as model
:rtype: CSparseMatrix
:return: an newly allocated matrix
"""
return _pynumerics.CSparseMatrix_alloc_for_copy(m)
def CSparseMatrix_to_dense(A: "CSparseMatrix const *const", B: "double *") -> "long":
return _pynumerics.CSparseMatrix_to_dense(A, B)
[docs]def CSparseMatrix_print(A: "CSparseMatrix const *", brief: "int") -> "int":
r"""
print a matrix to std output
:type A: CSparseMatrix
:param A: matrix to print
:type brief: int
:param brief: if positive, print only a portion of the matrix
"""
return _pynumerics.CSparseMatrix_print(A, brief)
[docs]def CSparseMatrix_print_in_file(A: "CSparseMatrix const *", brief: "int", file: "FILE *") -> "int":
r"""
print a matrix to a text file
:type A: CSparseMatrix
:param A: matrix to print
:type brief: int
:param brief: if positive, print only a portion of the matrix
:type file: FILE
:param file: file descriptor
"""
return _pynumerics.CSparseMatrix_print_in_file(A, brief, file)
def CSparseMatrix_new_from_file(file: "FILE *") -> "CSparseMatrix *":
return _pynumerics.CSparseMatrix_new_from_file(file)
[docs]def CSparseMatrix_zentry(T: "CSparseMatrix *", i: "long", j: "long", x: "double", threshold: "double") -> "long":
r"""
Add an entry to a triplet matrix only if the absolute value is
greater than threshold
:type T: CSparseMatrix
:param T: the sparse matrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type x: float
:param x: the value
:rtype: int
:return: integer value : 1 if the absolute value is less than
DBL_EPSILON, otherwise the return value of cs_entry.
"""
return _pynumerics.CSparseMatrix_zentry(T, i, j, x, threshold)
def CSparseMatrix_block_dense_zentry(T: "CSparseMatrix *", row_off: "long", col_off: "long", x: "double *", row_size: "long", col_size: "long", threshold: "double") -> "long":
return _pynumerics.CSparseMatrix_block_dense_zentry(T, row_off, col_off, x, row_size, col_size, threshold)
[docs]def CSparseMatrix_symmetric_zentry(T: "CSparseMatrix *", i: "long", j: "long", x: "double", threshold: "double") -> "long":
r"""
Add an entry to a symmetric triplet matrix only if the absolute value is
greater than threshold
:type T: CSparseMatrix
:param T: the sparse matrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type x: float
:param x: the value
:rtype: int
:return: integer value : 1 if the absolute value is less than
DBL_EPSILON, otherwise the return value of cs_entry.
"""
return _pynumerics.CSparseMatrix_symmetric_zentry(T, i, j, x, threshold)
[docs]def CSparseMatrix_entry(T: "CSparseMatrix *", i: "long", j: "long", x: "double") -> "long":
r"""
Add an entry to a triplet matrix
:type T: CSparseMatrix
:param T: the sparse matrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type x: float
:param x: the value
"""
return _pynumerics.CSparseMatrix_entry(T, i, j, x)
[docs]def CSparseMatrix_symmetric_entry(T: "CSparseMatrix *", i: "long", j: "long", x: "double") -> "long":
r"""
Add an entry to a symmetric triplet matrix
:type T: CSparseMatrix
:param T: the sparse matrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type x: float
:param x: the value
"""
return _pynumerics.CSparseMatrix_symmetric_entry(T, i, j, x)
[docs]def CSparseMatrix_check_triplet(T: "CSparseMatrix *") -> "int":
r"""
Check if the given triplet matrix is properly constructed (col and row indices are correct)
:type T: CSparseMatrix
:param T: the sparse matrix to check
:rtype: int
:return: 0 if the matrix is fine, 1 otherwise
"""
return _pynumerics.CSparseMatrix_check_triplet(T)
[docs]def CSparseMatrix_check_csc(T: "CSparseMatrix *") -> "int":
r"""
Check if the given triplet matrix is properly constructed (col and row indices are correct)
:type T: CSparseMatrix
:param T: the sparse matrix to check
:rtype: int
:return: 0 if the matrix is fine, 1 otherwise
"""
return _pynumerics.CSparseMatrix_check_csc(T)
[docs]def CSparseMatrix_spfree_on_stack(A: "CSparseMatrix *") -> "CSparseMatrix *":
r"""
Free space allocated for a SparseMatrix. note : cs_spfree also
free the cs_struct this fails when the struct is allocated on
the stack.
:type A: CSparseMatrix
:param A: the sparse matrix
:rtype: CSparseMatrix
:return: NULL on success
"""
return _pynumerics.CSparseMatrix_spfree_on_stack(A)
[docs]def CSparseMatrix_copy(A: "CSparseMatrix const *const", B: "CSparseMatrix *") -> "void":
r"""
Copy a CSparseMatrix inside another CSparseMatrix.
Reallocations are performed if B cannot hold a copy of A
:type A: CSparseMatrix, in
:param A: a CSparseMatrix
:type B: CSparseMatrix, in/out
:param B: a CSparseMatrix
"""
return _pynumerics.CSparseMatrix_copy(A, B)
[docs]def CSparseMatrix_scal(alpha: "double const", A: "CSparseMatrix const *") -> "int":
r"""
Multiply a matrix with a double alpha*A --> A
:type alpha: float
:param alpha: the coefficient
:type A: CSparseMatrix
:param A: the matrix
"""
return _pynumerics.CSparseMatrix_scal(alpha, A)
[docs]def CSparseMatrix_get_value(A: "CSparseMatrix const *", i: "long", j: "long") -> "double":
r"""
Return the element A(i,j)
:type A: CSparseMatrix
:param A: the sparse matrix
:type i: int
:param i: the row index
:type j: int
:param j: the column index
"""
return _pynumerics.CSparseMatrix_get_value(A, i, j)
[docs]def CSparseMatrix_write_in_file_python(m: "CSparseMatrix const *const", file: "FILE *") -> "void":
r"""
print a matrix to a text file in pyhton format
:type m: CSparseMatrix
:param m: matrix to print
:type file: FILE
:param file: file descriptor
"""
return _pynumerics.CSparseMatrix_write_in_file_python(m, file)
[docs]def CSparseMatrix_max_by_columns(A: "CSparseMatrix const *", max: "double *") -> "int":
r"""
Compute the max by columns of a sparse matrix
:type A: CSparseMatrix
:param A: the sparse matrix
:type max: float
:param max: the vector of maximum by columns
:param j: the column index
"""
return _pynumerics.CSparseMatrix_max_by_columns(A, max)
[docs]def CSparseMatrix_max_abs_by_columns(A: "CSparseMatrix const *", max: "double *") -> "int":
r"""
Compute the max in absolute value by columns of a sparse matrix
:type A: CSparseMatrix
:param A: the sparse matrix
:type max: float
:param max: the vector of maximum by columns
:param j: the column index
"""
return _pynumerics.CSparseMatrix_max_abs_by_columns(A, max)
[docs]class SparseBlockStructuredMatrix(object):
r"""
Structure to store sparse block matrices with square diagonal blocks.
:param nbblocks: the total number of non null blocks
:param **block: : *block contains the double values of one block in
Fortran storage (column by column) **block is
the list of non null blocks
:param blocknumber0: the first dimension of the block matrix
(number of block rows)
:param blocknumber1: the second dimension of the block matrix
(number of block columns)
:param *blocksize0: the list of sums of the number of rows of the
first column of blocks of M: blocksize0[i] = blocksize0[i-1] +
ni, ni being the number of rows of the block at row i
:param *blocksize1: the list of sums of the number of columns of the
first row of blocks of M: blocksize1[i] = blocksize1[i-1] + ni,
ni being the number of columns of the block at column i
:param filled1: index of the last non empty line + 1
:param filled2: number of non null blocks
:param index1_data: index1_data is of size equal to number of non
empty lines + 1. A block with number blockNumber inside a row
numbered rowNumber verify index1_data[rowNumber]<= blockNumber
<index1_data[rowNumber+1]`
:param index2_data: index2_data is of size filled2
index2_data[blockNumber] -> columnNumber.
Related functions: SBM_gemv(), SBM_row_prod(), SBM_clear(),
SBM_print, SBM_diagonal_block_index()
Note: the sparse format is the same as the one used by Boost C++
library to store compressed sparse row matrices. The same member
names have been adopted in order to simplify usage from Siconos
Kernel : filled1, filled2, index1_data, index2_data.
Reference :
http://ublas.sourceforge.net/refdoc/classboost_1_1numeric_1_1ublas_1_1compressed__matrix.html
If we consider the matrix M and the right-hand-side q defined as
.. math::
M=\left[\begin{array}{cccc|cc|cc}
1 & 2 & 0 & 4 & 3 &-1 & 0 & 0 \\
2 & 1 & 0 & 0 & 4 & 1 & 0 & 0 \\
0 & 0 & 1 &-1 & 0 & 0 & 0 & 0 \\
5 & 0 &-1 & 6 & 0 & 6 & 0 & 0 \\
\hline
0 & 0 & 0 & 0 & 1 & 0 & 0 & 5 \\
0 & 0 & 0 & 0 & 0 & 2 & 0 & 2 \\
\hline
0 & 0 & 2 & 1 & 0 & 0 & 2 & 2 \\
0 & 0 & 2 & 2 & 0 & 0 & -1 & 2 \\
\end{array}\right] \quad, q=\left[\begin{array}{c}-1 \\ -1 \\ 0 \\ -1 \\ \hline 1 \\ 0 \\ \hline -1 \\ 2 \end{array}\right].
then
- the number of non null blocks is 6 (nbblocks=6)
- the number of rows of blocks is 3 (blocknumber0 =3) and the
number of columns of blocks is 3 (blocknumber1 =3)
- the vector blocksize0 is equal to {4,6,8} and the vector
blocksize1 is equal to {4,6,8}
- the integer filled1 is equal to 4
- the integer filled2 is equal to 6
- the vector index1_data is equal to {0,2,4,6}
- the vector index2_data is equal to {0,1,1,2,0,2}
- the block contains all non null block matrices stored in Fortran
order (column by column) as
block[0] = {1,2,0,5,2,1,0,0,0,0,1,-1,4,0,-1,6}
block[1] = {3,4,0,0,-1,1,0,6}
...
block[5] = {2,-1,2,2}
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
nbblocks = property(_pynumerics.SparseBlockStructuredMatrix_nbblocks_get, _pynumerics.SparseBlockStructuredMatrix_nbblocks_set)
block = property(_pynumerics.SparseBlockStructuredMatrix_block_get, _pynumerics.SparseBlockStructuredMatrix_block_set)
blocknumber0 = property(_pynumerics.SparseBlockStructuredMatrix_blocknumber0_get, _pynumerics.SparseBlockStructuredMatrix_blocknumber0_set)
blocknumber1 = property(_pynumerics.SparseBlockStructuredMatrix_blocknumber1_get, _pynumerics.SparseBlockStructuredMatrix_blocknumber1_set)
blocksize0 = property(_pynumerics.SparseBlockStructuredMatrix_blocksize0_get, _pynumerics.SparseBlockStructuredMatrix_blocksize0_set)
blocksize1 = property(_pynumerics.SparseBlockStructuredMatrix_blocksize1_get, _pynumerics.SparseBlockStructuredMatrix_blocksize1_set)
filled1 = property(_pynumerics.SparseBlockStructuredMatrix_filled1_get, _pynumerics.SparseBlockStructuredMatrix_filled1_set)
filled2 = property(_pynumerics.SparseBlockStructuredMatrix_filled2_get, _pynumerics.SparseBlockStructuredMatrix_filled2_set)
index1_data = property(_pynumerics.SparseBlockStructuredMatrix_index1_data_get, _pynumerics.SparseBlockStructuredMatrix_index1_data_set)
index2_data = property(_pynumerics.SparseBlockStructuredMatrix_index2_data_get, _pynumerics.SparseBlockStructuredMatrix_index2_data_set)
diagonal_blocks = property(_pynumerics.SparseBlockStructuredMatrix_diagonal_blocks_get, _pynumerics.SparseBlockStructuredMatrix_diagonal_blocks_set)
version = property(_pynumerics.SparseBlockStructuredMatrix_version_get, _pynumerics.SparseBlockStructuredMatrix_version_set, doc=r""" version of storage""")
__swig_destroy__ = _pynumerics.delete_SparseBlockStructuredMatrix
def __init__(self):
_pynumerics.SparseBlockStructuredMatrix_swiginit(self, _pynumerics.new_SparseBlockStructuredMatrix())
# Register SparseBlockStructuredMatrix in _pynumerics:
_pynumerics.SparseBlockStructuredMatrix_swigregister(SparseBlockStructuredMatrix)
class SparseBlockCoordinateMatrix(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
nbblocks = property(_pynumerics.SparseBlockCoordinateMatrix_nbblocks_get, _pynumerics.SparseBlockCoordinateMatrix_nbblocks_set, doc=r""" number of blocks""")
blocknumber0 = property(_pynumerics.SparseBlockCoordinateMatrix_blocknumber0_get, _pynumerics.SparseBlockCoordinateMatrix_blocknumber0_set, doc=r""" number of rows""")
blocknumber1 = property(_pynumerics.SparseBlockCoordinateMatrix_blocknumber1_get, _pynumerics.SparseBlockCoordinateMatrix_blocknumber1_set, doc=r""" number of columns""")
block = property(_pynumerics.SparseBlockCoordinateMatrix_block_get, _pynumerics.SparseBlockCoordinateMatrix_block_set, doc=r""" block pointers""")
blocksize0 = property(_pynumerics.SparseBlockCoordinateMatrix_blocksize0_get, _pynumerics.SparseBlockCoordinateMatrix_blocksize0_set, doc=r""" cumulative number of rows in blocks""")
blocksize1 = property(_pynumerics.SparseBlockCoordinateMatrix_blocksize1_get, _pynumerics.SparseBlockCoordinateMatrix_blocksize1_set, doc=r""" cumulative number of columns in blocks""")
row = property(_pynumerics.SparseBlockCoordinateMatrix_row_get, _pynumerics.SparseBlockCoordinateMatrix_row_set, doc=r""" row indices""")
column = property(_pynumerics.SparseBlockCoordinateMatrix_column_get, _pynumerics.SparseBlockCoordinateMatrix_column_set, doc=r""" column indices""")
def __init__(self):
_pynumerics.SparseBlockCoordinateMatrix_swiginit(self, _pynumerics.new_SparseBlockCoordinateMatrix())
__swig_destroy__ = _pynumerics.delete_SparseBlockCoordinateMatrix
# Register SparseBlockCoordinateMatrix in _pynumerics:
_pynumerics.SparseBlockCoordinateMatrix_swigregister(SparseBlockCoordinateMatrix)
class SparseBlockStructuredMatrixPred(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
nbbldiag = property(_pynumerics.SparseBlockStructuredMatrixPred_nbbldiag_get, _pynumerics.SparseBlockStructuredMatrixPred_nbbldiag_set)
indic = property(_pynumerics.SparseBlockStructuredMatrixPred_indic_get, _pynumerics.SparseBlockStructuredMatrixPred_indic_set)
indicop = property(_pynumerics.SparseBlockStructuredMatrixPred_indicop_get, _pynumerics.SparseBlockStructuredMatrixPred_indicop_set)
submatlcp = property(_pynumerics.SparseBlockStructuredMatrixPred_submatlcp_get, _pynumerics.SparseBlockStructuredMatrixPred_submatlcp_set)
submatlcpop = property(_pynumerics.SparseBlockStructuredMatrixPred_submatlcpop_get, _pynumerics.SparseBlockStructuredMatrixPred_submatlcpop_set)
ipiv = property(_pynumerics.SparseBlockStructuredMatrixPred_ipiv_get, _pynumerics.SparseBlockStructuredMatrixPred_ipiv_set)
sizesublcp = property(_pynumerics.SparseBlockStructuredMatrixPred_sizesublcp_get, _pynumerics.SparseBlockStructuredMatrixPred_sizesublcp_set)
sizesublcpop = property(_pynumerics.SparseBlockStructuredMatrixPred_sizesublcpop_get, _pynumerics.SparseBlockStructuredMatrixPred_sizesublcpop_set)
subq = property(_pynumerics.SparseBlockStructuredMatrixPred_subq_get, _pynumerics.SparseBlockStructuredMatrixPred_subq_set)
bufz = property(_pynumerics.SparseBlockStructuredMatrixPred_bufz_get, _pynumerics.SparseBlockStructuredMatrixPred_bufz_set)
newz = property(_pynumerics.SparseBlockStructuredMatrixPred_newz_get, _pynumerics.SparseBlockStructuredMatrixPred_newz_set)
workspace = property(_pynumerics.SparseBlockStructuredMatrixPred_workspace_get, _pynumerics.SparseBlockStructuredMatrixPred_workspace_set)
def __init__(self):
_pynumerics.SparseBlockStructuredMatrixPred_swiginit(self, _pynumerics.new_SparseBlockStructuredMatrixPred())
__swig_destroy__ = _pynumerics.delete_SparseBlockStructuredMatrixPred
# Register SparseBlockStructuredMatrixPred in _pynumerics:
_pynumerics.SparseBlockStructuredMatrixPred_swigregister(SparseBlockStructuredMatrixPred)
class SBM_index_by_column(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
filled3 = property(_pynumerics.SBM_index_by_column_filled3_get, _pynumerics.SBM_index_by_column_filled3_set)
filled4 = property(_pynumerics.SBM_index_by_column_filled4_get, _pynumerics.SBM_index_by_column_filled4_set)
index3_data = property(_pynumerics.SBM_index_by_column_index3_data_get, _pynumerics.SBM_index_by_column_index3_data_set)
index4_data = property(_pynumerics.SBM_index_by_column_index4_data_get, _pynumerics.SBM_index_by_column_index4_data_set)
blockMap = property(_pynumerics.SBM_index_by_column_blockMap_get, _pynumerics.SBM_index_by_column_blockMap_set)
def __init__(self):
_pynumerics.SBM_index_by_column_swiginit(self, _pynumerics.new_SBM_index_by_column())
__swig_destroy__ = _pynumerics.delete_SBM_index_by_column
# Register SBM_index_by_column in _pynumerics:
_pynumerics.SBM_index_by_column_swigregister(SBM_index_by_column)
NUMERICS_SBM_FREE_BLOCK = _pynumerics.NUMERICS_SBM_FREE_BLOCK
NUMERICS_SBM_FREE_SBM = _pynumerics.NUMERICS_SBM_FREE_SBM
[docs]def SBM_new() -> "SparseBlockStructuredMatrix *":
r"""
Creation of an empty Sparse Block Matrix.
:rtype: :py:class:`SparseBlockStructuredMatrix`
:return: a pointer on allocated and initialized space
"""
return _pynumerics.SBM_new()
[docs]def SBM_null(sbm: "SparseBlockStructuredMatrix") -> "void":
r"""
set Sparse Block Matrix. fields to NULL
:type sbm: :py:class:`SparseBlockStructuredMatrix`
:param sbm: a matrix
"""
return _pynumerics.SBM_null(sbm)
[docs]def SBM_gemv(sizeX: "unsigned int", sizeY: "unsigned int", alpha: "double", A: "SparseBlockStructuredMatrix", x: "double const *", beta: "double", y: "double *") -> "void":
r"""
SparseMatrix - vector product y = alpha*A*x + beta*y
:type sizeX: int, in
:param sizeX: dim of the vectors x
:type sizeY: int, in
:param sizeY: dim of the vectors y
:type alpha: float, in
:param alpha: coefficient
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type x: float, in
:param x: the vector to be multiplied
:type beta: float, in
:param beta: coefficient
:type y: float, in/out
:param y: the resulting vector
"""
return _pynumerics.SBM_gemv(sizeX, sizeY, alpha, A, x, beta, y)
[docs]def SBM_gemv_3x3(sizeX: "unsigned int", sizeY: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double *const", y: "double *") -> "void":
r"""
SparseMatrix - vector product y = A*x + y for block of size 3x3
:type sizeX: int, in
:param sizeX: dim of the vectors x
:type sizeY: int, in
:param sizeY: dim of the vectors y
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
"""
return _pynumerics.SBM_gemv_3x3(sizeX, sizeY, A, x, y)
[docs]def SBM_gemm_without_allocation(alpha: "double", A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix", beta: "double", C: "SparseBlockStructuredMatrix") -> "void":
r"""
SparseBlockStructuredMatrix - SparseBlockStructuredMatrix product C = alpha*A*B + beta*C
The routine has to be used with precaution. The allocation of C is not done
since we want to add beta*C. We assume that the structure and the allocation
of the matrix C are right. Especially:
- the blocks C(i,j) must exists
- the sizes of blocks must be consistent
- no extra block must be present in C
:type alpha: float, in
:param alpha: coefficient
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type B: :py:class:`SparseBlockStructuredMatrix`, in
:param B: the matrix to be multiplied
:type beta: float, in
:param beta: coefficient
:type C: :py:class:`SparseBlockStructuredMatrix`, in/out
:param C: the resulting matrix
"""
return _pynumerics.SBM_gemm_without_allocation(alpha, A, B, beta, C)
[docs]def SBM_multiply(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix") -> "SparseBlockStructuredMatrix *":
r"""
SparseBlockStructuredMatrix - SparseBlockStructuredMatrix multiplication C = A *B
Correct allocation is performed
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type B: :py:class:`SparseBlockStructuredMatrix`, in
:param B: the matrix to be multiplied
:rtype: :py:class:`SparseBlockStructuredMatrix`
:return: C the resulting matrix
"""
return _pynumerics.SBM_multiply(A, B)
[docs]def SBM_zero_matrix_for_multiply(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix") -> "SparseBlockStructuredMatrix *":
r""" Perform the allocation of a zero matrix that is compatible qith multiplication"""
return _pynumerics.SBM_zero_matrix_for_multiply(A, B)
[docs]def SBM_add(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix", alpha: "double", beta: "double") -> "SparseBlockStructuredMatrix *":
r"""
SparseBlockStructuredMatrix - SparseBlockStructuredMatrix addition C = alpha*A + beta*B
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be added
:type B: :py:class:`SparseBlockStructuredMatrix`, in
:param B: the matrix to be added
:type alpha: float, in
:param alpha: coefficient
:type beta: float, in
:param beta: coefficient
:rtype: :py:class:`SparseBlockStructuredMatrix`
:return: C the resulting matrix
"""
return _pynumerics.SBM_add(A, B, alpha, beta)
[docs]def SBM_add_without_allocation(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix", alpha: "double", beta: "double", C: "SparseBlockStructuredMatrix", gamma: "double") -> "void":
r"""
SparseBlockStructuredMatrix - SparseBlockStructuredMatrix addition C = alpha*A + beta*B + gamma*C without allocation.
We assume that C has the correct structure
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be added
:type B: :py:class:`SparseBlockStructuredMatrix`, in
:param B: the matrix to be added
:type alpha: float, in
:param alpha: coefficient
:type beta: float, in
:param beta: coefficient
:type gamma: float, in
:param gamma: coefficient
:type C: :py:class:`SparseBlockStructuredMatrix`, in/out
:param C: the resulting matrix
"""
return _pynumerics.SBM_add_without_allocation(A, B, alpha, beta, C, gamma)
[docs]def SBM_scal(alpha: "double", A: "SparseBlockStructuredMatrix") -> "void":
r"""
Multiply a matrix with a double alpha*A --> A
:type alpha: float
:param alpha: the coefficient
:type A: :py:class:`SparseBlockStructuredMatrix`
:param A: the matrix
"""
return _pynumerics.SBM_scal(alpha, A)
[docs]def SBM_row_prod(sizeX: "unsigned int", sizeY: "unsigned int", currentRowNumber: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double const *const", y: "double *", init: "int") -> "void":
r"""
Row of a SparseMatrix - vector product y = rowA*x or y += rowA*x, rowA being a row of blocks of A
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type currentRowNumber: int, in
:param currentRowNumber: number of the required row of blocks
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type init: int, in
:param init: = 0 for y += Ax, =1 for y = Ax
"""
return _pynumerics.SBM_row_prod(sizeX, sizeY, currentRowNumber, A, x, y, init)
[docs]def SBM_row_prod_no_diag(sizeX: "unsigned int", sizeY: "unsigned int", currentRowNumber: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double const *const", y: "double *", init: "int") -> "void":
r"""
Row of a SparseMatrix - vector product y = rowA*x or y += rowA*x, rowA being a row of blocks of A
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type currentRowNumber: int, in
:param currentRowNumber: number of the required row of blocks
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type init: int, in
:param init: = 0 for y += Ax, =1 for y = Ax
"""
return _pynumerics.SBM_row_prod_no_diag(sizeX, sizeY, currentRowNumber, A, x, y, init)
[docs]def SBM_row_prod_no_diag_3x3(sizeX: "unsigned int", sizeY: "unsigned int", currentRowNumber: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double *const", y: "double *") -> "void":
r"""
Row of a SparseMatrix - vector product y = rowA*x or y += rowA*x, rowA being a row of blocks of A of size 3x3
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type currentRowNumber: int, in
:param currentRowNumber: number of the required row of blocks
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
"""
return _pynumerics.SBM_row_prod_no_diag_3x3(sizeX, sizeY, currentRowNumber, A, x, y)
def SBM_row_prod_no_diag_2x2(sizeX: "unsigned int", sizeY: "unsigned int", currentRowNumber: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double *const", y: "double *") -> "void":
return _pynumerics.SBM_row_prod_no_diag_2x2(sizeX, sizeY, currentRowNumber, A, x, y)
def SBM_row_prod_no_diag_1x1(sizeX: "unsigned int", sizeY: "unsigned int", currentRowNumber: "unsigned int", A: "SparseBlockStructuredMatrix", x: "double *const", y: "double *") -> "void":
return _pynumerics.SBM_row_prod_no_diag_1x1(sizeX, sizeY, currentRowNumber, A, x, y)
def SBM_extract_component_3x3(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix", row_components: "unsigned int *", row_components_size: "unsigned int", col_components: "unsigned int *", col_components_size: "unsigned int") -> "void":
return _pynumerics.SBM_extract_component_3x3(A, B, row_components, row_components_size, col_components, col_components_size)
[docs]def SBM_clear(blmat: "SparseBlockStructuredMatrix") -> "void":
r"""
Destructor for SparseBlockStructuredMatrix objects
:type blmat: :py:class:`SparseBlockStructuredMatrix`
:param blmat: SparseBlockStructuredMatrix the matrix to be destroyed.
"""
return _pynumerics.SBM_clear(blmat)
[docs]def SBMfree(A: "SparseBlockStructuredMatrix", level: "unsigned int") -> "void":
r"""
To free a SBM matrix (for example allocated by NM_new_from_file).
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix that mus be de-allocated.
:type level: int, in
:param level: use NUMERICS_SBM_FREE_BLOCK | NUMERICS_SBM_FREE_SBM
"""
return _pynumerics.SBMfree(A, level)
[docs]def SBM_print(m: "SparseBlockStructuredMatrix") -> "void":
r"""
Screen display of the matrix content
:type m: :py:class:`SparseBlockStructuredMatrix`
:param m: the matrix to be displayed
"""
return _pynumerics.SBM_print(m)
[docs]def SBM_write_in_file(m: "SparseBlockStructuredMatrix", file: "FILE *") -> "void":
r"""
print in file of the matrix content
:type m: :py:class:`SparseBlockStructuredMatrix`
:param m: the matrix to be displayed
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.SBM_write_in_file(m, file)
[docs]def SBM_read_in_file(M: "SparseBlockStructuredMatrix", file: "FILE *") -> "void":
r"""
read in file of the matrix content without performing memory allocation
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the matrix to be displayed
:type file: FILE
:param file: the corresponding name of the file
"""
return _pynumerics.SBM_read_in_file(M, file)
[docs]def SBM_new_from_file(file: "FILE *") -> "SparseBlockStructuredMatrix *":
r"""
Create from file a SparseBlockStructuredMatrix with memory allocation
:type file: FILE
:param file: the corresponding name of the file
:rtype: :py:class:`SparseBlockStructuredMatrix`
:return: the matrix to be displayed
"""
return _pynumerics.SBM_new_from_file(file)
[docs]def SBM_write_in_fileForScilab(M: "SparseBlockStructuredMatrix", file: "FILE *") -> "void":
r"""
print in file of the matrix content in Scilab format for each block
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the matrix to be displayed
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.SBM_write_in_fileForScilab(M, file)
[docs]def SBM_write_in_filename(M: "SparseBlockStructuredMatrix", filename: "char const *") -> "void":
r"""
print in file of the matrix content
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the matrix to be displayed
:type filename: string
:param filename: the corresponding file
"""
return _pynumerics.SBM_write_in_filename(M, filename)
[docs]def SBM_read_in_filename(M: "SparseBlockStructuredMatrix", filename: "char const *") -> "void":
r"""
read in file of the matrix content
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the matrix to be displayed
:type filename: string
:param filename: the corresponding name of the file
"""
return _pynumerics.SBM_read_in_filename(M, filename)
[docs]def SBM_clear_pred(blmatpred: "SparseBlockStructuredMatrixPred") -> "void":
r"""
Destructor for SparseBlockStructuredMatrixPred objects
:type blmatpred: :py:class:`SparseBlockStructuredMatrixPred`
:param blmatpred: SparseBlockStructuredMatrix, the matrix to be destroyed.
"""
return _pynumerics.SBM_clear_pred(blmatpred)
[docs]def SBM_diagonal_block_indices(M: "SparseBlockStructuredMatrix") -> "unsigned int *":
r"""
Compute the indices of blocks of the diagonal block
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the SparseBlockStructuredMatrix matrix
:rtype: int
:return: the indices for all the rows
"""
return _pynumerics.SBM_diagonal_block_indices(M)
[docs]def SBM_diagonal_block_index(M: "SparseBlockStructuredMatrix", row: "unsigned int") -> "unsigned int":
r"""
Find index of the diagonal block in a row
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the SparseBlockStructuredMatrix matrix
:type row: int
:param row: the row of the required block
:rtype: int
:return: pos the position of the block
"""
return _pynumerics.SBM_diagonal_block_index(M, row)
[docs]def SBM_entry(M: "SparseBlockStructuredMatrix", row: "unsigned int", col: "unsigned int", val: "double") -> "int":
r"""
insert an entry into a SparseBlockStructuredMatrix.
This method is expensive in terms of memory management. For a lot of entries, use
an alternative
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the SparseBlockStructuredMatrix
:param i: row index
:param j: column index
:type val: float
:param val: the value to be inserted.
"""
return _pynumerics.SBM_entry(M, row, col, val)
[docs]def SBM_get_value(M: "SparseBlockStructuredMatrix", row: "unsigned int", col: "unsigned int") -> "double":
r"""
get the element of row i and column j of the matrix M
:type M: :py:class:`SparseBlockStructuredMatrix`
:param M: the SparseBlockStructuredMatrix matrix
:type row: int
:param row: the row index
:type col: int
:param col: the column index
:rtype: float
:return: the value
"""
return _pynumerics.SBM_get_value(M, row, col)
[docs]def SBM_copy(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix", copyBlock: "unsigned int") -> "int":
r"""
Copy of a SBM A into B
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix matrix to be copied
:type B: :py:class:`SparseBlockStructuredMatrix`, out
:param B: the SparseBlockStructuredMatrix matrix copy of A
:type copyBlock: int, in
:param copyBlock: if copyBlock then the content of block are copied, else only the pointers are copied.
:rtype: int
:return: 0 if ok
"""
return _pynumerics.SBM_copy(A, B, copyBlock)
[docs]def SBM_transpose(A: "SparseBlockStructuredMatrix", B: "SparseBlockStructuredMatrix") -> "int":
r"""
Transpose by copy of a SBM A into B
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix matrix to be copied
:type B: :py:class:`SparseBlockStructuredMatrix`, out
:param B: the SparseBlockStructuredMatrix matrix copy of transpose A
:rtype: int
:return: 0 if ok
"""
return _pynumerics.SBM_transpose(A, B)
[docs]def SBM_inverse_diagonal_block_matrix_in_place(M: "SparseBlockStructuredMatrix", ipiv: "int *") -> "int":
r"""
Inverse (in place) a square diagonal block matrix
:type M: :py:class:`SparseBlockStructuredMatrix`, in/out
:param M: the SparseBlockStructuredMatrix matrix to be inversed
:type ipiv: int
:param ipiv: worksapce for storign ipiv
:rtype: int
:return: 0 ik ok
"""
return _pynumerics.SBM_inverse_diagonal_block_matrix_in_place(M, ipiv)
[docs]def SBM_to_dense(A: "SparseBlockStructuredMatrix") -> "double *":
r"""
Copy a SBM into a Dense Matrix
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix matrix
:type denseMat: float, in
:param denseMat: pointer on the filled dense Matrix
"""
return _pynumerics.SBM_to_dense(A)
[docs]def SBM_to_sparse(A: "SparseBlockStructuredMatrix") -> "cs_dl_sparse *":
r"""
Copy a SBM into a Sparse (CSR) Matrix
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix matrix
:type outSparseMat: CSparseMatrix, in
:param outSparseMat: pointer on the filled sparse Matrix
:rtype: int
:return: 0 if ok
"""
return _pynumerics.SBM_to_sparse(A)
[docs]def SBM_to_sparse_init_memory(A: "SparseBlockStructuredMatrix", sparseMat: "CSparseMatrix *") -> "int":
r"""
initMemory of a Sparse (CSR) Matrix form a SBM matrix
:type A: :py:class:`SparseBlockStructuredMatrix`, in
:param A: the SparseBlockStructuredMatrix matrix
:type sparseMat: CSparseMatrix, in
:param sparseMat: pointer on the initialized sparse Matrix
:rtype: int
:return: 0 if ok
"""
return _pynumerics.SBM_to_sparse_init_memory(A, sparseMat)
[docs]def SBM_row_permutation(rowIndex: "unsigned int *", A: "SparseBlockStructuredMatrix", C: "SparseBlockStructuredMatrix") -> "void":
r"""
:param [in]: rowIndex: permutation: the row numC of C is the row rowIndex[numC] of A.
:param [in]: A The source SBM.
:param [out]: C The target SBM. It assumes the structure SBM has been allocated.
The memory allocation for its menber is done inside.
NB : The blocks are not copied.
"""
return _pynumerics.SBM_row_permutation(rowIndex, A, C)
[docs]def SBM_column_permutation(colIndex: "unsigned int *", A: "SparseBlockStructuredMatrix", C: "SparseBlockStructuredMatrix") -> "void":
r"""
:param [in]: colIndex: permutation: the col numC of C is the col colIndex[numC] of A.
:param [in]: A The source SBM.
:param [out]: C The target SBM. It assumes the structure SBM has been allocated.
The memory allocation for its menber is done inside.
NB : The blocks are not copied.
"""
return _pynumerics.SBM_column_permutation(colIndex, A, C)
def SBCM_null(MC: "SparseBlockCoordinateMatrix") -> "void":
return _pynumerics.SBCM_null(MC)
def SBCM_new() -> "SparseBlockCoordinateMatrix *":
return _pynumerics.SBCM_new()
[docs]def SBCM_new_3x3(m: "unsigned int", n: "unsigned int", nbblocks: "unsigned int", row: "unsigned int *", column: "unsigned int *", block: "double *") -> "SparseBlockCoordinateMatrix *":
r"""
allocate a SparseBlockCoordinateMatrix from a list of 3x3
blocks
:type m: int, in
:param m: the number of rows
:type n: int, in
:param n: the number of colums
:type nbblocks: int, in
:param nbblocks: the number of blocks
:type row: int, in
:param row: a pointer to row of each block
:type column: int, in
:param column: a pointer to column of each block
:type block: float, in
:param block: a pointer to each block
:rtype: :py:class:`SparseBlockCoordinateMatrix`
:return: a pointer to a SparseBlockCoordinateMatrix structure
"""
return _pynumerics.SBCM_new_3x3(m, n, nbblocks, row, column, block)
[docs]def SBCM_free_3x3(MC: "SparseBlockCoordinateMatrix") -> "void":
r"""
free allocated memory in newSparseBlockCoordinateMatrix functions
:type MC: :py:class:`SparseBlockCoordinateMatrix`, in
:param MC: matrix pointer
"""
return _pynumerics.SBCM_free_3x3(MC)
[docs]def SBCM_to_SBM(MC: "SparseBlockCoordinateMatrix") -> "SparseBlockStructuredMatrix *":
r"""
copy a SparseBlockCoordinateMatrix to a SparseBlockStructuredMatrix
:type MC: :py:class:`SparseBlockCoordinateMatrix`, in
:param MC: the SparseBlockCoordinateMatrix matrix
:rtype: :py:class:`SparseBlockStructuredMatrix`
:return: a pointer to a SparseBlockCoordinateMatrix structure
"""
return _pynumerics.SBCM_to_SBM(MC)
[docs]def SBM_free_from_SBCM(M: "SparseBlockStructuredMatrix") -> "void":
r"""
free a SparseBlockStructuredMatrix created with SBCM_to_SBM
:type M: :py:class:`SparseBlockStructuredMatrix`, in/out
:param M: a SparseBlockStructuredMatrix to free
"""
return _pynumerics.SBM_free_from_SBCM(M)
[docs]def SBM_from_csparse(blocksize: "int", sparseMat: "CSparseMatrix const *const") -> "SparseBlockStructuredMatrix *":
r"""
Copy a Sparse Matrix into a SBM, with fixed blocksize
:type blocksize: int, in
:param blocksize: the blocksize
:type sparseMat: CSparseMatrix, in
:param sparseMat: pointer on the Sparse Matrix
:type outSBM: :py:class:`SparseBlockStructuredMatrix`, in/out
:param outSBM: pointer on an empty SparseBlockStructuredMatrix
:rtype: int
:return: 0 in ok
"""
return _pynumerics.SBM_from_csparse(blocksize, sparseMat)
[docs]class NumericsMatrixInternalData(object):
r"""Structure for simple workspaces"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
iWorkSize = property(_pynumerics.NumericsMatrixInternalData_iWorkSize_get, _pynumerics.NumericsMatrixInternalData_iWorkSize_set, doc=r""" size of iWork""")
iWork = property(_pynumerics.NumericsMatrixInternalData_iWork_get, _pynumerics.NumericsMatrixInternalData_iWork_set, doc=r""" integer workspace""")
sizeof_elt = property(_pynumerics.NumericsMatrixInternalData_sizeof_elt_get, _pynumerics.NumericsMatrixInternalData_sizeof_elt_set, doc=r""" sizeof_elt of an element in bytes (result of sizeof for instance)""")
dWorkSize = property(_pynumerics.NumericsMatrixInternalData_dWorkSize_get, _pynumerics.NumericsMatrixInternalData_dWorkSize_set, doc=r""" size of dWork""")
dWork = property(_pynumerics.NumericsMatrixInternalData_dWork_get, _pynumerics.NumericsMatrixInternalData_dWork_set, doc=r""" double workspace""")
isLUfactorized = property(_pynumerics.NumericsMatrixInternalData_isLUfactorized_get, _pynumerics.NumericsMatrixInternalData_isLUfactorized_set, doc=r""" true if the matrix has already been LU-factorized""")
isCholeskyfactorized = property(_pynumerics.NumericsMatrixInternalData_isCholeskyfactorized_get, _pynumerics.NumericsMatrixInternalData_isCholeskyfactorized_set, doc=r""" true if the matrix has already been Cholesky factorized""")
isLDLTfactorized = property(_pynumerics.NumericsMatrixInternalData_isLDLTfactorized_get, _pynumerics.NumericsMatrixInternalData_isLDLTfactorized_set, doc=r""" true if the matrix has already been LDLT factorized""")
isInversed = property(_pynumerics.NumericsMatrixInternalData_isInversed_get, _pynumerics.NumericsMatrixInternalData_isInversed_set, doc=r""" true if the matrix contains its inverse (in place inversion)""")
def __init__(self):
_pynumerics.NumericsMatrixInternalData_swiginit(self, _pynumerics.new_NumericsMatrixInternalData())
__swig_destroy__ = _pynumerics.delete_NumericsMatrixInternalData
# Register NumericsMatrixInternalData in _pynumerics:
_pynumerics.NumericsMatrixInternalData_swigregister(NumericsMatrixInternalData)
NM_DENSE = _pynumerics.NM_DENSE
r""" dense format"""
NM_SPARSE_BLOCK = _pynumerics.NM_SPARSE_BLOCK
r""" sparse block format"""
NM_SPARSE = _pynumerics.NM_SPARSE
r""" compressed column format"""
NM_UNKNOWN = _pynumerics.NM_UNKNOWN
r""" unset. Used in NM_null"""
[docs]class NumericsMatrix(object):
r"""
Interface to different type of matrices in numerics component.
See NM_* functions for linear algebra operations on dense, sparse block and sparse storage.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
storageType = property(_pynumerics.NumericsMatrix_storageType_get, _pynumerics.NumericsMatrix_storageType_set, doc=r"""
the type of storage:
0: dense (double*),
1: SparseBlockStructuredMatrix,
2: classical sparse (csc, csr or triplet) via CSparse (from T. Davis)
""")
size0 = property(_pynumerics.NumericsMatrix_size0_get, _pynumerics.NumericsMatrix_size0_set, doc=r""" number of rows""")
size1 = property(_pynumerics.NumericsMatrix_size1_get, _pynumerics.NumericsMatrix_size1_set, doc=r""" number of columns""")
matrix0 = property(_pynumerics.NumericsMatrix_matrix0_get, _pynumerics.NumericsMatrix_matrix0_set, doc=r""" dense storage""")
matrix1 = property(_pynumerics.NumericsMatrix_matrix1_get, _pynumerics.NumericsMatrix_matrix1_set, doc=r""" sparse block storage""")
matrix2 = property(_pynumerics.NumericsMatrix_matrix2_get, _pynumerics.NumericsMatrix_matrix2_set, doc=r""" csc, csr or triplet storage""")
internalData = property(_pynumerics.NumericsMatrix_internalData_get, _pynumerics.NumericsMatrix_internalData_set, doc=r""" internal storage, used for workspace among other things""")
version = property(_pynumerics.NumericsMatrix_version_get, _pynumerics.NumericsMatrix_version_set)
destructible = property(_pynumerics.NumericsMatrix_destructible_get, _pynumerics.NumericsMatrix_destructible_set, doc=r"""
pointer on the destructible
matrix, by default points toward
the matrix itself
""")
def __init__(self, o: "PyObject *"):
_pynumerics.NumericsMatrix_swiginit(self, _pynumerics.new_NumericsMatrix(o))
def set_matrix0(self, i: "int", j: "int", v: "double") -> "void":
return _pynumerics.NumericsMatrix_set_matrix0(self, i, j, v)
def get_matrix0(self, i: "int", j: "int") -> "double":
return _pynumerics.NumericsMatrix_get_matrix0(self, i, j)
def __setitem__(self, index: "PyObject *", v: "double") -> "PyObject *":
return _pynumerics.NumericsMatrix___setitem__(self, index, v)
def __getitem__(self, index: "PyObject *") -> "PyObject *":
return _pynumerics.NumericsMatrix___getitem__(self, index)
def __len__(self) -> "int":
return _pynumerics.NumericsMatrix___len__(self)
__swig_destroy__ = _pynumerics.delete_NumericsMatrix
# Register NumericsMatrix in _pynumerics:
_pynumerics.NumericsMatrix_swigregister(NumericsMatrix)
class BalancingMatrices(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
size0 = property(_pynumerics.BalancingMatrices_size0_get, _pynumerics.BalancingMatrices_size0_set)
size1 = property(_pynumerics.BalancingMatrices_size1_get, _pynumerics.BalancingMatrices_size1_set)
D1 = property(_pynumerics.BalancingMatrices_D1_get, _pynumerics.BalancingMatrices_D1_set)
D2 = property(_pynumerics.BalancingMatrices_D2_get, _pynumerics.BalancingMatrices_D2_set)
A = property(_pynumerics.BalancingMatrices_A_get, _pynumerics.BalancingMatrices_A_set)
def __init__(self):
_pynumerics.BalancingMatrices_swiginit(self, _pynumerics.new_BalancingMatrices())
__swig_destroy__ = _pynumerics.delete_BalancingMatrices
# Register BalancingMatrices in _pynumerics:
_pynumerics.BalancingMatrices_swigregister(BalancingMatrices)
NM_NONE = _pynumerics.NM_NONE
r""" keep nothing"""
NM_KEEP_FACTORS = _pynumerics.NM_KEEP_FACTORS
r""" keep all the factorization data (useful to reuse the factorization)"""
NM_PRESERVE = _pynumerics.NM_PRESERVE
r""" keep the matrix as-is (useful for the dense case)"""
[docs]def NM_new() -> "RawNumericsMatrix *":
r"""
Constructors and destructors *************** Creation of an empty NumericsMatrix.
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to allocated space
"""
return _pynumerics.NM_new()
def NM_eye(size: "int") -> "RawNumericsMatrix *":
return _pynumerics.NM_eye(size)
[docs]def NM_create(storageType: "NM_types", size0: "int", size1: "int") -> "RawNumericsMatrix *":
r"""
create a NumericsMatrix and allocate the memory according to the matrix type
:type storageType: int
:param storageType: the type of storage
:type size0: int
:param size0: number of rows
:type size1: int
:param size1: number of columns
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to a NumericsMatrix
"""
return _pynumerics.NM_create(storageType, size0, size1)
[docs]def NM_create_from_data(storageType: "int", size0: "int", size1: "int", data: "void *") -> "RawNumericsMatrix *":
r"""
create a NumericsMatrix and possibly set the data
:type storageType: int
:param storageType: the type of storage
:type size0: int
:param size0: number of rows
:type size1: int
:param size1: number of columns
:type data: void
:param data: pointer to the matrix data. If NULL, all matrixX fields are
set to NULL
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to a NumericsMatrix
"""
return _pynumerics.NM_create_from_data(storageType, size0, size1, data)
def NM_create_from_filename(filename: "char const *") -> "RawNumericsMatrix *":
return _pynumerics.NM_create_from_filename(filename)
def NM_create_from_file(file: "FILE *") -> "RawNumericsMatrix *":
return _pynumerics.NM_create_from_file(file)
[docs]def NM_version_copy(A: "NumericsMatrix", B: "NumericsMatrix") -> "void":
r"""
Copy NumericsMatrix version.
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type B: :py:class:`NumericsMatrix`, in/out
:param B: a NumericsMatrix
"""
return _pynumerics.NM_version_copy(A, B)
[docs]def NM_copy(A: "NumericsMatrix", B: "NumericsMatrix") -> "void":
r"""
Copy a NumericsMatrix inside another NumericsMatrix (deep).
Reallocations are performed if B cannot hold a copy of A
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type B: :py:class:`NumericsMatrix`, in/out
:param B: a NumericsMatrix
"""
return _pynumerics.NM_copy(A, B)
[docs]def NM_copy_to_sparse(A: "NumericsMatrix", B: "NumericsMatrix", threshold: "double") -> "void":
r"""
Copy a NumericsMatrix to s sparse one.
Allocation or reallocation are performed on B
Warning: It is assumed that B has been properly initialized: its storageType must
be set to NM_SPARSE.
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type B: :py:class:`NumericsMatrix`, in/out
:param B: a NumericsMatrix
:type threshold: float
:param threshold: if the original matrix is dense, a threshold can be applied
on the absolute value of the entries
"""
return _pynumerics.NM_copy_to_sparse(A, B, threshold)
[docs]def NM_duplicate(mat: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
create a NumericsMatrix similar to the another one. The structure is the same
:type mat: :py:class:`NumericsMatrix`
:param mat: the model matrix
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to a NumericsMatrix
"""
return _pynumerics.NM_duplicate(mat)
[docs]def numericsSparseMatrix(A: "NumericsMatrix") -> "NumericsSparseMatrix *":
r"""
Creation, if needed, of sparse matrix storage.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix
:rtype: :py:class:`NumericsSparseMatrix`
:return: a pointer on the sparse matrix storage
"""
return _pynumerics.numericsSparseMatrix(A)
[docs]def NM_triplet(A: "NumericsMatrix") -> "CSparseMatrix *":
r"""
Creation, if needed, of triplet storage from sparse block storage.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix initialized with sparsed block storage.
:rtype: CSparseMatrix
:return: the triplet sparse Matrix created in A.
"""
return _pynumerics.NM_triplet(A)
[docs]def NM_half_triplet(A: "NumericsMatrix") -> "CSparseMatrix *":
r"""
Creation, if needed, of half triplet storage from sparse block storage.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix initialized with sparsed block storage.
:rtype: CSparseMatrix
:return: the triplet sparse Matrix created in A.
"""
return _pynumerics.NM_half_triplet(A)
[docs]def NM_csc(A: "NumericsMatrix") -> "CSparseMatrix *":
r"""
Creation, if needed, of compress column storage of a NumericsMatrix.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix with sparse block storage initialized
:rtype: CSparseMatrix
:return: the compressed column CSparseMatrix created in A.
"""
return _pynumerics.NM_csc(A)
[docs]def NM_csc_trans(A: "NumericsMatrix") -> "CSparseMatrix *":
r"""
Creation, if needed, of the transposed compress column storage
from compress column storage.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix with sparse block storage.
:rtype: CSparseMatrix
:return: the transposed compressed column matrix created in A.
"""
return _pynumerics.NM_csc_trans(A)
[docs]def NM_csr(A: "NumericsMatrix") -> "CSparseMatrix *":
r"""
Creation, if needed, of compress row storage of a NumericsMatrix
Warning: This rely on the MKL
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix with sparse block storage initialized
:rtype: CSparseMatrix
:return: the compressed row CSparseMatrix created in A.
"""
return _pynumerics.NM_csr(A)
[docs]def NM_fill(M: "NumericsMatrix", storageType: "NM_types", size0: "int", size1: "int", data: "void *") -> "void":
r"""
fill an existing NumericsMatrix struct
:type M: :py:class:`NumericsMatrix`, in/out
:param M: the struct to fill
:type storageType: int
:param storageType: the type of storage
:type size0: int
:param size0: number of rows
:type size1: int
:param size1: number of columns
:type data: void
:param data: pointer to the matrix data. If NULL, all matrixX fields are
set to NULL
"""
return _pynumerics.NM_fill(M, storageType, size0, size1, data)
[docs]def NM_new_SBM(size0: "int", size1: "int", m1: "SparseBlockStructuredMatrix") -> "RawNumericsMatrix *":
r"""
new NumericsMatrix with sparse storage from minimal set of data
:type size0: int, in
:param size0: number of rows
:type size1: int, in
:param size1: number of columns
:type m1: :py:class:`SparseBlockStructuredMatrix`, in
:param m1: the SparseBlockStructuredMatrix
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to a NumericsMatrix
"""
return _pynumerics.NM_new_SBM(size0, size1, m1)
[docs]def NM_transpose(A: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
new NumericsMatrix equal to the transpose of a given matrix
:type A: :py:class:`NumericsMatrix`, in
:param A:
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer to a NumericsMatrix
"""
return _pynumerics.NM_transpose(A)
[docs]def NM_null(A: "NumericsMatrix") -> "void":
r"""
set NumericsMatrix fields to NULL
:type A: :py:class:`NumericsMatrix`
:param A: a matrix
"""
return _pynumerics.NM_null(A)
[docs]def NM_destructible(A: "NumericsMatrix") -> "bool":
r"""
Check if a matrix is destructible.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: boolean
:return: true if the matrix is destructible
"""
return _pynumerics.NM_destructible(A)
[docs]def NM_preserve(A: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
Preservation of a matrix before in-place transformations such as
factorizations.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer on the preserved Matrix;
"""
return _pynumerics.NM_preserve(A)
[docs]def NM_unpreserve(A: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
Set the matrix as destructible, clear the preserved data.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: :py:class:`RawNumericsMatrix`
:return: a pointer on the Matrix;
"""
return _pynumerics.NM_unpreserve(A)
[docs]def NM_LU_factorized(A: "NumericsMatrix") -> "bool":
r"""
Check for a previous LU factorization.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: boolean
:return: true if the matrix has been LU factorized.
"""
return _pynumerics.NM_LU_factorized(A)
[docs]def NM_Cholesky_factorized(A: "NumericsMatrix") -> "bool":
r"""
Check for a previous Cholesky factorization.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: boolean
:return: true if the matrix has been Cholesky factorized.
"""
return _pynumerics.NM_Cholesky_factorized(A)
[docs]def NM_LDLT_factorized(A: "NumericsMatrix") -> "bool":
r"""
Check for a previous LDLT factorization.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: boolean
:return: true if the matrix has been Cholesky factorized.
"""
return _pynumerics.NM_LDLT_factorized(A)
[docs]def NM_set_LU_factorized(A: "NumericsMatrix", flag: "bool") -> "void":
r"""
Set the factorization flag.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix,
:type flag: boolean, in
:param flag: a boolean.
"""
return _pynumerics.NM_set_LU_factorized(A, flag)
def NM_set_Cholesky_factorized(A: "NumericsMatrix", flag: "bool") -> "void":
return _pynumerics.NM_set_Cholesky_factorized(A, flag)
def NM_set_LDLT_factorized(A: "NumericsMatrix", flag: "bool") -> "void":
return _pynumerics.NM_set_LDLT_factorized(A, flag)
[docs]def NM_update_size(A: "NumericsMatrix") -> "void":
r"""
update the size of the matrix based on the matrix data
:type A: :py:class:`NumericsMatrix`, in/out
:param A: the matrix which size is updated
"""
return _pynumerics.NM_update_size(A)
[docs]def NM_csc_alloc(A: "NumericsMatrix", nzmax: "long") -> "void":
r"""
Allocate a csc matrix in A
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type nzmax: int
:param nzmax: number of non-zero elements
"""
return _pynumerics.NM_csc_alloc(A, nzmax)
[docs]def NM_csc_empty_alloc(A: "NumericsMatrix", nzmax: "long") -> "void":
r"""
Allocate a csc matrix in A and set the vector of
column pointers to 0 such that the matrix is empty.
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type nzmax: int
:param nzmax: number of non-zero elements
"""
return _pynumerics.NM_csc_empty_alloc(A, nzmax)
[docs]def NM_triplet_alloc(A: "NumericsMatrix", nzmax: "long") -> "void":
r"""
Allocate a triplet matrix in A
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type nzmax: int
:param nzmax: maximum number of non-zero elements
"""
return _pynumerics.NM_triplet_alloc(A, nzmax)
[docs]def NM_clear(m: "NumericsMatrix") -> "void":
r"""
Free memory for a NumericsMatrix. Warning: call this function only if you are sure that
memory has been allocated for the structure in Numerics. This function is assumed that the memory is "owned" by this structure.
Note that this function does not free m.
:type m: :py:class:`NumericsMatrix`
:param m: the matrix to be deleted.
"""
return _pynumerics.NM_clear(m)
def NM_free(m: "NumericsMatrix") -> "NumericsMatrix *":
return _pynumerics.NM_free(m)
[docs]def NM_clear_not_dense(m: "NumericsMatrix") -> "void":
r"""
Free memory for a NumericsMatrix except the dense matrix that is assumed not to be owned.
:type m: :py:class:`NumericsMatrix`
:param m: the matrix to be cleared.
"""
return _pynumerics.NM_clear_not_dense(m)
def NM_free_not_dense(m: "NumericsMatrix") -> "NumericsMatrix *":
return _pynumerics.NM_free_not_dense(m)
[docs]def NM_clear_not_SBM(m: "NumericsMatrix") -> "void":
r"""
Free memory for a NumericsMatrix except the SBM matrix that is assumed not to be owned.
Note that this function does not free m.
:type m: :py:class:`NumericsMatrix`
:param m: the matrix to be cleared.
"""
return _pynumerics.NM_clear_not_SBM(m)
def NM_free_not_SBM(m: "NumericsMatrix") -> "NumericsMatrix *":
return _pynumerics.NM_free_not_SBM(m)
[docs]def NM_clear_other_storages(M: "NumericsMatrix", storageType: "NM_types") -> "void":
r"""
Free memory for a NumericsMatrix except for a given storage. Warning: call this function only if you are sure that
memory has been allocated for the structure in Numerics. This function is assumed that the memory is "owned" by this structure.
Note that this function does not free m.
:param m: the matrix to be deleted.
:type storageType: int
:param storageType: to be kept.
"""
return _pynumerics.NM_clear_other_storages(M, storageType)
[docs]def NM_zentry(M: "NumericsMatrix", i: "int", j: "int", val: "double", threshold: "double") -> "void":
r"""
insert an non zero entry into a NumericsMatrix.
for storageType = NM_SPARSE, a conversion to triplet is done for performing the entry in the
matrix. This method is expensive in terms of memory management. For a lot of entries, use
preferably a triplet matrix.
:type M: :py:class:`NumericsMatrix`
:param M: the NumericsMatrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type val: float
:param val: the value to be inserted.
:type threshold: float
:param threshold: a threshold to filter the small value in magnitude (useful for dense to sparse conversion)
"""
return _pynumerics.NM_zentry(M, i, j, val, threshold)
[docs]def NM_entry(M: "NumericsMatrix", i: "int", j: "int", val: "double") -> "void":
r"""
insert an entry into a NumericsMatrix.
for storageType = NM_SPARSE, a conversion to triplet is done for performing the entry in the
matrix. This method is expensive in terms of memory management. For a lot of entries, use
preferably a triplet matrix.
:type M: :py:class:`NumericsMatrix`
:param M: the NumericsMatrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:type val: float
:param val: the value to be inserted.
"""
return _pynumerics.NM_entry(M, i, j, val)
[docs]def NM_get_value(M: "NumericsMatrix", i: "int", j: "int") -> "double":
r"""
get the value of a NumericsMatrix.
:type M: :py:class:`NumericsMatrix`
:param M: the NumericsMatrix
:type i: int
:param i: row index
:type j: int
:param j: column index
:rtype: float
:return: the value to be inserted.
"""
return _pynumerics.NM_get_value(M, i, j)
[docs]def NM_equal(A: "NumericsMatrix", B: "NumericsMatrix") -> "bool":
r"""
compare to NumericsMatrix up to machine accuracy (DBL_EPSILON)
:type A: :py:class:`NumericsMatrix`
:param A: the NumericsMatrix
:type B: :py:class:`NumericsMatrix`
:param B: the NumericsMatrix
"""
return _pynumerics.NM_equal(A, B)
[docs]def NM_compare(A: "NumericsMatrix", B: "NumericsMatrix", tol: "double") -> "bool":
r"""
compare to NumericsMatrix up to a given tolerance
:type A: :py:class:`NumericsMatrix`
:param A: the NumericsMatrix
:type B: :py:class:`NumericsMatrix`
:param B: the NumericsMatrix
:type tol: float
:param tol: the tolerance
"""
return _pynumerics.NM_compare(A, B, tol)
[docs]def NM_nnz(M: "NumericsMatrix") -> "size_t":
r"""
return the number of non-zero element. For a dense matrix, it is the
product of the dimensions (e.g. an upper bound). For a sparse matrix, it is the true number
:type M: :py:class:`NumericsMatrix`
:param M: the matrix
:rtype: int
:return: the number (or an upper bound) of non-zero elements in the matrix
"""
return _pynumerics.NM_nnz(M)
[docs]def NM_copy_diag_block3(M: "NumericsMatrix", block_row_nb: "int", Block: "double **") -> "void":
r"""
get a 3x3 diagonal block of a NumericsMatrix. No allocation is done.
:type M: :py:class:`NumericsMatrix`, in
:param M: a NumericsMatrix
:type block_row_nb: int, in
:param block_row_nb: the number of the block row
:type Block: float, out
:param Block: the target.
In all cases (dense, sbm, and sparse) (*Block) must be allocated by caller.
A copy is always performed
"""
return _pynumerics.NM_copy_diag_block3(M, block_row_nb, Block)
[docs]def NM_insert(A: "NumericsMatrix", B: "NumericsMatrix", start_i: "unsigned int const", start_j: "unsigned int const") -> "void":
r"""
Set the submatrix B into the matrix A on the position defined in
(start_i, start_j) position.
:type A: :py:class:`NumericsMatrix`, in
:param A: a pointer to NumerixMatrix
:type B: :py:class:`NumericsMatrix`, in
:param B: a pointer toNumericsMatrix
:type start_i: int, in
:param start_i: a start row index
:type start_j: int, in
:param start_j: a start column index
"""
return _pynumerics.NM_insert(A, B, start_i, start_j)
[docs]def NM_prod_mv_3x3(sizeX: "int", sizeY: "int", A: "NumericsMatrix", x: "double *const", y: "double *") -> "void":
r"""
Matrix - vector product y = A*x + y
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type A: :py:class:`NumericsMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
"""
return _pynumerics.NM_prod_mv_3x3(sizeX, sizeY, A, x, y)
[docs]def NM_row_prod(sizeX: "int", sizeY: "int", currentRowNumber: "int", A: "NumericsMatrix", x: "double const *const", y: "double *", init: "int") -> "void":
r"""
Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (sizeY rows and sizeX columns)
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type currentRowNumber: int, in
:param currentRowNumber: position of the first row of rowA in A (warning: real row if A is a double*, block-row if A is a SparseBlockStructuredMatrix)
:type A: :py:class:`NumericsMatrix`, in
:param A: the matrix to be multiplied
:type x: double, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type init: int, in
:param init: = 0 for y += Ax, =1 for y = Ax
"""
return _pynumerics.NM_row_prod(sizeX, sizeY, currentRowNumber, A, x, y, init)
[docs]def NM_row_prod_no_diag(sizeX: "size_t", sizeY: "size_t", block_start: "int", row_start: "size_t", A: "NumericsMatrix", x: "double *", y: "double *", xsave: "double *", init: "bool") -> "void":
r"""
Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (sizeY rows and sizeX columns)
:type sizeX: int, in
:param sizeX: dim of the vector x
:type sizeY: int, in
:param sizeY: dim of the vector y
:type block_start: int, in
:param block_start: block number (only used for SBM)
:type row_start: int, in
:param row_start: position of the first row of A (unused if A is SBM)
:type A: :py:class:`NumericsMatrix`, in
:param A: the matrix to be multiplied
:type x: float, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type xsave: float, in
:param xsave: storage for saving the part of x set to 0
:type init: boolean, in
:param init: if True y = Ax, else y += Ax
"""
return _pynumerics.NM_row_prod_no_diag(sizeX, sizeY, block_start, row_start, A, x, y, xsave, init)
[docs]def NM_row_prod_no_diag3(sizeX: "size_t", block_start: "int", row_start: "size_t", A: "NumericsMatrix", x: "double *", y: "double *", init: "bool") -> "void":
r"""
Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (3 rows and sizeX columns)
:type sizeX: int, in
:param sizeX: dim of the vector x
:type block_start: int, in
:param block_start: block number (only used for SBM)
:type row_start: int, in
:param row_start: position of the first row of A (unused if A is SBM)
:type A: :py:class:`NumericsMatrix`, in
:param A: the matrix to be multiplied
:type x: float, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type init: boolean, in
:param init: if True y = Ax, else y += Ax
"""
return _pynumerics.NM_row_prod_no_diag3(sizeX, block_start, row_start, A, x, y, init)
[docs]def NM_row_prod_no_diag2(sizeX: "size_t", block_start: "int", row_start: "size_t", A: "NumericsMatrix", x: "double *", y: "double *", init: "bool") -> "void":
r"""
Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (2 rows and sizeX columns)
:type sizeX: int, in
:param sizeX: dim of the vector x
:type block_start: int, in
:param block_start: block number (only used for SBM)
:type row_start: int, in
:param row_start: position of the first row of A (unused if A is SBM)
:type A: :py:class:`NumericsMatrix`, in
:param A: the matrix to be multiplied
:type x: float, in
:param x: the vector to be multiplied
:type y: float, in/out
:param y: the resulting vector
:type init: boolean, in
:param init: if True y = Ax, else y += Ax
"""
return _pynumerics.NM_row_prod_no_diag2(sizeX, block_start, row_start, A, x, y, init)
def NM_row_prod_no_diag1x1(sizeX: "size_t", block_start: "int", row_start: "size_t", A: "NumericsMatrix", x: "double *", y: "double *", init: "bool") -> "void":
return _pynumerics.NM_row_prod_no_diag1x1(sizeX, block_start, row_start, A, x, y, init)
[docs]def NM_gemv(alpha: "double const", A: "NumericsMatrix", x: "double const *", beta: "double const", y: "double *") -> "void":
r"""
Matrix vector multiplication : y = alpha A x + beta y
:type alpha: float, in
:param alpha: scalar
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type x: float, in
:param x: pointer on a dense vector of size A->size1
:type beta: float, in
:param beta: scalar
:type y: float, in/out
:param y: pointer on a dense vector of size A->size1
"""
return _pynumerics.NM_gemv(alpha, A, x, beta, y)
[docs]def NM_gemm(alpha: "double const", A: "NumericsMatrix", B: "NumericsMatrix", beta: "double const", C: "NumericsMatrix") -> "void":
r"""
Matrix matrix multiplication : C = alpha A B + beta C
:type alpha: float, in
:param alpha: scalar
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type B: :py:class:`NumericsMatrix`, in
:param B: a NumericsMatrix
:type beta: float, in
:param beta: scalar
:type C: :py:class:`NumericsMatrix`, in/out
:param C: a NumericsMatrix
"""
return _pynumerics.NM_gemm(alpha, A, B, beta, C)
[docs]def NM_multiply(A: "NumericsMatrix", B: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
Matrix matrix multiplication : C = A B
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type B: :py:class:`NumericsMatrix`, in
:param B: a NumericsMatrix
:param C: a NumericsMatrix
"""
return _pynumerics.NM_multiply(A, B)
[docs]def NM_tgemv(alpha: "double const", A: "NumericsMatrix", x: "double const *", beta: "double const", y: "double *") -> "void":
r"""
Transposed matrix multiplication : y += alpha transpose(A) x + y
:type alpha: float, in
:param alpha: scalar
:type A: :py:class:`NumericsMatrix`, in
:param A: a NumericsMatrix
:type x: float, in
:param x: pointer on a dense vector of size A->size1
:type beta: float, in
:param beta: scalar
:type y: float, in/out
:param y: pointer on a dense vector of size A->size1
"""
return _pynumerics.NM_tgemv(alpha, A, x, beta, y)
def NM_dense_to_sparse(A: "NumericsMatrix", B: "NumericsMatrix", threshold: "double") -> "void":
return _pynumerics.NM_dense_to_sparse(A, B, threshold)
[docs]def NM_to_dense(A: "NumericsMatrix", B: "NumericsMatrix") -> "int":
r"""
Copy a NumericsMatrix into another with dense storage.
:type A: :py:class:`NumericsMatrix`
:param A: source matrix (any kind of storage)
:type B: :py:class:`NumericsMatrix`
:param B: targeted matrix, must be dense with the same dimension as A
"""
return _pynumerics.NM_to_dense(A, B)
[docs]def NM_dense_display_matlab(m: "double *", nRow: "int", nCol: "int", lDim: "int") -> "void":
r"""
Screen display of the matrix content stored as a double * array in Fortran style
:type m: float
:param m: the matrix to be displayed
:type nRow: int
:param nRow: the number of rows
:type nCol: int
:param nCol: the number of columns
:type lDim: int
:param lDim: the leading dimension of M
"""
return _pynumerics.NM_dense_display_matlab(m, nRow, nCol, lDim)
[docs]def NM_dense_display(m: "double *", nRow: "int", nCol: "int", lDim: "int") -> "void":
r"""
Screen display of the matrix content stored as a double * array in Fortran style
:type m: float
:param m: the matrix to be displayed
:type nRow: int
:param nRow: the number of rows
:type nCol: int
:param nCol: the number of columns
:type lDim: int
:param lDim: the leading dimension of M
"""
return _pynumerics.NM_dense_display(m, nRow, nCol, lDim)
[docs]def NM_vector_display(m: "double *", nRow: "int") -> "void":
r"""
Screen display of the vector content stored as a double * array
:type m: float
:param m: the vector to be displayed
:type nRow: int
:param nRow: the number of rows
"""
return _pynumerics.NM_vector_display(m, nRow)
[docs]def NM_display(M: "NumericsMatrix") -> "void":
r"""
Screen display of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be displayed
"""
return _pynumerics.NM_display(M)
[docs]def NM_display_storageType(M: "NumericsMatrix") -> "void":
r"""
Screen display of the matrix storage
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be displayed
"""
return _pynumerics.NM_display_storageType(M)
[docs]def NM_display_row_by_row(m: "NumericsMatrix") -> "void":
r"""
Screen display raw by raw of the matrix content
:type m: :py:class:`NumericsMatrix`
:param m: the matrix to be displayed
"""
return _pynumerics.NM_display_row_by_row(m)
[docs]def NM_write_in_filename(M: "NumericsMatrix", filename: "char const *") -> "void":
r"""
matrix I/O ********************
PrintInFile of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be printed
:type filename: string
:param filename: the corresponding name of the file
"""
return _pynumerics.NM_write_in_filename(M, filename)
[docs]def NM_read_in_filename(M: "NumericsMatrix", filename: "char const *") -> "void":
r"""
Read in file of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be read
:type filename: string
:param filename: the corresponding name of the file
"""
return _pynumerics.NM_read_in_filename(M, filename)
[docs]def NM_write_in_file(M: "NumericsMatrix", file: "FILE *") -> "void":
r"""
PrintInFile of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be printed
:type file: FILE
:param file: filename the corresponding file
"""
return _pynumerics.NM_write_in_file(M, file)
[docs]def NM_read_in_file(M: "NumericsMatrix", file: "FILE *") -> "void":
r"""
Read in file of the matrix content without performing memory allocation
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be read
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.NM_read_in_file(M, file)
[docs]def NM_new_from_file(file: "FILE *") -> "RawNumericsMatrix *":
r"""
Create from file a NumericsMatrix with memory allocation
:type file: FILE
:param file: the corresponding file
:rtype: :py:class:`RawNumericsMatrix`
:return: 0 if the matrix
"""
return _pynumerics.NM_new_from_file(file)
def NM_new_from_filename(filename: "char const *") -> "RawNumericsMatrix *":
return _pynumerics.NM_new_from_filename(filename)
[docs]def NM_write_in_file_scilab(M: "NumericsMatrix", file: "FILE *") -> "void":
r"""
NM_write_in_file_scilab of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be printed
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.NM_write_in_file_scilab(M, file)
[docs]def NM_write_in_file_python(M: "NumericsMatrix", file: "FILE *") -> "void":
r"""
NM_write_in_file_python of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be printed
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.NM_write_in_file_python(M, file)
[docs]def NM_read_in_file_scilab(M: "NumericsMatrix", file: "FILE *") -> "void":
r"""
Read in file for scilab of the matrix content
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to be read
:type file: FILE
:param file: the corresponding file
"""
return _pynumerics.NM_read_in_file_scilab(M, file)
[docs]def NM_clearDense(A: "NumericsMatrix") -> "void":
r"""
Clear dense storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearDense(A)
[docs]def NM_clearSparseBlock(A: "NumericsMatrix") -> "void":
r"""
Clear sparse block storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearSparseBlock(A)
[docs]def NM_clearSparse(A: "NumericsMatrix") -> "void":
r"""
Clear sparse data, if it is existent.
The linear solver parameters are also cleared.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearSparse(A)
[docs]def NM_clearTriplet(A: "NumericsMatrix") -> "void":
r"""
Clear triplet storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearTriplet(A)
[docs]def NM_clearHalfTriplet(A: "NumericsMatrix") -> "void":
r"""
Clear half triplet storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearHalfTriplet(A)
[docs]def NM_clearCSC(A: "NumericsMatrix") -> "void":
r"""
Clear compressed column storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearCSC(A)
[docs]def NM_clearCSCTranspose(A: "NumericsMatrix") -> "void":
r"""
Clear transposed compressed column storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearCSCTranspose(A)
[docs]def NM_clearCSR(A: "NumericsMatrix") -> "void":
r"""
Clear compressed row storage, if it is existent.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearCSR(A)
[docs]def NM_clearSparseStorage(A: "NumericsMatrix") -> "void":
r"""
Clear triplet, csc, csc transposed storage, if they are existent.
Linear solver parameters are preserved.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a Numericsmatrix
"""
return _pynumerics.NM_clearSparseStorage(A)
[docs]def NM_LU_factorize(A: "NumericsMatrix") -> "int":
r"""
LU factorization of the matrix. If the matrix has already been
factorized (i.e if NM_LU_factorized(A) return true), nothing is
done. To force a new factorization one has to set factorization
flag to false : NM_set_LU_factorized(A, false) before the call to
NM_LU_factorize.
If the matrix is preserved, that means that a call to
NM_preserve(A) has been done before the call to NM_LU_factorize,
it is not destroyed, but the factorized part remains accessible for
subsequent calls to NM_LU_solve.
If the matrix is not preserved, then it is replaced by the
factorized part.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix
:rtype: int
:return: an int, 0 means the matrix has been factorized.
"""
return _pynumerics.NM_LU_factorize(A)
def NM_Cholesky_factorize(A: "NumericsMatrix") -> "int":
return _pynumerics.NM_Cholesky_factorize(A)
def NM_LDLT_factorize(A: "NumericsMatrix") -> "int":
return _pynumerics.NM_LDLT_factorize(A)
[docs]def NM_LU_solve(A: "NumericsMatrix", b: "double *", nrhs: "unsigned int") -> "int":
r"""
Solve linear system with multiple right hand size. A call to
NM_LU_factorize is done at the beginning.
:type A: :py:class:`NumericsMatrix`, in
:param A: the NumericsMatrix. A is not destroyed if it has
been preserved by a call to NM_preserve(A).
:type b: float, in/out
:param b: the right hand size which is a pointer on a
matrix of double. It is replaced by the solutions
:type nrhs: int, in
:param nrhs: the number of right hand side.
:rtype: int
:return: 0 if the solve succeeded.
"""
return _pynumerics.NM_LU_solve(A, b, nrhs)
def NM_LU_solve_matrix_rhs(Ao: "NumericsMatrix", B: "NumericsMatrix") -> "int":
return _pynumerics.NM_LU_solve_matrix_rhs(Ao, B)
def NM_Cholesky_solve(A: "NumericsMatrix", b: "double *", nrhs: "unsigned int") -> "int":
return _pynumerics.NM_Cholesky_solve(A, b, nrhs)
def NM_Cholesky_solve_matrix_rhs(Ao: "NumericsMatrix", B: "NumericsMatrix") -> "int":
return _pynumerics.NM_Cholesky_solve_matrix_rhs(Ao, B)
def NM_LDLT_solve(A: "NumericsMatrix", b: "double *", nrhs: "unsigned int") -> "int":
return _pynumerics.NM_LDLT_solve(A, b, nrhs)
def NM_gesv_expert(A: "NumericsMatrix", b: "double *", keep: "unsigned int") -> "int":
return _pynumerics.NM_gesv_expert(A, b, keep)
def NM_posv_expert(A: "NumericsMatrix", b: "double *", keep: "unsigned int") -> "int":
return _pynumerics.NM_posv_expert(A, b, keep)
def NM_gesv_expert_multiple_rhs(A: "NumericsMatrix", b: "double *", n_rhs: "unsigned int", keep: "unsigned int") -> "int":
return _pynumerics.NM_gesv_expert_multiple_rhs(A, b, n_rhs, keep)
[docs]def NM_LU_inv(A: "NumericsMatrix") -> "NumericsMatrix *":
r"""
Computation of the inverse of a NumericsMatrix A usinf NM_gesv_expert
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix.
:rtype: :py:class:`NumericsMatrix`
:return: the matrix inverse.
"""
return _pynumerics.NM_LU_inv(A)
def NM_inverse_diagonal_block_matrix_in_place(A: "NumericsMatrix") -> "int":
return _pynumerics.NM_inverse_diagonal_block_matrix_in_place(A)
[docs]def NM_gesv(A: "NumericsMatrix", b: "double *", preserve: "bool") -> "int":
r"""
Direct computation of the solution of a real system of linear
equations: A x = b.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix. On a dense factorisation
A.iWork is initialized.
:type b: float, in/out
:param b: pointer on a dense vector of size A->size1
:type preserve: boolean
:param preserve: preserve the original matrix data. Only useful in the
dense case, where the LU factorization is done in-place.
:rtype: int
:return: 0 if successful, else the error is specific to the backend solver
used
"""
return _pynumerics.NM_gesv(A, b, preserve)
[docs]def NM_gesv_inv(A: "NumericsMatrix") -> "NumericsMatrix *":
r"""
Computation of the inverse of a NumericsMatrix A usinf NM_gesv_expert
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix.
:rtype: :py:class:`NumericsMatrix`
:return: the matrix inverse.
"""
return _pynumerics.NM_gesv_inv(A)
[docs]def NM_setSparseSolver(A: "NumericsMatrix", solver_id: "NSM_linear_solver") -> "void":
r"""
Set the linear solver
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type solver_id: int
:param solver_id: id of the solver
"""
return _pynumerics.NM_setSparseSolver(A, solver_id)
[docs]def NM_internalData(A: "NumericsMatrix") -> "NumericsMatrixInternalData *":
r"""
Get Matrix internal data with initialization if needed.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix.
:rtype: :py:class:`NumericsMatrixInternalData`
:return: a pointer on internal data.
"""
return _pynumerics.NM_internalData(A)
[docs]def NM_internalData_new(M: "NumericsMatrix") -> "void":
r"""
Allocate the internalData structure (but not its content!)
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to modify
"""
return _pynumerics.NM_internalData_new(M)
[docs]def NM_internalData_copy(A: "NumericsMatrix", B: "NumericsMatrix") -> "void":
r"""
Copy the internalData structure
:param M: the matrix to modify
"""
return _pynumerics.NM_internalData_copy(A, B)
[docs]def NM_iWork(A: "NumericsMatrix", size: "size_t", sizeof_elt: "size_t") -> "void *":
r"""
Integer work vector initialization, if needed.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: pointer on a NumericsMatrix.
:type size: int, in
:param size: number of element to allocate
:type sizeof_elt: int, in
:param sizeof_elt: of an element in bytes (result of sizeof for instance)
:rtype: void
:return: pointer on A->iWork allocated space of with the right size
"""
return _pynumerics.NM_iWork(A, size, sizeof_elt)
[docs]def NM_dWork(A: "NumericsMatrix", size: "int") -> "double *":
r"""
Double workspace initialization, if needed.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: pointer on a NumericsMatrix.
:type size: int, in
:param size: the size of needed space.
:rtype: float
:return: pointer on A->dWork allocated space of with the right size
"""
return _pynumerics.NM_dWork(A, size)
[docs]def NM_add_to_diag3(M: "NumericsMatrix", alpha: "double") -> "void":
r"""
Add a constant term to the diagonal elements, when the block of the SBM
are 3x3
:type M: :py:class:`NumericsMatrix`
:param M: the matrix
:type alpha: float
:param alpha: the term to add
"""
return _pynumerics.NM_add_to_diag3(M, alpha)
[docs]def NM_add_to_diag5(M: "NumericsMatrix", alpha: "double") -> "void":
r"""
Add a constant term to the diagonal elements, when the block of the SBM
are 5x5
:type M: :py:class:`NumericsMatrix`
:param M: the matrix
:type alpha: float
:param alpha: the term to add
"""
return _pynumerics.NM_add_to_diag5(M, alpha)
[docs]def NM_add(alpha: "double", A: "NumericsMatrix", beta: "double", B: "NumericsMatrix") -> "RawNumericsMatrix *":
r"""
Add two matrices with coefficients C = alpha*A + beta*B
:type alpha: float
:param alpha: the first coefficient
:type A: :py:class:`NumericsMatrix`
:param A: the first matrix
:type beta: float
:param beta: the second coefficient
:type B: :py:class:`NumericsMatrix`
:param B: the second matrix
:rtype: :py:class:`RawNumericsMatrix`
:return: C a new NumericsMatrix
"""
return _pynumerics.NM_add(alpha, A, beta, B)
[docs]def NM_scal(alpha: "double", A: "NumericsMatrix") -> "void":
r"""
Multiply a matrix with a double alpha*A --> A
:type alpha: float
:param alpha: the coefficient
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
"""
return _pynumerics.NM_scal(alpha, A)
[docs]def NM_assert(type: "NM_types", M: "NumericsMatrix") -> "void":
r"""
assert that a NumericsMatrix has the right structure given its type
:type type: int
:param type: expected type
:type M: :py:class:`NumericsMatrix`
:param M: the matrix to check
"""
return _pynumerics.NM_assert(type, M)
[docs]def NM_check(A: "NumericsMatrix") -> "int":
r"""
Check the matrix (the sparse format for now)
:type A: :py:class:`NumericsMatrix`
:param A: the matrix to check
:rtype: int
:return: 0 if the matrix storage is fine, 1 if not
"""
return _pynumerics.NM_check(A)
[docs]def NM_norm_1(A: "NumericsMatrix") -> "double":
r"""
Compute the 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum of a matrix (the sparse format for now)
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:rtype: float
:return: the norm
"""
return _pynumerics.NM_norm_1(A)
[docs]def NM_norm_inf(A: "NumericsMatrix") -> "double":
r"""
Compute the inf-norm of a sparse matrix = max (sum (abs (A^T))), largest row sum of a matrix (the sparse format for now)
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:rtype: float
:return: the norm
"""
return _pynumerics.NM_norm_inf(A)
def NM_is_symmetric(A: "NumericsMatrix") -> "int":
return _pynumerics.NM_is_symmetric(A)
def NM_symmetry_discrepancy(A: "NumericsMatrix") -> "double":
return _pynumerics.NM_symmetry_discrepancy(A)
[docs]def NM_convert(A: "NumericsMatrix") -> "NumericsMatrix *":
r"""
Pass a NumericsMatrix through swig typemaps.
This is only useful in python.
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:rtype: :py:class:`NumericsMatrix`
:return: a NumericsMatrix
"""
return _pynumerics.NM_convert(A)
[docs]def NM_iterated_power_method(A: "NumericsMatrix", tol: "double", itermax: "int") -> "double":
r"""
Compute the maximum eigenvalue with the iterated power method
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:rtype: float
:return: the maximum eigenvalue
"""
return _pynumerics.NM_iterated_power_method(A, tol, itermax)
[docs]def NM_max_by_columns(A: "NumericsMatrix", max: "double *") -> "int":
r"""
Compute the maximum values by columns
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type max: float
:param max: the vector of max that must be preallocated
:rtype: int
:return: info
"""
return _pynumerics.NM_max_by_columns(A, max)
[docs]def NM_max_by_rows(A: "NumericsMatrix", max: "double *") -> "int":
r"""
Compute the maximum values by rows
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type max: float
:param max: the vector of max that must be preallocated
:rtype: int
:return: info
"""
return _pynumerics.NM_max_by_rows(A, max)
[docs]def NM_max_abs_by_columns(A: "NumericsMatrix", max: "double *") -> "int":
r"""
Compute the maximum absolute values by columns
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type max: float
:param max: the vector of max that must be preallocated
:rtype: int
:return: info
"""
return _pynumerics.NM_max_abs_by_columns(A, max)
[docs]def NM_max_abs_by_rows(A: "NumericsMatrix", max: "double *") -> "int":
r"""
Compute the maximum absolute values by rows
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type max: float
:param max: the vector of max that must be preallocated
:rtype: int
:return: info
"""
return _pynumerics.NM_max_abs_by_rows(A, max)
[docs]def NM_compute_balancing_matrices(A: "NumericsMatrix", tol: "double", itermax: "int", B: "BalancingMatrices") -> "int":
r"""
Compute the balancing matrices for a given matrix by iteration
:type A: :py:class:`NumericsMatrix`
:param A: the matrix
:type tol: float
:param tol: tolerance on the balanced matrix
:type itermax: int
:param itermax: max number of iterations
:param alloated: structure for the balancing matrices and the balanced matrix
:rtype: int
:return: 0 if succeed.
"""
return _pynumerics.NM_compute_balancing_matrices(A, tol, itermax, B)
[docs]def NM_BalancingMatrices_new(A: "NumericsMatrix") -> "BalancingMatrices *":
r"""
Create a Balancing Matrices structure
:type A: :py:class:`NumericsMatrix`
:param A: the matrix to be balanced
"""
return _pynumerics.NM_BalancingMatrices_new(A)
[docs]def NM_BalancingMatrices_free(A: "BalancingMatrices") -> "BalancingMatrices *":
r""" free a Balancing Matrices structure"""
return _pynumerics.NM_BalancingMatrices_free(A)
[docs]def NM_reset_version(M: "NumericsMatrix", id: "NM_types") -> "void":
r"""
Reset the version of a NM_types storage.
:type M: :py:class:`NumericsMatrix`
:param M: the NumericsMatrix,
:type id: int
:param id: the NM_types storage
"""
return _pynumerics.NM_reset_version(M, id)
[docs]def NM_reset_versions(M: "NumericsMatrix") -> "void":
r"""
Reset versions of all storages.
:type M: :py:class:`NumericsMatrix`
:param M: the NumericsMatrix
"""
return _pynumerics.NM_reset_versions(M)
[docs]class linalg_data_t(object):
r"""generic data struct for linear algebra operations"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
id = property(_pynumerics.linalg_data_t_id_get, _pynumerics.linalg_data_t_id_set)
free_fn = property(_pynumerics.linalg_data_t_free_fn_get, _pynumerics.linalg_data_t_free_fn_set)
def __init__(self):
_pynumerics.linalg_data_t_swiginit(self, _pynumerics.new_linalg_data_t())
__swig_destroy__ = _pynumerics.delete_linalg_data_t
# Register linalg_data_t in _pynumerics:
_pynumerics.linalg_data_t_swigregister(linalg_data_t)
SN_LINALG_UNKNOWN = _pynumerics.SN_LINALG_UNKNOWN
SN_LINALG_MKL = _pynumerics.SN_LINALG_MKL
NSM_CSPARSE = _pynumerics.NSM_CSPARSE
NSM_MUMPS = _pynumerics.NSM_MUMPS
NSM_UMFPACK = _pynumerics.NSM_UMFPACK
NSM_MKL_PARDISO = _pynumerics.NSM_MKL_PARDISO
NSM_SUPERLU = _pynumerics.NSM_SUPERLU
NSM_SUPERLU_MT = _pynumerics.NSM_SUPERLU_MT
NSM_HSL = _pynumerics.NSM_HSL
NSM_CS_CSC = _pynumerics.NSM_CS_CSC
NSM_CS_CSR = _pynumerics.NSM_CS_CSR
[docs]class NSM_linear_solver_params(object):
r"""solver-specific parameters"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
solver = property(_pynumerics.NSM_linear_solver_params_solver_get, _pynumerics.NSM_linear_solver_params_solver_set)
LDLT_solver = property(_pynumerics.NSM_linear_solver_params_LDLT_solver_get, _pynumerics.NSM_linear_solver_params_LDLT_solver_set)
linear_solver_data = property(_pynumerics.NSM_linear_solver_params_linear_solver_data_get, _pynumerics.NSM_linear_solver_params_linear_solver_data_set, doc=r""" solver-specific data (or workspace)""")
solver_free_hook = property(_pynumerics.NSM_linear_solver_params_solver_free_hook_get, _pynumerics.NSM_linear_solver_params_solver_free_hook_set, doc=r""" solver-specific hook to free linear_solver_data""")
iWork = property(_pynumerics.NSM_linear_solver_params_iWork_get, _pynumerics.NSM_linear_solver_params_iWork_set, doc=r""" integer work vector array (internal)""")
iWorkSize = property(_pynumerics.NSM_linear_solver_params_iWorkSize_get, _pynumerics.NSM_linear_solver_params_iWorkSize_set, doc=r""" size of integer work vector array""")
dWork = property(_pynumerics.NSM_linear_solver_params_dWork_get, _pynumerics.NSM_linear_solver_params_dWork_set)
dWorkSize = property(_pynumerics.NSM_linear_solver_params_dWorkSize_get, _pynumerics.NSM_linear_solver_params_dWorkSize_set)
linalg_data = property(_pynumerics.NSM_linear_solver_params_linalg_data_get, _pynumerics.NSM_linear_solver_params_linalg_data_set, doc=r""" data for the linear algebra""")
def __init__(self):
_pynumerics.NSM_linear_solver_params_swiginit(self, _pynumerics.new_NSM_linear_solver_params())
__swig_destroy__ = _pynumerics.delete_NSM_linear_solver_params
# Register NSM_linear_solver_params in _pynumerics:
_pynumerics.NSM_linear_solver_params_swigregister(NSM_linear_solver_params)
NSM_UNKNOWN = _pynumerics.NSM_UNKNOWN
NSM_TRIPLET = _pynumerics.NSM_TRIPLET
NSM_CSC = _pynumerics.NSM_CSC
NSM_CSR = _pynumerics.NSM_CSR
NSM_HALF_TRIPLET = _pynumerics.NSM_HALF_TRIPLET
[docs]class NumericsSparseMatrix(object):
r"""
Sparse matrix representation in Numerics. The supported format are:
triplet (aka coordinate, COO), CSC (via CSparse) and CSR if MKL is used
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
triplet = property(_pynumerics.NumericsSparseMatrix_triplet_get, _pynumerics.NumericsSparseMatrix_triplet_set, doc=r""" triplet format, aka coordinate""")
half_triplet = property(_pynumerics.NumericsSparseMatrix_half_triplet_get, _pynumerics.NumericsSparseMatrix_half_triplet_set, doc=r""" half triplet format for symmetric matrices""")
csc = property(_pynumerics.NumericsSparseMatrix_csc_get, _pynumerics.NumericsSparseMatrix_csc_set, doc=r""" csc matrix""")
trans_csc = property(_pynumerics.NumericsSparseMatrix_trans_csc_get, _pynumerics.NumericsSparseMatrix_trans_csc_set, doc=r""" transpose of a csc matrix (used by CSparse)""")
csr = property(_pynumerics.NumericsSparseMatrix_csr_get, _pynumerics.NumericsSparseMatrix_csr_set, doc=r""" csr matrix, only supported with mkl""")
diag_indx = property(_pynumerics.NumericsSparseMatrix_diag_indx_get, _pynumerics.NumericsSparseMatrix_diag_indx_set, doc=r"""
indices for the diagonal terms.
Very useful for the proximal perturbation
""")
origin = property(_pynumerics.NumericsSparseMatrix_origin_get, _pynumerics.NumericsSparseMatrix_origin_set, doc=r""" original format of the matrix""")
linearSolverParams = property(_pynumerics.NumericsSparseMatrix_linearSolverParams_get, _pynumerics.NumericsSparseMatrix_linearSolverParams_set, doc=r""" solver-specific parameters""")
versions = property(_pynumerics.NumericsSparseMatrix_versions_get, _pynumerics.NumericsSparseMatrix_versions_set)
def __init__(self):
_pynumerics.NumericsSparseMatrix_swiginit(self, _pynumerics.new_NumericsSparseMatrix())
__swig_destroy__ = _pynumerics.delete_NumericsSparseMatrix
# Register NumericsSparseMatrix in _pynumerics:
_pynumerics.NumericsSparseMatrix_swigregister(NumericsSparseMatrix)
[docs]def NSM_null(A: "NumericsSparseMatrix") -> "void":
r"""
Initialize the fields of a NumericsSparseMatrix
:type A: :py:class:`NumericsSparseMatrix`
:param A: the sparse matrix
"""
return _pynumerics.NSM_null(A)
[docs]def NSM_new() -> "NumericsSparseMatrix *":
r"""
New and empty NumericsSparseMatrix with correctly initialized fields.
:rtype: :py:class:`NumericsSparseMatrix`
:return: a pointer on the allocated space.
"""
return _pynumerics.NSM_new()
def NSM_triplet_eye(size: "unsigned int") -> "NumericsSparseMatrix *":
return _pynumerics.NSM_triplet_eye(size)
[docs]def NSM_clear(A: "NumericsSparseMatrix") -> "NumericsSparseMatrix *":
r"""
Free allocated space for a NumericsSparseMatrix.
:type A: :py:class:`NumericsSparseMatrix`
:param A: a NumericsSparseMatrix
:rtype: :py:class:`NumericsSparseMatrix`
:return: NULL on success
"""
return _pynumerics.NSM_clear(A)
[docs]def NSM_version_copy(A: "NumericsSparseMatrix", B: "NumericsSparseMatrix") -> "void":
r"""
Copy NumericsSparseMatrix version.
:type A: :py:class:`NumericsSparseMatrix`
:param A: a NumericsSparseMatrix
:type B: :py:class:`NumericsSparseMatrix`
:param B: a NumericsSparseMatrix
"""
return _pynumerics.NSM_version_copy(A, B)
[docs]def NSM_copy(A: "NumericsSparseMatrix", B: "NumericsSparseMatrix") -> "void":
r"""
Copy a NumericsSparseMatrix.
:type A: :py:class:`NumericsSparseMatrix`
:param A: a NumericsSparseMatrix
:type B: :py:class:`NumericsSparseMatrix`
:param B: a NumericsSparseMatrix
"""
return _pynumerics.NSM_copy(A, B)
[docs]def NSM_clear_p(p: "void *") -> "void":
r"""
Free a workspace related to a LU factorization
:type p: void
:param p: the structure to free
"""
return _pynumerics.NSM_clear_p(p)
[docs]def NSM_data(A: "NumericsSparseMatrix") -> "double *":
r"""
Get the data part of sparse matrix
:type A: :py:class:`NumericsSparseMatrix`
:param A: the sparse matrix
:rtype: float
:return: a pointer to the data array
"""
return _pynumerics.NSM_data(A)
[docs]def NSM_linear_solver_data(p: "NSM_linear_solver_params") -> "void *":
r"""
Get the LU factors for cs_lusol
:type p: :py:class:`NSM_linear_solver_params`
:param p: the structure holding the data for the solver
"""
return _pynumerics.NSM_linear_solver_data(p)
[docs]def NSM_workspace(p: "NSM_linear_solver_params") -> "double *":
r"""
Get the workspace for the sparse solver
:type p: :py:class:`NSM_linear_solver_params`
:param p: the structure holding the data for the solver
:rtype: float
:return: the (double) workspace
"""
return _pynumerics.NSM_workspace(p)
[docs]def NSM_nnz(A: "CSparseMatrix const *const") -> "size_t":
r"""
get the number of non-zero (nnz) in a sparse matrix
:type A: CSparseMatrix
:param A: the matrix
:rtype: int
:return: the number of non-zero elements in the matrix
"""
return _pynumerics.NSM_nnz(A)
[docs]def NSM_diag_indices(M: "NumericsMatrix") -> "long *":
r"""
return the set of indices corresponding to the diagonal elements of the
matrix
Warning: should be better tested
:type M: :py:class:`NumericsMatrix`
:param M: the matrix
:rtype: int
:return: the list of indices for the diagonal elements
"""
return _pynumerics.NSM_diag_indices(M)
[docs]def NSM_linearSolverParams_free(p: "NSM_linear_solver_params") -> "NSM_linear_solver_params *":
r"""
Free allocated space for NSM_linear_solver_params.
:type p: :py:class:`NSM_linear_solver_params`
:param p: a NSM_linear_solver_params
:rtype: :py:class:`NSM_linear_solver_params`
:return: NULL on success
"""
return _pynumerics.NSM_linearSolverParams_free(p)
[docs]def NSM_linearSolverParams_new() -> "NSM_linear_solver_params *":
r"""
New and empty NSM_linear_solver_params.
:rtype: :py:class:`NSM_linear_solver_params`
:return: a pointer on the allocated space.
"""
return _pynumerics.NSM_linearSolverParams_new()
[docs]def NSM_linearSolverParams(A: "NumericsMatrix") -> "NSM_linear_solver_params *":
r"""
Get linear solver parameters with initialization if needed.
:type A: :py:class:`NumericsMatrix`, in/out
:param A: a NumericsMatrix.
:rtype: :py:class:`NSM_linear_solver_params`
:return: a pointer on parameters.
"""
return _pynumerics.NSM_linearSolverParams(A)
[docs]def NSM_fix_csc(A: "CSparseMatrix *") -> "void":
r"""
Check and fix a matrix, if needed
:type A: CSparseMatrix
:param A: the matrix to check, modified if necessary to have ordered indices
"""
return _pynumerics.NSM_fix_csc(A)
def NSM_sort_csc(A: "CSparseMatrix *") -> "void":
return _pynumerics.NSM_sort_csc(A)
[docs]def NSM_origin(M: "NumericsSparseMatrix") -> "unsigned int":
r"""
return the origin of a sparse part of a matrix
:type M: :py:class:`NumericsSparseMatrix`
:param M: the matrix
:rtype: int
:return: -1 if the matrix has no sparse representation, the origin
otherwise
"""
return _pynumerics.NSM_origin(M)
[docs]def NSM_get_origin(M: "NumericsSparseMatrix") -> "CSparseMatrix *":
r"""
return the sparse matrix that has the original label
:type M: :py:class:`NumericsSparseMatrix`
:param M: the matrix
:rtype: CSparseMatrix
:return: the sparse matrix that is at the origin, or NULL if an error occur
"""
return _pynumerics.NSM_get_origin(M)
def NSM_write_in_file(m: "NumericsSparseMatrix", file: "FILE *") -> "void":
return _pynumerics.NSM_write_in_file(m, file)
[docs]def NSM_new_from_file(file: "FILE *") -> "NumericsSparseMatrix *":
r"""
New and empty NumericsSparseMatrix with correctly initialized fields.
:rtype: :py:class:`NumericsSparseMatrix`
:return: a pointer on the allocated space.
"""
return _pynumerics.NSM_new_from_file(file)
def NSM_to_dense(A: "NumericsSparseMatrix", B: "double *") -> "int":
return _pynumerics.NSM_to_dense(A, B)
[docs]def NSM_version(M: "NumericsSparseMatrix", type: "NSM_t") -> "version_t":
r"""
Get current version of a type of csparse matrix.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix,
:type type: int
:param type: the type of sparse storage from NumericsSparseOrigin
:rtype: version_t
:return: a comparable version.
"""
return _pynumerics.NSM_version(M, type)
[docs]def NSM_max_version(M: "NumericsSparseMatrix") -> "version_t":
r"""
Get the maximum of versions of csparse matrices.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix,
:rtype: version_t
:return: a comparable version.
"""
return _pynumerics.NSM_max_version(M)
[docs]def NSM_set_version(M: "NumericsSparseMatrix", type: "NSM_t", value: "version_t") -> "void":
r"""
Set the version of a NumericsSparseMatrix.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix,
:type type: int
:param type: the NumericsSparseOrigin of storage,
:type value: version_t
:param value: the new version.
"""
return _pynumerics.NSM_set_version(M, type, value)
[docs]def NSM_reset_versions(M: "NumericsSparseMatrix") -> "void":
r"""
Reset all versions of a NumericsSparseMatrix.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix.
"""
return _pynumerics.NSM_reset_versions(M)
[docs]def NSM_reset_version(M: "NumericsSparseMatrix", type: "NSM_t") -> "void":
r"""
Reset version of a sparse storage.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix,
:type type: int
:param type: the NumericsSparseOrigin of storage.
"""
return _pynumerics.NSM_reset_version(M, type)
[docs]def NSM_inc_version(M: "NumericsSparseMatrix", type: "NSM_t") -> "void":
r"""
Increment the version of a NumericsSparseMatrix.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix,
:type type: int
:param type: the NumericsSparseOrigin of storage
"""
return _pynumerics.NSM_inc_version(M, type)
[docs]def NSM_latest_id(M: "NumericsSparseMatrix") -> "NSM_t":
r"""
Get the NumericsSparseOrigin with the latest version.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix
:rtype: int
:return: the NumericsSparseOrigin.
"""
return _pynumerics.NSM_latest_id(M)
[docs]def NSM_latest(M: "NumericsSparseMatrix") -> "CSparseMatrix *":
r"""
Get most recent CSparseMatrix.
:type M: :py:class:`NumericsSparseMatrix`
:param M: the NumericsSparseMatrix
:rtype: CSparseMatrix
:return: a pointer on a CSparseMatrix.
"""
return _pynumerics.NSM_latest(M)
def NM_MPI_rank(A: "NumericsMatrix") -> "int":
return _pynumerics.NM_MPI_rank(A)
def NM_MPI_copy(A: "NumericsMatrix", B: "NumericsMatrix") -> "void":
return _pynumerics.NM_MPI_copy(A, B)
[docs]def NM_MUMPS_copy(A: "NumericsMatrix", B: "NumericsMatrix") -> "void":
r"""
copy MUMPS id if compiled WITH_MUMPS, otherwise do nothing.
:type A: :py:class:`NumericsMatrix`
:param A: the source NumericsMatrix
:type B: :py:class:`NumericsMatrix`
:param B: the destination NumericsMatrix
"""
return _pynumerics.NM_MUMPS_copy(A, B)
SICONOS_MLCP_PGS = _pynumerics.SICONOS_MLCP_PGS
SICONOS_MLCP_RPGS = _pynumerics.SICONOS_MLCP_RPGS
SICONOS_MLCP_PSOR = _pynumerics.SICONOS_MLCP_PSOR
SICONOS_MLCP_RPSOR = _pynumerics.SICONOS_MLCP_RPSOR
SICONOS_MLCP_PATH = _pynumerics.SICONOS_MLCP_PATH
SICONOS_MLCP_ENUM = _pynumerics.SICONOS_MLCP_ENUM
SICONOS_MLCP_SIMPLEX = _pynumerics.SICONOS_MLCP_SIMPLEX
SICONOS_MLCP_DIRECT_ENUM = _pynumerics.SICONOS_MLCP_DIRECT_ENUM
SICONOS_MLCP_PATH_ENUM = _pynumerics.SICONOS_MLCP_PATH_ENUM
SICONOS_MLCP_DIRECT_SIMPLEX = _pynumerics.SICONOS_MLCP_DIRECT_SIMPLEX
SICONOS_MLCP_DIRECT_PATH = _pynumerics.SICONOS_MLCP_DIRECT_PATH
SICONOS_MLCP_DIRECT_PATH_ENUM = _pynumerics.SICONOS_MLCP_DIRECT_PATH_ENUM
SICONOS_MLCP_FB = _pynumerics.SICONOS_MLCP_FB
SICONOS_MLCP_DIRECT_FB = _pynumerics.SICONOS_MLCP_DIRECT_FB
SICONOS_MLCP_PGS_SBM = _pynumerics.SICONOS_MLCP_PGS_SBM
SICONOS_MLCP_LCP_LEMKE = _pynumerics.SICONOS_MLCP_LCP_LEMKE
SICONOS_IPARAM_MLCP_PGS_EXPLICIT = _pynumerics.SICONOS_IPARAM_MLCP_PGS_EXPLICIT
SICONOS_IPARAM_MLCP_PGS_SUM_ITER = _pynumerics.SICONOS_IPARAM_MLCP_PGS_SUM_ITER
SICONOS_IPARAM_MLCP_ENUM_USE_DGELS = _pynumerics.SICONOS_IPARAM_MLCP_ENUM_USE_DGELS
SICONOS_IPARAM_MLCP_NUMBER_OF_CONFIGURATIONS = _pynumerics.SICONOS_IPARAM_MLCP_NUMBER_OF_CONFIGURATIONS
SICONOS_IPARAM_MLCP_UPDATE_REQUIRED = _pynumerics.SICONOS_IPARAM_MLCP_UPDATE_REQUIRED
SICONOS_DPARAM_MLCP_PGS_SUM_ERRORS = _pynumerics.SICONOS_DPARAM_MLCP_PGS_SUM_ERRORS
SICONOS_DPARAM_MLCP_RHO = _pynumerics.SICONOS_DPARAM_MLCP_RHO
SICONOS_DPARAM_MLCP_OMEGA = _pynumerics.SICONOS_DPARAM_MLCP_OMEGA
SICONOS_DPARAM_MLCP_SIGN_TOL_NEG = _pynumerics.SICONOS_DPARAM_MLCP_SIGN_TOL_NEG
SICONOS_DPARAM_MLCP_SIGN_TOL_POS = _pynumerics.SICONOS_DPARAM_MLCP_SIGN_TOL_POS
[docs]class MLCP(object):
r"""
The Structure that contains and defines MLCProblem. Find :math:`(z,w)` such
that:
.. math::
\left\{ \begin{array}{l}
M \ z + q = w \\
w_1=0 \\
0 \le w_{2} \perp v \ge 0
\end{array}
\right.
\text{ with }
z=
\left[
\begin{array}{c}
u\\
v\\
\end{array}
\right]
\text{ and }
w=
\left[
\begin{array}{c}
w_{1}\\
w_{2}\\
\end{array}
\right]
:math:`u, w_{1}` are vectors of size n.
:math:`v, w_{2}` are vectors of size m.
ABCD format (see "R. W. {Cottle} and J. {Pang} and R. E. {Stone}", "The
Linear Complementarity Problem, Academic Press, Inc., 1992, Section 1.5 )
\f[
\left[
\begin{array}{cc}
A & C \\
D & B \\
\end{array}
\right]
\f]
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
isStorageType1 = property(_pynumerics.MLCP_isStorageType1_get, _pynumerics.MLCP_isStorageType1_set, doc=r"""
boolean for storageType1 1 if the problem
is saved using (M,q), 0 otherwise
""")
isStorageType2 = property(_pynumerics.MLCP_isStorageType2_get, _pynumerics.MLCP_isStorageType2_set, doc=r"""
boolean for storageType2 1 if the problem
is saved using (A,B,C,D,a,b), 0 otherwise
""")
n = property(_pynumerics.MLCP_n_get, _pynumerics.MLCP_n_set, doc=r""" number of equality constraints""")
m = property(_pynumerics.MLCP_m_get, _pynumerics.MLCP_m_set, doc=r""" number of complementarity constraints""")
blocksRows = property(_pynumerics.MLCP_blocksRows_get, _pynumerics.MLCP_blocksRows_set, doc=r"""
The rows from blocksRows[i] to blocksRows[i+1]-1
forms a block of equalities iif bloksIsComp[i]=0,
else the block is a complementarity block.
The number of total blocks is given by NbBlocks
such that blocksRows[NbBlocks] = n+m
""")
blocksIsComp = property(_pynumerics.MLCP_blocksIsComp_get, _pynumerics.MLCP_blocksIsComp_set, doc=r"""
if bloksIsComp[i]=0, then block i formed by the rows
from blocksRows[i] to blocksRows[i+1]-1 is an equality
block else the block is a complementarity block.
""")
M = property(_pynumerics.MLCP_M_get, _pynumerics.MLCP_M_set, doc=r""" M matrix of the MLCP""")
q = property(_pynumerics.MLCP_q_get, _pynumerics.MLCP_q_set, doc=r""" q vector of the MLCP""")
A = property(_pynumerics.MLCP_A_get, _pynumerics.MLCP_A_set, doc=r""" A matrix of the MLCP""")
B = property(_pynumerics.MLCP_B_get, _pynumerics.MLCP_B_set, doc=r""" B matrix of the MLCP""")
C = property(_pynumerics.MLCP_C_get, _pynumerics.MLCP_C_set, doc=r""" C matrix of the MLCP""")
D = property(_pynumerics.MLCP_D_get, _pynumerics.MLCP_D_set, doc=r""" D matrix of the MLCP""")
a = property(_pynumerics.MLCP_a_get, _pynumerics.MLCP_a_set, doc=r""" a vector of the MLCP""")
b = property(_pynumerics.MLCP_b_get, _pynumerics.MLCP_b_set, doc=r""" b vector of the MLCP""")
def __init__(self, *args):
_pynumerics.MLCP_swiginit(self, _pynumerics.new_MLCP(*args))
__swig_destroy__ = _pynumerics.delete_MLCP
# Register MLCP in _pynumerics:
_pynumerics.MLCP_swigregister(MLCP)
SICONOS_NONAME_STR = cvar.SICONOS_NONAME_STR
SICONOS_MLCP_PGS_STR = cvar.SICONOS_MLCP_PGS_STR
SICONOS_MLCP_RPGS_STR = cvar.SICONOS_MLCP_RPGS_STR
SICONOS_MLCP_PSOR_STR = cvar.SICONOS_MLCP_PSOR_STR
SICONOS_MLCP_RPSOR_STR = cvar.SICONOS_MLCP_RPSOR_STR
SICONOS_MLCP_PATH_STR = cvar.SICONOS_MLCP_PATH_STR
SICONOS_MLCP_ENUM_STR = cvar.SICONOS_MLCP_ENUM_STR
SICONOS_MLCP_SIMPLEX_STR = cvar.SICONOS_MLCP_SIMPLEX_STR
SICONOS_MLCP_DIRECT_ENUM_STR = cvar.SICONOS_MLCP_DIRECT_ENUM_STR
SICONOS_MLCP_PATH_ENUM_STR = cvar.SICONOS_MLCP_PATH_ENUM_STR
SICONOS_MLCP_DIRECT_SIMPLEX_STR = cvar.SICONOS_MLCP_DIRECT_SIMPLEX_STR
SICONOS_MLCP_DIRECT_PATH_STR = cvar.SICONOS_MLCP_DIRECT_PATH_STR
SICONOS_MLCP_DIRECT_PATH_ENUM_STR = cvar.SICONOS_MLCP_DIRECT_PATH_ENUM_STR
SICONOS_MLCP_FB_STR = cvar.SICONOS_MLCP_FB_STR
SICONOS_MLCP_DIRECT_FB_STR = cvar.SICONOS_MLCP_DIRECT_FB_STR
SICONOS_MLCP_PGS_SBM_STR = cvar.SICONOS_MLCP_PGS_SBM_STR
SICONOS_MLCP_LCP_LEMKE_STR = cvar.SICONOS_MLCP_LCP_LEMKE_STR
[docs]def mixedLinearComplementarity_free(problem: "MLCP") -> "void":
r"""
function to delete a MixedLinearComplementarityProblem
:type problem: :py:class:`MixedLinearComplementarityProblem`
:param problem: pointer to a MixedLinearComplementarityProblem to delete
"""
return _pynumerics.mixedLinearComplementarity_free(problem)
[docs]def mixedLinearComplementarity_new() -> "MixedLinearComplementarityProblem *":
r"""
create empty MLCP
:rtype: :py:class:`MixedLinearComplementarityProblem`
:return: empy MLCP
"""
return _pynumerics.mixedLinearComplementarity_new()
[docs]def mixedLinearComplementarity_display(p: "MLCP") -> "void":
r""" display a MLCP"""
return _pynumerics.mixedLinearComplementarity_display(p)
[docs]def mixedLinearComplementarity_printInFile(problem: "MLCP", file: "FILE *") -> "int":
r"""
function to write in a file a MixedLinearComplementarityProblem
:type problem: :py:class:`MixedLinearComplementarityProblem`
:param problem: pointer to a MixedLinearComplementarityProblem to print
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 0 if ok
"""
return _pynumerics.mixedLinearComplementarity_printInFile(problem, file)
[docs]def mixedLinearComplementarity_newFromFile(problem: "MLCP", file: "FILE *") -> "int":
r"""
Function to read and create a MixedLinearComplementarityProblem
from a file
:type problem: :py:class:`MixedLinearComplementarityProblem`
:param problem: pointer to a MixedLinearComplementarityProblem to create
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 0 if ok
"""
return _pynumerics.mixedLinearComplementarity_newFromFile(problem, file)
[docs]def mixedLinearComplementarity_newFromFileOld(problem: "MLCP", file: "FILE *") -> "int":
r"""
Function to read and create a MixedLinearComplementarityProblem
from a file
:type problem: :py:class:`MixedLinearComplementarityProblem`
:param problem: pointer to a MixedLinearComplementarityProblem to create
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 0 if ok
"""
return _pynumerics.mixedLinearComplementarity_newFromFileOld(problem, file)
[docs]def mixedLinearComplementarity_newFromFilename(problem: "MLCP", filename: "char const *") -> "int":
r"""
Function to read and create a MixedLinearComplementarityProblem
from a file
:type problem: :py:class:`MixedLinearComplementarityProblem`
:param problem: pointer to a MixedLinearComplementarityProblem to create
:type filename: string
:param filename: that contains the mlcp
:rtype: int
:return: 0 if ok
"""
return _pynumerics.mixedLinearComplementarity_newFromFilename(problem, filename)
[docs]def mixedLinearComplementarity_fromMtoABCD(problem: "MLCP") -> "MixedLinearComplementarityProblem *":
r""" Function to create a MLCP with ABCD format from M formatted MLCP"""
return _pynumerics.mixedLinearComplementarity_fromMtoABCD(problem)
[docs]def mlcp_driver_init(problem: "MLCP", options: "SolverOptions") -> "void":
r"""
General interface to initialize a solver.
Must be call for the following solvers:
- mlcp_enum
- mlcp_path
- mlcp_simplex
- mlcp_direct_enum
- mlcp_direct_path
- mlcp_direct_simplex
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: the MixedLinearComplementarityProblem structure which
handles the problem (M,q)
:type options: :py:class:`SolverOptions`, in
:param options: structure used to define the
solver(s) and their parameters
"""
return _pynumerics.mlcp_driver_init(problem, options)
[docs]def mlcp_driver_reset(problem: "MLCP", options: "SolverOptions") -> "void":
r"""
General interface to reset a solver.
Must be call for the following solvers:
- mlcp_enum
- mlcp_path
- mlcp_simplex
- mlcp_direct_enum
- mlcp_direct_path
- mlcp_direct_simplex
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: the MixedLinearComplementarityProblem structure which
handles the problem (M,q)
:type options: :py:class:`SolverOptions`, in
:param options: structure used to define the
solver(s) and their parameters
"""
return _pynumerics.mlcp_driver_reset(problem, options)
[docs]def mlcp_pgs(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
mlcp_pgs (Projected Gauss-Seidel) is a basic Projected Gauss-Seidel solver
for MLCP.
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q...)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_pgs(problem, z, w, options)
[docs]def mlcp_rpgs(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
mlcp_rpgs (Projected Gauss-Seidel) is a basic Projected Gauss-Seidel solver
for MLCP.
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q...)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_rpgs(problem, z, w, options)
[docs]def mlcp_psor(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
mlcp_psor (projected successive overrelaxation method) is a solver for MLCP.
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q...)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_psor(problem, z, w, options)
[docs]def mlcp_rpsor(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
mlcp_rpsor (regularized projected successive overrelaxation method) is a
solver for MLCP.
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q...)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_rpsor(problem, z, w, options)
[docs]def mlcp_path(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
path solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q...)
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_path(problem, z, w, options)
[docs]def mlcp_enum(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
enum solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_enum(problem, z, w, options)
[docs]def mlcp_direct(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
direct solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: MixedLinearComplementarityProblem* problem structure that
represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_direct(problem, z, w, options)
[docs]def mlcp_direct_enum(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
direct-enum solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_direct_enum(problem, z, w, options)
[docs]def mlcp_direct_simplex(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
direct-simplex solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_direct_simplex(problem, z, w, options)
[docs]def mlcp_direct_path(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
direct-path solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success, solution found
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_direct_path(problem, z, w, options)
[docs]def mlcp_simplex(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
simplex solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_simplex(problem, z, w, options)
[docs]def mlcp_FB(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
Fischer Burmeister solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution and
returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the
problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success,it found a solution
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_FB(problem, z, w, options)
[docs]def mlcp_direct_FB(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
Direct Fischer Burmeister solver
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,mM, q...)
:type z: float, out
:param z: a m+n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, out
:param w: a m+n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success, solution found
1 : failure,it did not find any solution
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_direct_FB(problem, z, w, options)
[docs]def mlcp_pgs_SBM(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
generic interface used to call any MLCP solver applied on a Sparse-Block
structured matrix M, with a Gauss-Seidel process
to solve the global problem (formulation/solving of local problems for each
row of blocks)
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...). M must be a
SparseBlockStructuredMatrix
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution
and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the
problem.
:type info: int
:param info: an integer which returns the termination value:
0 : convergence
>0 : failed, depends on local solver
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its
parameters.
"""
return _pynumerics.mlcp_pgs_SBM(problem, z, w, options)
def mlcp_lcp_lemke(problem: "MLCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
return _pynumerics.mlcp_lcp_lemke(problem, z, w, options)
def mlcp_lcp_lemke_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_lcp_lemke_default(options)
[docs]def mlcp_compute_error(problem: "MLCP", z: "double *", w: "double *", tolerance: "double") -> "double *":
r"""
This function checks the validity of the vector z as a solution of the MLCP.
:type problem: :py:class:`MixedLinearComplementarityProblem`, in
:param problem: structure that represents the MLCP (n,m,M, q... or
(A,B,C...))
:type z: float, in/out
:param z: a m+n-vector of doubles which contains the
initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a
m+n-vector of doubles which returns the solution of the problem.
:type tolerance: float, in
:param tolerance: threshold used to validate the solution: if the error is
less than this value, the solution is accepted
:type error: float, in/out
:param error:
:rtype: int
:return: status: 0 : convergence, 1: error > tolerance
"""
return _pynumerics.mlcp_compute_error(problem, z, w, tolerance)
def mlcp_pgs_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_pgs_set_default(options)
def mlcp_pgs_sbm_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_pgs_sbm_set_default(options)
def mlcp_rpgs_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_rpgs_set_default(options)
def mlcp_psor_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_psor_set_default(options)
def mlcp_rpsor_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_rpsor_set_default(options)
def mlcp_direct_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_direct_set_default(options)
def mlcp_direct_enum_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_direct_enum_set_default(options)
def mlcp_enum_set_default(options: "SolverOptions") -> "void":
return _pynumerics.mlcp_enum_set_default(options)
[docs]class LCP(object):
r""" Structure that contains and defines a LCP Problem."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
size = property(_pynumerics.LCP_size_get, _pynumerics.LCP_size_set, doc=r""" size of the problem""")
M = property(_pynumerics.LCP_M_get, _pynumerics.LCP_M_set, doc=r""" M matrix of the LCP (see the mathematical description)""")
q = property(_pynumerics.LCP_q_get, _pynumerics.LCP_q_set, doc=r""" vector of the LCP (see the mathematical description)""")
def __init__(self, M: "PyObject *", q: "PyObject *"):
_pynumerics.LCP_swiginit(self, _pynumerics.new_LCP(M, q))
__swig_destroy__ = _pynumerics.delete_LCP
# Register LCP in _pynumerics:
_pynumerics.LCP_swigregister(LCP)
[docs]def linearComplementarity_display(problem: "LCP") -> "void":
r"""
display a LinearComplementarityProblem
:type problem: :py:class:`LinearComplementarityProblem`
:param problem: pointer to a LinearComplementarityProblem to display
"""
return _pynumerics.linearComplementarity_display(problem)
[docs]def linearComplementarity_printInFile(problem: "LCP", file: "FILE *") -> "int":
r"""
function to write in a file a LinearComplementarityProblem
:type problem: :py:class:`LinearComplementarityProblem`
:param problem: pointer to a LinearComplementarityProblem to print
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 0 if ok
"""
return _pynumerics.linearComplementarity_printInFile(problem, file)
[docs]def linearComplementarity_newFromFile(problem: "LCP", file: "FILE *") -> "int":
r"""
Read and create a LinearComplementarityProblem
from a file
:type problem: :py:class:`LinearComplementarityProblem`
:param problem: pointer to a LinearComplementarityProblem to create
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 0 if ok
"""
return _pynumerics.linearComplementarity_newFromFile(problem, file)
[docs]def linearComplementarity_newFromFilename(problem: "LCP", filename: "char const *") -> "int":
r"""
Read and create a LinearComplementarityProblem
from a file
:type problem: :py:class:`LinearComplementarityProblem`
:param problem: pointer to a LinearComplementarityProblem to create
:type filename: string
:param filename: that contains the lcp
:rtype: int
:return: 0 if ok
"""
return _pynumerics.linearComplementarity_newFromFilename(problem, filename)
[docs]def freeLinearComplementarityProblem(problem: "LCP") -> "void":
r"""
Delete a LinearComplementarityProblem
:type problem: :py:class:`LinearComplementarityProblem`
:param problem: pointer to a LinearComplementarityProblem to delete
"""
return _pynumerics.freeLinearComplementarityProblem(problem)
[docs]def newLCP() -> "LinearComplementarityProblem *":
r"""
Create new LCP and clear its fields
:rtype: :py:class:`LinearComplementarityProblem`
:return: a LinearComplementarityProblem
"""
return _pynumerics.newLCP()
[docs]def lcp_qp(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_qp uses a quadratic programm formulation for solving a LCP
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence / minimization sucessfull
1 : Too Many iterations
2 : Accuracy insuficient to satisfy convergence criterion
5 : Length of working array insufficient
Other : The constraints are inconstent
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_qp(problem, z, w, options)
[docs]def lcp_cpg(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_cpg is a CPG (Conjugated Projected Gradient) solver for LCP based on quadratic minimization.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0: convergence
1: iter = itermax
2: negative diagonal term
3: pWp nul
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_cpg(problem, z, w, options)
[docs]def lcp_pgs(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_pgs (Projected Gauss-Seidel) is a basic Projected Gauss-Seidel solver for LCP.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_pgs(problem, z, w, options)
[docs]def lcp_rpgs(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_rpgs (Regularized Projected Gauss-Seidel ) is a solver for LCP, able to handle matrices with null diagonal terms.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
TODO: Sizing the regularization paramter and apply it only on null diagnal term
"""
return _pynumerics.lcp_rpgs(problem, z, w, options)
[docs]def lcp_psor(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_psor Projected Succesive over relaxation solver for LCP. See cottle, Pang Stone Chap 5
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
TODO: use the relax parameter
add test
add a vector of relaxation parameter wtith an auto sizing (see SOR algorithm for linear solver.)
"""
return _pynumerics.lcp_psor(problem, z, w, options)
[docs]def lcp_nsqp(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_nsqp use a quadratic programm formulation for solving an non symmetric LCP
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence / minimization sucessfull
1 : Too Many iterations
2 : Accuracy insuficient to satisfy convergence criterion
5 : Length of working array insufficient
Other : The constraints are inconstent
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_nsqp(problem, z, w, options)
[docs]def lcp_latin(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_latin (LArge Time INcrements) is a basic latin solver for LCP.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : Cholesky Factorization failed
3 : nul diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_latin(problem, z, w, options)
[docs]def lcp_latin_w(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_latin_w (LArge Time INcrements) is a basic latin solver with relaxation for LCP.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : Cholesky Factorization failed
3 : nul diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_latin_w(problem, z, w, options)
[docs]def lcp_lexicolemke(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_lexicolemke is a direct solver for LCP based on pivoting method principle for degenerate problem
Choice of pivot variable is performed via lexicographic ordering
Ref: "The Linear Complementarity Problem" Cottle, Pang, Stone (1992)
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_lexicolemke(problem, z, w, options)
[docs]def lcp_newton_min(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_newton_min uses a nonsmooth Newton method based on the min formulation (or max formulation) of the LCP
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence / minimization sucessfull
1 : Too Many iterations
2 : Accuracy insuficient to satisfy convergence criterion
5 : Length of working array insufficient
Other : The constraints are inconstent
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
TODO: Optimizing the memory allocation (Try to avoid the copy of JacH into A)
Add rules for the computation of the penalization rho
Add a globalization strategy based on a decrease of a merit function. (Nonmonotone LCP) Reference in Ferris Kanzow 2002
"""
return _pynumerics.lcp_newton_min(problem, z, w, options)
[docs]def lcp_newton_FB(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_newton_FB use a nonsmooth newton method based on the Fischer-Bursmeister convex function
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 - convergence
1 - iter = itermax
2 - failure in the descent direction search (in LAPACK)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
TODO: Optimizing the memory allocation (Try to avoid the copy of JacH into A)
Add rules for the computation of the penalization rho
Add a globalization strategy based on a decrease of a merit function. (Nonmonotone LCP) Reference in Ferris Kanzow 2002
"""
return _pynumerics.lcp_newton_FB(problem, z, w, options)
[docs]def lcp_newton_minFB(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_newton_minFB use a nonsmooth newton method based on both a min and Fischer-Bursmeister reformulation
References: Facchinei--Pang (2003)
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 - convergence
1 - iter = itermax
2 - failure in the descent direction search (in LAPACK)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_newton_minFB(problem, z, w, options)
[docs]def lcp_path(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
path solver
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
2 : negative diagonal term
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_path(problem, z, w, options)
[docs]def lcp_enum(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
enumerative solver
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : success
1 : failed
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_enum(problem, z, w, options)
[docs]def lcp_enum_init(problem: "LCP", options: "SolverOptions", withMemAlloc: "int") -> "void":
r"""
Proceed with initialisation required before any call of the enum solver.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
:type withMemAlloc: int, in
:param withMemAlloc: If it is not 0, then the necessary work memory is allocated.
"""
return _pynumerics.lcp_enum_init(problem, options, withMemAlloc)
[docs]def lcp_enum_reset(problem: "LCP", options: "SolverOptions", withMemAlloc: "int") -> "void":
r"""
Reset state for enum solver parameters.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
:type withMemAlloc: int, in
:param withMemAlloc: If it is not 0, then the work memory is free.
"""
return _pynumerics.lcp_enum_reset(problem, options, withMemAlloc)
[docs]def lcp_avi_caoferris(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_avi_caoferris is a direct solver for LCP based on an Affine Variational Inequalities (AVI) reformulation
The AVI solver is here the one from Cao and Ferris
Ref: "A Pivotal Method for Affine Variational Inequalities" Menglin Cao et Michael Ferris (1996)
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_avi_caoferris(problem, z, w, options)
[docs]def lcp_pivot(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_pivot is a direct solver for LCP based on a pivoting method
It can currently use Bard, Murty's least-index or Lemke rule for choosing
the pivot. The default one is Lemke and it can be changed by setting
iparam[SICONOS_LCP_IPARAM_PIVOTING_METHOD_TYPE]. The list of choices are in the enum LCP_PIVOT (see lcp_cst.h).
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_pivot(problem, z, w, options)
def lcp_pivot_covering_vector(problem: "LCP", u: "double *", s: "double *", options: "SolverOptions", cov_vec: "double *") -> "int *":
return _pynumerics.lcp_pivot_covering_vector(problem, u, s, options, cov_vec)
def lcp_pivot_lumod(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
return _pynumerics.lcp_pivot_lumod(problem, z, w, options)
def lcp_pivot_lumod_covering_vector(problem: "LCP", u: "double *", s: "double *", options: "SolverOptions", cov_vec: "double *") -> "int *":
return _pynumerics.lcp_pivot_lumod_covering_vector(problem, u, s, options, cov_vec)
[docs]def lcp_pathsearch(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_pathsearch is a direct solver for LCP based on the pathsearch algorithm
Warning: this solver is available for testing purposes only! consider
using lcp_pivot() if you are looking for simular solvers
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_pathsearch(problem, z, w, options)
[docs]def lcp_gams(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
lcp_gams uses the solver provided by GAMS
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int, out
:param info: an integer which returns the termination value:
0 : convergence
1 : iter = itermax
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_gams(problem, z, w, options)
[docs]def lcp_nsgs_SBM(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
generic interface used to call any LCP solver applied on a Sparse-Block structured matrix M, with a Gauss-Seidel process
to solve the global problem (formulation/solving of local problems for each row of blocks)
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...). M must be a SparseBlockStructuredMatrix
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type info: int
:param info: an integer which returns the termination value:
0 : convergence
>0 : failed, depends on local solver
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.lcp_nsgs_SBM(problem, z, w, options)
[docs]def lcp_nsgs_SBM_buildLocalProblem(rowNumber: "int", blmat: "SparseBlockStructuredMatrix", local_problem: "LCP", q: "double *", z: "double *") -> "void":
r"""
Construct local problem from a "global" one
:type rowNumber: int
:param rowNumber: index of the local problem
:type blmat: :py:class:`SparseBlockStructuredMatrix`
:param blmat: matrix containing the problem
:type local_problem: :py:class:`LinearComplementarityProblem`
:param local_problem: problem to fill
:type q: float
:param q: big q
:type z: float
:param z: big z
"""
return _pynumerics.lcp_nsgs_SBM_buildLocalProblem(rowNumber, blmat, local_problem, q, z)
[docs]def lcp_compute_error(problem: "LCP", z: "double *", w: "double *", tolerance: "double") -> "double *":
r"""
Computes error criterion and update :math:`w = Mz + q`.
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: structure that represents the LCP (M, q...)
:type z: float, in/out
:param z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which returns the solution of the problem.
:type tolerance: float, in
:param tolerance: threshold used to validate the solution: if the error is less than this value, the solution is accepted
:type error: float, out
:param error: the actual error of the solution with respect to the problem
:rtype: int
:return: status: 0 : convergence, 1: error > tolerance
"""
return _pynumerics.lcp_compute_error(problem, z, w, tolerance)
[docs]def lcp_driver_DenseMatrix(problem: "LCP", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
Interface to solvers for Linear Complementarity Problems, dedicated to dense matrix storage
:type problem: :py:class:`LinearComplementarityProblem`, in
:param problem: the LinearComplementarityProblem structure which handles the problem (M,q)
:type z: float, in/out
:param z: a n-vector of doubles which contains the solution of the problem.
:type w: float, in/out
:param w: a n-vector of doubles which contains the solution of the problem.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver(s) and their parameters
:rtype: int
:return: info termination value
- 0 : successful
- >0 : otherwise see each solver for more information about the log info
"""
return _pynumerics.lcp_driver_DenseMatrix(problem, z, w, options)
def lcp_ConvexQP_ProjectedGradient(problem: "LCP", reaction: "double *", velocity: "double *", options: "SolverOptions") -> "int *":
return _pynumerics.lcp_ConvexQP_ProjectedGradient(problem, reaction, velocity, options)
def lcp_lexicolemke_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_lexicolemke_set_default(options)
def lcp_nsgs_sbm_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_nsgs_sbm_set_default(options)
def lcp_latin_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_latin_set_default(options)
def lcp_latin_w_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_latin_w_set_default(options)
def lcp_newton_FB_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_newton_FB_set_default(options)
def lcp_psor_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_psor_set_default(options)
def lcp_rpgs_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_rpgs_set_default(options)
def lcp_enum_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_enum_set_default(options)
def lcp_pivot_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_pivot_set_default(options)
def lcp_pathsearch_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_pathsearch_set_default(options)
def lcp_pivot_lumod_set_default(options: "SolverOptions") -> "void":
return _pynumerics.lcp_pivot_lumod_set_default(options)
SICONOS_LCP_LEMKE = _pynumerics.SICONOS_LCP_LEMKE
SICONOS_LCP_NSGS_SBM = _pynumerics.SICONOS_LCP_NSGS_SBM
SICONOS_LCP_PGS = _pynumerics.SICONOS_LCP_PGS
SICONOS_LCP_CPG = _pynumerics.SICONOS_LCP_CPG
SICONOS_LCP_LATIN = _pynumerics.SICONOS_LCP_LATIN
SICONOS_LCP_LATIN_W = _pynumerics.SICONOS_LCP_LATIN_W
SICONOS_LCP_QP = _pynumerics.SICONOS_LCP_QP
SICONOS_LCP_NSQP = _pynumerics.SICONOS_LCP_NSQP
SICONOS_LCP_NEWTONMIN = _pynumerics.SICONOS_LCP_NEWTONMIN
SICONOS_LCP_NEWTON_FB_FBLSA = _pynumerics.SICONOS_LCP_NEWTON_FB_FBLSA
SICONOS_LCP_PSOR = _pynumerics.SICONOS_LCP_PSOR
SICONOS_LCP_RPGS = _pynumerics.SICONOS_LCP_RPGS
SICONOS_LCP_PATH = _pynumerics.SICONOS_LCP_PATH
SICONOS_LCP_ENUM = _pynumerics.SICONOS_LCP_ENUM
SICONOS_LCP_AVI_CAOFERRIS = _pynumerics.SICONOS_LCP_AVI_CAOFERRIS
SICONOS_LCP_PIVOT = _pynumerics.SICONOS_LCP_PIVOT
SICONOS_LCP_BARD = _pynumerics.SICONOS_LCP_BARD
SICONOS_LCP_MURTY = _pynumerics.SICONOS_LCP_MURTY
SICONOS_LCP_NEWTON_MIN_FBLSA = _pynumerics.SICONOS_LCP_NEWTON_MIN_FBLSA
SICONOS_LCP_PATHSEARCH = _pynumerics.SICONOS_LCP_PATHSEARCH
SICONOS_LCP_PIVOT_LUMOD = _pynumerics.SICONOS_LCP_PIVOT_LUMOD
SICONOS_LCP_GAMS = _pynumerics.SICONOS_LCP_GAMS
SICONOS_LCP_CONVEXQP_PG = _pynumerics.SICONOS_LCP_CONVEXQP_PG
SICONOS_LCP_IPARAM_NSGS_ITERATIONS_SUM = _pynumerics.SICONOS_LCP_IPARAM_NSGS_ITERATIONS_SUM
r""" index in iparam to store the sum of local solver iterations number"""
SICONOS_LCP_IPARAM_PIVOTING_METHOD_TYPE = _pynumerics.SICONOS_LCP_IPARAM_PIVOTING_METHOD_TYPE
r""" index in iparam to store type of pivoting methods"""
SICONOS_LCP_IPARAM_SKIP_TRIVIAL = _pynumerics.SICONOS_LCP_IPARAM_SKIP_TRIVIAL
r""" index in iparam to skip trivial solution"""
SICONOS_LCP_IPARAM_ENUM_NUMBER_OF_SOLUTIONS = _pynumerics.SICONOS_LCP_IPARAM_ENUM_NUMBER_OF_SOLUTIONS
r""" index in iparam to store the number of solutions"""
SICONOS_LCP_IPARAM_ENUM_CURRENT_ENUM = _pynumerics.SICONOS_LCP_IPARAM_ENUM_CURRENT_ENUM
r""" index in iparam to store the current enum"""
SICONOS_LCP_IPARAM_ENUM_SEED = _pynumerics.SICONOS_LCP_IPARAM_ENUM_SEED
r""" index in iparam to store the seed for starting enum"""
SICONOS_LCP_IPARAM_ENUM_USE_DGELS = _pynumerics.SICONOS_LCP_IPARAM_ENUM_USE_DGELS
r""" index in iparam to store the first seed for enum"""
SICONOS_LCP_IPARAM_ENUM_MULTIPLE_SOLUTIONS = _pynumerics.SICONOS_LCP_IPARAM_ENUM_MULTIPLE_SOLUTIONS
r""" index in iparam to store to activate multiple solutions search"""
SICONOS_LCP_DPARAM_RHO = _pynumerics.SICONOS_LCP_DPARAM_RHO
r""" index in dparam to store to the relaxation or regularization parameter"""
SICONOS_LCP_DPARAM_NSGS_LOCAL_ERROR_SUM = _pynumerics.SICONOS_LCP_DPARAM_NSGS_LOCAL_ERROR_SUM
r""" index in dparam to store the sum of local error values"""
SICONOS_LCP_DPARAM_LATIN_PARAMETER = _pynumerics.SICONOS_LCP_DPARAM_LATIN_PARAMETER
r""" index in dparam to store the latin parameter"""
SICONOS_LCP_SKIP_TRIVIAL_NO = _pynumerics.SICONOS_LCP_SKIP_TRIVIAL_NO
SICONOS_LCP_SKIP_TRIVIAL_YES = _pynumerics.SICONOS_LCP_SKIP_TRIVIAL_YES
SICONOS_LCP_PIVOT_BARD = _pynumerics.SICONOS_LCP_PIVOT_BARD
SICONOS_LCP_PIVOT_LEAST_INDEX = _pynumerics.SICONOS_LCP_PIVOT_LEAST_INDEX
SICONOS_LCP_PIVOT_LEMKE = _pynumerics.SICONOS_LCP_PIVOT_LEMKE
SICONOS_LCP_PIVOT_PATHSEARCH = _pynumerics.SICONOS_LCP_PIVOT_PATHSEARCH
[docs]class AVI(object):
r"""
Structure that contains and defines an AVI
The problem is : given a matrix :math:`M` and a vector :math:`q`, find :math:`z` such that
.. math::
\langle x - z, q + Mz \rangle \geq 0 \ \text{for all }x\in K
See users'guide for details.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
size = property(_pynumerics.AVI_size_get, _pynumerics.AVI_size_set, doc=r""" size of the problem""")
M = property(_pynumerics.AVI_M_get, _pynumerics.AVI_M_set, doc=r""" M matrix of the AVI (see the mathematical description)""")
q = property(_pynumerics.AVI_q_get, _pynumerics.AVI_q_set, doc=r""" vector of the AVI (see the mathematical description)""")
d = property(_pynumerics.AVI_d_get, _pynumerics.AVI_d_set, doc=r""" Covering vector (optional)""")
poly = property(_pynumerics.AVI_poly_get, _pynumerics.AVI_poly_set, doc=r""" Polyhedra where the solution has to belong""")
lb = property(_pynumerics.AVI_lb_get, _pynumerics.AVI_lb_set, doc=r""" Lower bounds for the variables""")
ub = property(_pynumerics.AVI_ub_get, _pynumerics.AVI_ub_set, doc=r""" Upper bounds for the variables""")
cones = property(_pynumerics.AVI_cones_get, _pynumerics.AVI_cones_set, doc=r"""
Non-polyhedral Cones where the variable lives (not
implemented yet)
""")
def __init__(self, *args):
_pynumerics.AVI_swiginit(self, _pynumerics.new_AVI(*args))
def set_polyhedron(self, H_mat: "PyObject *", K_vec: "PyObject *") -> "void":
return _pynumerics.AVI_set_polyhedron(self, H_mat, K_vec)
__swig_destroy__ = _pynumerics.delete_AVI
# Register AVI in _pynumerics:
_pynumerics.AVI_swigregister(AVI)
SICONOS_LCP_LEMKE_STR = cvar.SICONOS_LCP_LEMKE_STR
SICONOS_LCP_NSGS_SBM_STR = cvar.SICONOS_LCP_NSGS_SBM_STR
SICONOS_LCP_PGS_STR = cvar.SICONOS_LCP_PGS_STR
SICONOS_LCP_CPG_STR = cvar.SICONOS_LCP_CPG_STR
SICONOS_LCP_LATIN_STR = cvar.SICONOS_LCP_LATIN_STR
SICONOS_LCP_LATIN_W_STR = cvar.SICONOS_LCP_LATIN_W_STR
SICONOS_LCP_QP_STR = cvar.SICONOS_LCP_QP_STR
SICONOS_LCP_NSQP_STR = cvar.SICONOS_LCP_NSQP_STR
SICONOS_LCP_NEWTONMIN_STR = cvar.SICONOS_LCP_NEWTONMIN_STR
SICONOS_LCP_NEWTON_FB_FBLSA_STR = cvar.SICONOS_LCP_NEWTON_FB_FBLSA_STR
SICONOS_LCP_NEWTON_MIN_FBLSA_STR = cvar.SICONOS_LCP_NEWTON_MIN_FBLSA_STR
SICONOS_LCP_PSOR_STR = cvar.SICONOS_LCP_PSOR_STR
SICONOS_LCP_RPGS_STR = cvar.SICONOS_LCP_RPGS_STR
SICONOS_LCP_PATH_STR = cvar.SICONOS_LCP_PATH_STR
SICONOS_LCP_ENUM_STR = cvar.SICONOS_LCP_ENUM_STR
SICONOS_LCP_AVI_CAOFERRIS_STR = cvar.SICONOS_LCP_AVI_CAOFERRIS_STR
SICONOS_LCP_PIVOT_STR = cvar.SICONOS_LCP_PIVOT_STR
SICONOS_LCP_BARD_STR = cvar.SICONOS_LCP_BARD_STR
SICONOS_LCP_MURTY_STR = cvar.SICONOS_LCP_MURTY_STR
SICONOS_LCP_PATHSEARCH_STR = cvar.SICONOS_LCP_PATHSEARCH_STR
SICONOS_LCP_PIVOT_LUMOD_STR = cvar.SICONOS_LCP_PIVOT_LUMOD_STR
SICONOS_LCP_GAMS_STR = cvar.SICONOS_LCP_GAMS_STR
SICONOS_LCP_CONVEXQP_PG_STR = cvar.SICONOS_LCP_CONVEXQP_PG_STR
[docs]def AVI_display(avi: "AVI") -> "void":
r"""
Affine Variational Inequalities display
:type avi: :py:class:`AffineVariationalInequalities`
:param avi: pointer to the AffineVariationalInequalities to display
"""
return _pynumerics.AVI_display(avi)
[docs]def AVI_printInFile(avi: "AVI", file: "FILE *") -> "int":
r"""
write AVI to file
:type avi: :py:class:`AffineVariationalInequalities`
:param avi: pointer to a AffineVariationalInequalities to print
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 1 if successfull
"""
return _pynumerics.AVI_printInFile(avi, file)
[docs]def AVI_newFromFile(avi: "AVI", file: "FILE *") -> "int":
r"""
read from file and create AffineVariationalInequalities
:type avi: :py:class:`AffineVariationalInequalities`
:param avi: pointer to a AffineVariationalInequalities to create
:type file: FILE
:param file: pointer to a FILE
:rtype: int
:return: 1 if successfull
"""
return _pynumerics.AVI_newFromFile(avi, file)
[docs]def AVI_newFromFilename(avi: "AVI", filename: "char *") -> "int":
r"""
function to read and create a AffineVariationalInequalities
from a file
:type avi: :py:class:`AffineVariationalInequalities`
:param avi: pointer to a AffineVariationalInequalities to create
:type filename: string
:param filename: that contains the AVI
:rtype: int
:return: 1 if successfull
"""
return _pynumerics.AVI_newFromFilename(avi, filename)
[docs]def freeAVI(avi: "AVI") -> "void":
r"""
function to delete a AffineVariationalInequalities
:type avi: :py:class:`AffineVariationalInequalities`
:param avi: pointer to a AffineVariationalInequalities to delete
"""
return _pynumerics.freeAVI(avi)
[docs]def newAVI() -> "AffineVariationalInequalities *":
r"""
Create an empty AVI struct
:rtype: :py:class:`AffineVariationalInequalities`
:return: an empty AffineVariationalInequalities
"""
return _pynumerics.newAVI()
[docs]def avi_caoferris(problem: "AVI", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
avi_caoferris is a direct solver for AVI based on pivoting method principle for degenerate problem
Choice of pivot variable is performed via lexicographic ordering
Ref: "A Pivotal Method for Affine Variational Inequalities" Menglin Cao et Michael Ferris (1996)
:type problem: :py:class:`AffineVariationalInequalities`, in
:param problem: structure that represents the AVI (M, q, K)
:type z: float, in/out
:param z: on call contains the initial solution and on return holds the solution of the problem.
:type w: float, in/out
:param w: defined as Mz + q
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
:rtype: int
:return: info about the convergence: 0 ok; 1 ...
"""
return _pynumerics.avi_caoferris(problem, z, w, options)
[docs]def avi_pathavi(problem: "AVI", z: "double *", w: "double *", options: "SolverOptions") -> "int":
r"""
avi_pathavi is using PATHVI, a direct solver for VI based on pivoting method principle for degenerate problem
Ref: "A structure-preserving Pivotal Method for Affine Variational Inequalities" Y. Kim, O. Huber, M.C. Ferris, Math Prog B (2017)
:type problem: :py:class:`AffineVariationalInequalities`, in
:param problem: structure that represents the AVI (M, q, K)
:type z: float, in/out
:param z: on call contains the initial solution and on return holds the solution of the problem.
:type w: float, in/out
:param w: defined as Mz + q
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
:rtype: int
:return: info about the convergence: 0 ok; 1 ...
"""
return _pynumerics.avi_pathavi(problem, z, w, options)
SICONOS_AVI_CAOFERRIS = _pynumerics.SICONOS_AVI_CAOFERRIS
SICONOS_AVI_PATHAVI = _pynumerics.SICONOS_AVI_PATHAVI
def mixedLinearComplementarityProblemFromFile(filename: "char const *") -> "MixedLinearComplementarityProblem *":
return _pynumerics.mixedLinearComplementarityProblemFromFile(filename)
SICONOS_RELAY_PGS = _pynumerics.SICONOS_RELAY_PGS
SICONOS_RELAY_ENUM = _pynumerics.SICONOS_RELAY_ENUM
SICONOS_RELAY_PATH = _pynumerics.SICONOS_RELAY_PATH
SICONOS_RELAY_LEMKE = _pynumerics.SICONOS_RELAY_LEMKE
SICONOS_RELAY_AVI_CAOFERRIS = _pynumerics.SICONOS_RELAY_AVI_CAOFERRIS
SICONOS_RELAY_AVI_CAOFERRIS_TEST = _pynumerics.SICONOS_RELAY_AVI_CAOFERRIS_TEST
SICONOS_FRICTION_2D_NSGS = _pynumerics.SICONOS_FRICTION_2D_NSGS
r""" 2D Frictional Contact solvers"""
SICONOS_FRICTION_2D_CPG = _pynumerics.SICONOS_FRICTION_2D_CPG
SICONOS_FRICTION_2D_LEMKE = _pynumerics.SICONOS_FRICTION_2D_LEMKE
SICONOS_FRICTION_2D_ENUM = _pynumerics.SICONOS_FRICTION_2D_ENUM
SICONOS_FRICTION_3D_NSGS = _pynumerics.SICONOS_FRICTION_3D_NSGS
r""" Non-smooth Gauss Seidel, local formulation"""
SICONOS_FRICTION_3D_NSGSV = _pynumerics.SICONOS_FRICTION_3D_NSGSV
r""" Non-smooth Gauss Seidel-velocity, local formulation"""
SICONOS_FRICTION_3D_PROX = _pynumerics.SICONOS_FRICTION_3D_PROX
r""" proximal, local formulation"""
SICONOS_FRICTION_3D_TFP = _pynumerics.SICONOS_FRICTION_3D_TFP
r""" Tresca, fixed point, local formulation"""
SICONOS_FRICTION_3D_NSN_AC = _pynumerics.SICONOS_FRICTION_3D_NSN_AC
r""" Non-smooth Newton Alart-Curnier, local formulation"""
SICONOS_FRICTION_3D_DSFP = _pynumerics.SICONOS_FRICTION_3D_DSFP
r""" De Saxce fixed point, local formulation"""
SICONOS_FRICTION_3D_VI_FPP = _pynumerics.SICONOS_FRICTION_3D_VI_FPP
r""" VI formulation, fixed point projection, local formulation"""
SICONOS_FRICTION_3D_VI_EG = _pynumerics.SICONOS_FRICTION_3D_VI_EG
r""" VI formulation, Extra-gradient, local formulation"""
SICONOS_FRICTION_3D_HP = _pynumerics.SICONOS_FRICTION_3D_HP
r""" Hyperplane projection, local formulation"""
SICONOS_FRICTION_3D_NCPGlockerFBFixedPoint = _pynumerics.SICONOS_FRICTION_3D_NCPGlockerFBFixedPoint
r""" Fischer Burmeister fixed point, local formulation"""
SICONOS_FRICTION_3D_FPP = _pynumerics.SICONOS_FRICTION_3D_FPP
r""" Fixed point projection, local formulation"""
SICONOS_FRICTION_3D_EG = _pynumerics.SICONOS_FRICTION_3D_EG
r""" Extra-gradient, local formulation"""
SICONOS_FRICTION_3D_NSN_FB = _pynumerics.SICONOS_FRICTION_3D_NSN_FB
r""" Non-smooth Newton Fischer Burmeister, local formulation"""
SICONOS_FRICTION_3D_GAMS_PATH = _pynumerics.SICONOS_FRICTION_3D_GAMS_PATH
r""" GAMS/Path (Ferris), local formulation"""
SICONOS_FRICTION_3D_GAMS_PATHVI = _pynumerics.SICONOS_FRICTION_3D_GAMS_PATHVI
r""" VI formulation, GAMS/Path (Ferris), local formulation"""
SICONOS_FRICTION_3D_ACLMFP = _pynumerics.SICONOS_FRICTION_3D_ACLMFP
r""" Alart-Curnier fixed point, local formulation"""
SICONOS_FRICTION_3D_SOCLCP = _pynumerics.SICONOS_FRICTION_3D_SOCLCP
r""" Second-order Cone LCP, local formulation"""
SICONOS_FRICTION_3D_GAMS_LCP_PATH = _pynumerics.SICONOS_FRICTION_3D_GAMS_LCP_PATH
r""" GAMS/PATH (Ferris) LCP, local formulation"""
SICONOS_FRICTION_3D_GAMS_LCP_PATHVI = _pynumerics.SICONOS_FRICTION_3D_GAMS_LCP_PATHVI
r""" VI formulation, GAMS/PATH (Ferris) LCP, local formulation"""
SICONOS_FRICTION_3D_NSN_NM = _pynumerics.SICONOS_FRICTION_3D_NSN_NM
r""" Non-smooth Newton, natural map, local formulation"""
SICONOS_FRICTION_3D_NSN_AC_TEST = _pynumerics.SICONOS_FRICTION_3D_NSN_AC_TEST
SICONOS_FRICTION_3D_PFP = _pynumerics.SICONOS_FRICTION_3D_PFP
r""" Panagiotopoulos, fixed point, local formulation"""
SICONOS_FRICTION_3D_ADMM = _pynumerics.SICONOS_FRICTION_3D_ADMM
r""" ADMM local formulation"""
SICONOS_FRICTION_3D_ONECONTACT_NSN = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_NSN
r""" Non-smooth Newton Alart-Curnier, 'direct', one contact solver"""
SICONOS_FRICTION_3D_ONECONTACT_NSN_GP = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_NSN_GP
r""" Non-smooth Newton Alart-Curnier, 'damped', one contact solver"""
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone
r""" Projection on cone, one contact solver"""
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration
r""" Projection on cone, one contact solver"""
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithRegularization = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithRegularization
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithDiagonalization = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithDiagonalization
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_velocity = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_velocity
SICONOS_FRICTION_3D_NCPGlockerFBPATH = _pynumerics.SICONOS_FRICTION_3D_NCPGlockerFBPATH
r""" Fischer Burmeister/Path, Glocker formulation, one contact solver"""
SICONOS_FRICTION_3D_NCPGlockerFBNewton = _pynumerics.SICONOS_FRICTION_3D_NCPGlockerFBNewton
r""" Newton/Fischer Burmeister, Glocker formulation, one contact solver"""
SICONOS_FRICTION_3D_ONECONTACT_QUARTIC = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_QUARTIC
SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_NU = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_NU
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinder = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinder
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinderWithLocalIteration = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinderWithLocalIteration
SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_HYBRID = _pynumerics.SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_HYBRID
SICONOS_FRICTION_3D_VI_FPP_Cylinder = _pynumerics.SICONOS_FRICTION_3D_VI_FPP_Cylinder
SICONOS_FRICTION_3D_CONVEXQP_PG_CYLINDER = _pynumerics.SICONOS_FRICTION_3D_CONVEXQP_PG_CYLINDER
SICONOS_GLOBAL_FRICTION_3D_NSGS_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_NSGS_WR
r""" 3D Frictional contact local solvers on global formulation"""
SICONOS_GLOBAL_FRICTION_3D_NSGSV_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_NSGSV_WR
SICONOS_GLOBAL_FRICTION_3D_PROX_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_PROX_WR
SICONOS_GLOBAL_FRICTION_3D_DSFP_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_DSFP_WR
SICONOS_GLOBAL_FRICTION_3D_TFP_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_TFP_WR
SICONOS_GLOBAL_FRICTION_3D_NSGS = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_NSGS
SICONOS_GLOBAL_FRICTION_3D_NSN_AC_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_NSN_AC_WR
SICONOS_GLOBAL_FRICTION_3D_NSN_AC = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_NSN_AC
SICONOS_GLOBAL_FRICTION_3D_GAMS_PATH = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_GAMS_PATH
SICONOS_GLOBAL_FRICTION_3D_GAMS_PATHVI = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_GAMS_PATHVI
SICONOS_GLOBAL_FRICTION_3D_VI_FPP = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_VI_FPP
r""" VI formulation, Fixed Point Projection, local formulation"""
SICONOS_GLOBAL_FRICTION_3D_VI_EG = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_VI_EG
r""" VI formulation, Extra-gradient, local formulation"""
SICONOS_GLOBAL_FRICTION_3D_ACLMFP = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_ACLMFP
SICONOS_GLOBAL_FRICTION_3D_ADMM = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_ADMM
SICONOS_GLOBAL_FRICTION_3D_ADMM_WR = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_ADMM_WR
SICONOS_GLOBAL_FRICTION_3D_IPM = _pynumerics.SICONOS_GLOBAL_FRICTION_3D_IPM
SICONOS_ROLLING_FRICTION_3D_NSGS = _pynumerics.SICONOS_ROLLING_FRICTION_3D_NSGS
r""" Non-smooth Gauss Seidel, local formulation"""
SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnCone = _pynumerics.SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnCone
SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration = _pynumerics.SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration
SICONOS_ROLLING_FRICTION_3D_ADMM = _pynumerics.SICONOS_ROLLING_FRICTION_3D_ADMM
SICONOS_ROLLING_FRICTION_2D_NSGS = _pynumerics.SICONOS_ROLLING_FRICTION_2D_NSGS
r""" Non-smooth Gauss Seidel, local formulation"""
SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnCone = _pynumerics.SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnCone
SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnConeWithLocalIteration = _pynumerics.SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnConeWithLocalIteration
SICONOS_GLOBAL_ROLLING_FRICTION_3D_NSGS_WR = _pynumerics.SICONOS_GLOBAL_ROLLING_FRICTION_3D_NSGS_WR
r""" Non-smooth Gauss Seidel, global formulation"""
SICONOS_FRICTION_3D_IPARAM_INTERNAL_ERROR_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_IPARAM_INTERNAL_ERROR_STRATEGY
r""" index in iparam to store the error strategy for the internal solver"""
SICONOS_FRICTION_3D_IPARAM_RESCALING = _pynumerics.SICONOS_FRICTION_3D_IPARAM_RESCALING
r""" index in iparam to store the rescaling"""
SICONOS_FRICTION_3D_IPARAM_RESCALING_CONE = _pynumerics.SICONOS_FRICTION_3D_IPARAM_RESCALING_CONE
r""" index in iparam to store the rescaling"""
SICONOS_FRICTION_3D_CURRENT_CONTACT_NUMBER = _pynumerics.SICONOS_FRICTION_3D_CURRENT_CONTACT_NUMBER
r""" current contact number (example of use: one contact solvers) *"""
SICONOS_FRICTION_3D_IPARAM_ERROR_EVALUATION = _pynumerics.SICONOS_FRICTION_3D_IPARAM_ERROR_EVALUATION
r""" index in iparam to store the error evaluation method"""
SICONOS_FRICTION_3D_IPARAM_ERROR_EVALUATION_FREQUENCY = _pynumerics.SICONOS_FRICTION_3D_IPARAM_ERROR_EVALUATION_FREQUENCY
r""" index in iparam to store the frequency of error evaluation method"""
SICONOS_FRICTION_3D_NUMBER_OF_CONTACTS = _pynumerics.SICONOS_FRICTION_3D_NUMBER_OF_CONTACTS
SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_ADAPTIVE = _pynumerics.SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_ADAPTIVE
SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_GIVEN_VALUE = _pynumerics.SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_GIVEN_VALUE
SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_ADAPTIVE_N_CONTACT = _pynumerics.SICONOS_FRICTION_3D_INTERNAL_ERROR_STRATEGY_ADAPTIVE_N_CONTACT
SICONOS_FRICTION_3D_RESCALING_NO = _pynumerics.SICONOS_FRICTION_3D_RESCALING_NO
SICONOS_FRICTION_3D_RESCALING_SCALAR = _pynumerics.SICONOS_FRICTION_3D_RESCALING_SCALAR
SICONOS_FRICTION_3D_RESCALING_BALANCING_M = _pynumerics.SICONOS_FRICTION_3D_RESCALING_BALANCING_M
SICONOS_FRICTION_3D_RESCALING_BALANCING_MH = _pynumerics.SICONOS_FRICTION_3D_RESCALING_BALANCING_MH
SICONOS_FRICTION_3D_RESCALING_BALANCING_MHHT = _pynumerics.SICONOS_FRICTION_3D_RESCALING_BALANCING_MHHT
SICONOS_FRICTION_3D_RESCALING_CONE_NO = _pynumerics.SICONOS_FRICTION_3D_RESCALING_CONE_NO
SICONOS_FRICTION_3D_RESCALING_CONE_YES = _pynumerics.SICONOS_FRICTION_3D_RESCALING_CONE_YES
SICONOS_FRICTION_3D_DPARAM_INTERNAL_ERROR_RATIO = _pynumerics.SICONOS_FRICTION_3D_DPARAM_INTERNAL_ERROR_RATIO
r""" index in dparam to store the internal solver error ratio"""
SICONOS_FRICTION_3D_NSGS_RELAXATION = _pynumerics.SICONOS_FRICTION_3D_NSGS_RELAXATION
r""" index in iparam to store the relaxation strategy"""
SICONOS_FRICTION_3D_NSGS_SHUFFLE = _pynumerics.SICONOS_FRICTION_3D_NSGS_SHUFFLE
r""" index in iparam to store the shuffle strategy"""
SICONOS_FRICTION_3D_NSGS_SHUFFLE_SEED = _pynumerics.SICONOS_FRICTION_3D_NSGS_SHUFFLE_SEED
r""" index in iparam to store the shuffle seed"""
SICONOS_FRICTION_3D_NSGS_FREEZING_CONTACT = _pynumerics.SICONOS_FRICTION_3D_NSGS_FREEZING_CONTACT
r""" index in iparam to store the"""
SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION = _pynumerics.SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION
r""" index in iparam to store the"""
SICONOS_FRICTION_3D_NSGS_RELAXATION_VALUE = _pynumerics.SICONOS_FRICTION_3D_NSGS_RELAXATION_VALUE
r""" index in dparam to store the relaxation strategy"""
SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_IPARAM_USE_TRIVIAL_SOLUTION = _pynumerics.SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_IPARAM_USE_TRIVIAL_SOLUTION
SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_USE_TRIVIAL_SOLUTION_FALSE = _pynumerics.SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_USE_TRIVIAL_SOLUTION_FALSE
SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_USE_TRIVIAL_SOLUTION_TRUE = _pynumerics.SICONOS_FRICTION_3D_NSGS_LOCALSOLVER_USE_TRIVIAL_SOLUTION_TRUE
SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_FULL = _pynumerics.SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_FULL
r""" Evaluation of the error with the expensive function fc3d_compute_error *"""
SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_LIGHT = _pynumerics.SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_LIGHT
r""" Evaluation of the error with the cheap incremental variation *"""
SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_LIGHT_WITH_FULL_FINAL = _pynumerics.SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_LIGHT_WITH_FULL_FINAL
r"""
Evaluation of the error with the cheap incremental variation but we modify
the incremental toleranve to reach the requred accuracy *
"""
SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_ADAPTIVE = _pynumerics.SICONOS_FRICTION_3D_NSGS_ERROR_EVALUATION_ADAPTIVE
r"""
Evaluation of the error with the expensive function fc3d_compute_error and
an adaptive frequency for calling the error function *
"""
SICONOS_FRICTION_3D_NSGS_SHUFFLE_FALSE = _pynumerics.SICONOS_FRICTION_3D_NSGS_SHUFFLE_FALSE
SICONOS_FRICTION_3D_NSGS_SHUFFLE_TRUE = _pynumerics.SICONOS_FRICTION_3D_NSGS_SHUFFLE_TRUE
SICONOS_FRICTION_3D_NSGS_SHUFFLE_TRUE_EACH_LOOP = _pynumerics.SICONOS_FRICTION_3D_NSGS_SHUFFLE_TRUE_EACH_LOOP
SICONOS_FRICTION_3D_NSGS_RELAXATION_FALSE = _pynumerics.SICONOS_FRICTION_3D_NSGS_RELAXATION_FALSE
SICONOS_FRICTION_3D_NSGS_RELAXATION_TRUE = _pynumerics.SICONOS_FRICTION_3D_NSGS_RELAXATION_TRUE
SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION_FALSE = _pynumerics.SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION_FALSE
SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION_TRUE = _pynumerics.SICONOS_FRICTION_3D_NSGS_FILTER_LOCAL_SOLUTION_TRUE
SICONOS_FRICTION_3D_NSN_RHO_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_NSN_RHO_STRATEGY
r""" index in iparam to store the strategy for computing rho"""
SICONOS_FRICTION_3D_NSN_FORMULATION = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION
r""" index in iparam to store the formulation"""
SICONOS_FRICTION_3D_NSN_LINESEARCH = _pynumerics.SICONOS_FRICTION_3D_NSN_LINESEARCH
r""" index in iparam to store the line-search"""
SICONOS_FRICTION_3D_NSN_LINESEARCH_MAX_ITER = _pynumerics.SICONOS_FRICTION_3D_NSN_LINESEARCH_MAX_ITER
r""" index in iparam to store the maximum number of iterations"""
SICONOS_FRICTION_3D_NSN_LINEAR_SOLVER = _pynumerics.SICONOS_FRICTION_3D_NSN_LINEAR_SOLVER
r"""
index in iparam to set the linear solver used at each Newton iteration
cs_lusol or mumps
"""
SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY
r""" index in iparam to store the strategy for the hybrid solver"""
SICONOS_FRICTION_3D_NSN_HYBRID_MAX_LOOP = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_MAX_LOOP
r""" index in iparam to store the maximum number of loop for the hybrid solver"""
SICONOS_FRICTION_3D_NSN_HYBRID_MAX_ITER = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_MAX_ITER
r""" index in iparam to store the maximum number of iterations for the projection solver"""
SICONOS_FRICTION_3D_NSN_MEMORY_ALLOCATED = _pynumerics.SICONOS_FRICTION_3D_NSN_MEMORY_ALLOCATED
r""" index in iparam used to check if memory allocation has already be done (if true/1) or not (if 0/false) for internal work array."""
SICONOS_FRICTION_3D_NSN_MPI_COM = _pynumerics.SICONOS_FRICTION_3D_NSN_MPI_COM
r""" index in iparam to store the boolean to know if allocation of dwork is needed"""
SICONOS_FRICTION_3D_NSN_USE_CSLUSOL = _pynumerics.SICONOS_FRICTION_3D_NSN_USE_CSLUSOL
SICONOS_FRICTION_3D_NSN_USE_MUMPS = _pynumerics.SICONOS_FRICTION_3D_NSN_USE_MUMPS
SICONOS_FRICTION_3D_NSN_RHO = _pynumerics.SICONOS_FRICTION_3D_NSN_RHO
r""" index in dparam to store the rho value for projection formulation"""
SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_CONSTANT = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_CONSTANT
r""" A constant value given in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPECTRAL_NORM = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPECTRAL_NORM
r""" A computed value stored in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPLIT_SPECTRAL_NORM_COND = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPLIT_SPECTRAL_NORM_COND
r""" A computed value stored in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPLIT_SPECTRAL_NORM = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_SPLIT_SPECTRAL_NORM
r""" An adaptive strategy for rho is used"""
SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_ADAPTIVE = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_RHO_STRATEGY_ADAPTIVE
r""" An adaptive strategy for rho is used"""
SICONOS_FRICTION_3D_NSN_FORMULATION_ALARTCURNIER_STD = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_ALARTCURNIER_STD
SICONOS_FRICTION_3D_NSN_FORMULATION_JEANMOREAU_STD = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_JEANMOREAU_STD
SICONOS_FRICTION_3D_NSN_FORMULATION_ALARTCURNIER_GENERATED = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_ALARTCURNIER_GENERATED
SICONOS_FRICTION_3D_NSN_FORMULATION_JEANMOREAU_GENERATED = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_JEANMOREAU_GENERATED
SICONOS_FRICTION_3D_NSN_FORMULATION_NULL = _pynumerics.SICONOS_FRICTION_3D_NSN_FORMULATION_NULL
SICONOS_FRICTION_3D_NSN_LINESEARCH_GOLDSTEINPRICE = _pynumerics.SICONOS_FRICTION_3D_NSN_LINESEARCH_GOLDSTEINPRICE
SICONOS_FRICTION_3D_NSN_LINESEARCH_ARMIJO = _pynumerics.SICONOS_FRICTION_3D_NSN_LINESEARCH_ARMIJO
SICONOS_FRICTION_3D_NSN_LINESEARCH_NO = _pynumerics.SICONOS_FRICTION_3D_NSN_LINESEARCH_NO
SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_NO = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_NO
r""" No strategy for the hybrid solver"""
SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_PLI_NSN_LOOP = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_PLI_NSN_LOOP
r""" Loop PLI-NSN strategy for the hybrid solver"""
SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_NSN_AND_PLI_NSN_LOOP = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_NSN_AND_PLI_NSN_LOOP
r""" NSN and after Loop PLI-NSN strategy for the hybrid solver"""
SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_VI_EG_NSN = _pynumerics.SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_VI_EG_NSN
r""" VI_EG preconditionning to NSN strategy for the hybrid solver"""
SICONOS_FRICTION_3D_FP_ERROR_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_FP_ERROR_STRATEGY
r""" index in iparam to store the error strategy for the internal solver"""
SICONOS_FRICTION_3D_PROXIMAL_IPARAM_CUMULATIVE_ITER_DONE = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_IPARAM_CUMULATIVE_ITER_DONE
r""" index in iparam to store the relaxation strategy"""
SICONOS_FRICTION_3D_PROXIMAL_IPARAM_RELAXATION = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_IPARAM_RELAXATION
r""" index in iparam to store the relaxation strategy"""
SICONOS_FRICTION_3D_PROXIMAL_IPARAM_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_IPARAM_STRATEGY
r""" index in iparam to store the proximal strategy"""
SICONOS_FRICTION_3D_PROXIMAL_DPARAM_ALPHA = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_DPARAM_ALPHA
r""" index in dparam to store the parameter alpha"""
SICONOS_FRICTION_3D_PROXIMAL_DPARAM_SIGMA = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_DPARAM_SIGMA
SICONOS_FRICTION_3D_PROXIMAL_DPARAM_NU = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_DPARAM_NU
SICONOS_FRICTION_3D_PROXIMAL_DPARAM_RELAXATION = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_DPARAM_RELAXATION
SICONOS_FRICTION_3D_PROXIMAL_PROX = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_PROX
r""" Proximal algorithm"""
SICONOS_FRICTION_3D_PROXIMAL_REGULARIZATION = _pynumerics.SICONOS_FRICTION_3D_PROXIMAL_REGULARIZATION
r""" Regularization algorithm"""
SICONOS_FRICTION_3D_ADMM_IPARAM_RHO_STRATEGY = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_RHO_STRATEGY
r""" index in iparam to store the strategy for computing rho"""
SICONOS_FRICTION_3D_ADMM_IPARAM_INITIAL_RHO = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_INITIAL_RHO
r""" index in iparam to store the strategy for computing rho"""
SICONOS_FRICTION_3D_ADMM_IPARAM_ACCELERATION = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_ACCELERATION
r""" index in iparam to store the acceleration parameter"""
SICONOS_FRICTION_3D_ADMM_IPARAM_SYMMETRY = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_SYMMETRY
r""" index in iparam to store the symmetry parameter"""
SICONOS_FRICTION_3D_ADMM_IPARAM_SPARSE_STORAGE = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_SPARSE_STORAGE
r""" index in iparam to store the sparse storage parameter"""
SICONOS_FRICTION_3D_ADMM_IPARAM_GET_PROBLEM_INFO = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_GET_PROBLEM_INFO
r""" index in iparam to get problem info"""
SICONOS_FRICTION_3D_ADMM_IPARAM_UPDATE_S = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_UPDATE_S
SICONOS_FRICTION_3D_ADMM_IPARAM_FULL_H = _pynumerics.SICONOS_FRICTION_3D_ADMM_IPARAM_FULL_H
SICONOS_FRICTION_3D_ADMM_RHO = _pynumerics.SICONOS_FRICTION_3D_ADMM_RHO
r""" index in dparam to store the rho value for projection formulation"""
SICONOS_FRICTION_3D_ADMM_RESTART_ETA = _pynumerics.SICONOS_FRICTION_3D_ADMM_RESTART_ETA
r""" index in dparam to store the eta value for the restarting criteria"""
SICONOS_FRICTION_3D_ADMM_BALANCING_RESIDUAL_TAU = _pynumerics.SICONOS_FRICTION_3D_ADMM_BALANCING_RESIDUAL_TAU
r""" index in dparam to store the tau value for the balancing residual technique"""
SICONOS_FRICTION_3D_ADMM_BALANCING_RESIDUAL_PHI = _pynumerics.SICONOS_FRICTION_3D_ADMM_BALANCING_RESIDUAL_PHI
r""" index in dparam to store the phi value for the balancing residual technique"""
SICONOS_FRICTION_3D_ADMM_NO_ACCELERATION = _pynumerics.SICONOS_FRICTION_3D_ADMM_NO_ACCELERATION
SICONOS_FRICTION_3D_ADMM_ACCELERATION = _pynumerics.SICONOS_FRICTION_3D_ADMM_ACCELERATION
SICONOS_FRICTION_3D_ADMM_ACCELERATION_AND_RESTART = _pynumerics.SICONOS_FRICTION_3D_ADMM_ACCELERATION_AND_RESTART
SICONOS_FRICTION_3D_ADMM_CHECK_SYMMETRY = _pynumerics.SICONOS_FRICTION_3D_ADMM_CHECK_SYMMETRY
SICONOS_FRICTION_3D_ADMM_FORCED_SYMMETRY = _pynumerics.SICONOS_FRICTION_3D_ADMM_FORCED_SYMMETRY
SICONOS_FRICTION_3D_ADMM_FORCED_ASYMMETRY = _pynumerics.SICONOS_FRICTION_3D_ADMM_FORCED_ASYMMETRY
SICONOS_FRICTION_3D_ADMM_SYMMETRIZE = _pynumerics.SICONOS_FRICTION_3D_ADMM_SYMMETRIZE
SICONOS_FRICTION_3D_ADMM_ASSUME_SYMMETRY = _pynumerics.SICONOS_FRICTION_3D_ADMM_ASSUME_SYMMETRY
SICONOS_FRICTION_3D_ADMM_KEEP_STORAGE = _pynumerics.SICONOS_FRICTION_3D_ADMM_KEEP_STORAGE
SICONOS_FRICTION_3D_ADMM_FORCED_SPARSE_STORAGE = _pynumerics.SICONOS_FRICTION_3D_ADMM_FORCED_SPARSE_STORAGE
SICONOS_FRICTION_3D_ADMM_GET_PROBLEM_INFO_NO = _pynumerics.SICONOS_FRICTION_3D_ADMM_GET_PROBLEM_INFO_NO
SICONOS_FRICTION_3D_ADMM_GET_PROBLEM_INFO_YES = _pynumerics.SICONOS_FRICTION_3D_ADMM_GET_PROBLEM_INFO_YES
SICONOS_FRICTION_3D_ADMM_UPDATE_S_YES = _pynumerics.SICONOS_FRICTION_3D_ADMM_UPDATE_S_YES
SICONOS_FRICTION_3D_ADMM_UPDATE_S_NO = _pynumerics.SICONOS_FRICTION_3D_ADMM_UPDATE_S_NO
SICONOS_FRICTION_3D_ADMM_FULL_H_NO = _pynumerics.SICONOS_FRICTION_3D_ADMM_FULL_H_NO
SICONOS_FRICTION_3D_ADMM_FULL_H_YES = _pynumerics.SICONOS_FRICTION_3D_ADMM_FULL_H_YES
SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_CONSTANT = _pynumerics.SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_CONSTANT
r""" A constant value given in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_RESIDUAL_BALANCING = _pynumerics.SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_RESIDUAL_BALANCING
r""" An adaptive strategy for rho is used"""
SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_SCALED_RESIDUAL_BALANCING = _pynumerics.SICONOS_FRICTION_3D_ADMM_RHO_STRATEGY_SCALED_RESIDUAL_BALANCING
r""" An adaptive strategy for rho is used"""
SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_GIVEN = _pynumerics.SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_GIVEN
r""" A constant value given in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_NORM_INF = _pynumerics.SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_NORM_INF
r""" A computed value stored in dparam[SICONOS_FRICTION_3D_NSN_RHO] is used"""
SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_EIGENVALUES = _pynumerics.SICONOS_FRICTION_3D_ADMM_INITIAL_RHO_EIGENVALUES
r""" An adaptive strategy for rho is used"""
SICONOS_FRICTION_3D_IPM_IPARAM_NESTEROV_TODD_SCALING = _pynumerics.SICONOS_FRICTION_3D_IPM_IPARAM_NESTEROV_TODD_SCALING
SICONOS_FRICTION_3D_IPM_IPARAM_SPARSE_STORAGE = _pynumerics.SICONOS_FRICTION_3D_IPM_IPARAM_SPARSE_STORAGE
r""" index in iparam to store the sparse storage parameter"""
SICONOS_FRICTION_3D_IPM_IPARAM_GET_PROBLEM_INFO = _pynumerics.SICONOS_FRICTION_3D_IPM_IPARAM_GET_PROBLEM_INFO
r""" index in iparam to get problem info"""
SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_1 = _pynumerics.SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_1
r""" index in dparam to store the parameter for computation the power of sigma"""
SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_2 = _pynumerics.SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_2
SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_3 = _pynumerics.SICONOS_FRICTION_3D_IPM_SIGMA_PARAMETER_3
SICONOS_FRICTION_3D_IPM_GAMMA_PARAMETER_1 = _pynumerics.SICONOS_FRICTION_3D_IPM_GAMMA_PARAMETER_1
r""" index in dparam to store the parameter for computation the safity coefficient of step length"""
SICONOS_FRICTION_3D_IPM_GAMMA_PARAMETER_2 = _pynumerics.SICONOS_FRICTION_3D_IPM_GAMMA_PARAMETER_2
SICONOS_FRICTION_3D_IPM_KEEP_STORAGE = _pynumerics.SICONOS_FRICTION_3D_IPM_KEEP_STORAGE
SICONOS_FRICTION_3D_IPM_FORCED_SPARSE_STORAGE = _pynumerics.SICONOS_FRICTION_3D_IPM_FORCED_SPARSE_STORAGE
SICONOS_FRICTION_3D_IPM_GET_PROBLEM_INFO_NO = _pynumerics.SICONOS_FRICTION_3D_IPM_GET_PROBLEM_INFO_NO
SICONOS_FRICTION_3D_IPM_GET_PROBLEM_INFO_YES = _pynumerics.SICONOS_FRICTION_3D_IPM_GET_PROBLEM_INFO_YES
SICONOS_MCP_NEWTON_FB_FBLSA = _pynumerics.SICONOS_MCP_NEWTON_FB_FBLSA
SICONOS_MCP_NEWTON_MIN_FBLSA = _pynumerics.SICONOS_MCP_NEWTON_MIN_FBLSA
SICONOS_MCP_OLD_FB = _pynumerics.SICONOS_MCP_OLD_FB
SICONOS_NCP_NEWTON_FB_FBLSA = _pynumerics.SICONOS_NCP_NEWTON_FB_FBLSA
SICONOS_NCP_NEWTON_MIN_FBLSA = _pynumerics.SICONOS_NCP_NEWTON_MIN_FBLSA
SICONOS_NCP_PATHSEARCH = _pynumerics.SICONOS_NCP_PATHSEARCH
SICONOS_NCP_PATH = _pynumerics.SICONOS_NCP_PATH
SICONOS_VI_EG = _pynumerics.SICONOS_VI_EG
SICONOS_VI_FPP = _pynumerics.SICONOS_VI_FPP
SICONOS_VI_HP = _pynumerics.SICONOS_VI_HP
SICONOS_VI_BOX_QI = _pynumerics.SICONOS_VI_BOX_QI
SICONOS_VI_BOX_AVI_LSA = _pynumerics.SICONOS_VI_BOX_AVI_LSA
SICONOS_VI_BOX_PATH = _pynumerics.SICONOS_VI_BOX_PATH
SICONOS_VI_IPARAM_DECREASE_RHO = _pynumerics.SICONOS_VI_IPARAM_DECREASE_RHO
SICONOS_VI_IPARAM_LINESEARCH_METHOD = _pynumerics.SICONOS_VI_IPARAM_LINESEARCH_METHOD
r""" index in iparam to store the linesearch method"""
SICONOS_VI_IPARAM_ERROR_EVALUATION = _pynumerics.SICONOS_VI_IPARAM_ERROR_EVALUATION
r""" index in iparam to store the error evaluation method"""
SICONOS_VI_IPARAM_ERROR_EVALUATION_FREQUENCY = _pynumerics.SICONOS_VI_IPARAM_ERROR_EVALUATION_FREQUENCY
r""" index in iparam to store the frequency of error evaluation method"""
SICONOS_VI_IPARAM_LS_MAX_ITER = _pynumerics.SICONOS_VI_IPARAM_LS_MAX_ITER
r""" index for max number of iterations allowed in line search"""
SICONOS_VI_IPARAM_ACTIVATE_UPDATE = _pynumerics.SICONOS_VI_IPARAM_ACTIVATE_UPDATE
r""" activate the update in the loop (0:false default choice)"""
SICONOS_VI_LS_ARMIJO = _pynumerics.SICONOS_VI_LS_ARMIJO
r""" : Armijo rule with Khotbotov ratio (default)"""
SICONOS_VI_LS_SOLODOV = _pynumerics.SICONOS_VI_LS_SOLODOV
r""" : Armijo rule with Solodov.Tseng ratio"""
SICONOS_VI_LS_HANSUN = _pynumerics.SICONOS_VI_LS_HANSUN
r""" Armijo rule with Han.Sun ratio"""
SICONOS_VI_DPARAM_RHO = _pynumerics.SICONOS_VI_DPARAM_RHO
r""" index in dparam to store the initial value of rho"""
SICONOS_VI_DPARAM_LS_TAU = _pynumerics.SICONOS_VI_DPARAM_LS_TAU
r""" index in dparam to store the tau coeff of line-search"""
SICONOS_VI_DPARAM_LS_TAUINV = _pynumerics.SICONOS_VI_DPARAM_LS_TAUINV
r""" index in dparam to store the tauinv coeff of line-search"""
SICONOS_VI_DPARAM_LS_L = _pynumerics.SICONOS_VI_DPARAM_LS_L
r""" index in dparam to store the L coeff of line-search"""
SICONOS_VI_DPARAM_LS_LMIN = _pynumerics.SICONOS_VI_DPARAM_LS_LMIN
r""" index in dparam to store the LMIN coeff of line-search"""
SICONOS_VI_DPARAM_SIGMA = _pynumerics.SICONOS_VI_DPARAM_SIGMA
r""" index in dparam to store the sigma coeff (HP)"""
SICONOS_VI_ERROR_EVALUATION_FULL = _pynumerics.SICONOS_VI_ERROR_EVALUATION_FULL
SICONOS_VI_ERROR_EVALUATION_LIGHT_WITH_FULL_FINAL = _pynumerics.SICONOS_VI_ERROR_EVALUATION_LIGHT_WITH_FULL_FINAL
SICONOS_VI_ERROR_EVALUATION_LIGHT = _pynumerics.SICONOS_VI_ERROR_EVALUATION_LIGHT
SICONOS_VI_ERROR_EVALUATION_ADAPTIVE = _pynumerics.SICONOS_VI_ERROR_EVALUATION_ADAPTIVE
SICONOS_GENERIC_MECHANICAL_NSGS = _pynumerics.SICONOS_GENERIC_MECHANICAL_NSGS
SICONOS_GENERIC_MECHANICAL_IPARAM_ISREDUCED = _pynumerics.SICONOS_GENERIC_MECHANICAL_IPARAM_ISREDUCED
SICONOS_GENERIC_MECHANICAL_IPARAM_WITH_LINESEARCH = _pynumerics.SICONOS_GENERIC_MECHANICAL_IPARAM_WITH_LINESEARCH
SICONOS_DPARAM_GMP_ERROR_LS = _pynumerics.SICONOS_DPARAM_GMP_ERROR_LS
SICONOS_DPARAM_GMP_COEFF_LS = _pynumerics.SICONOS_DPARAM_GMP_COEFF_LS
SICONOS_GENERIC_MECHANICAL_GS_ON_ALLBLOCKS = _pynumerics.SICONOS_GENERIC_MECHANICAL_GS_ON_ALLBLOCKS
SICONOS_GENERIC_MECHANICAL_SUBS_EQUALITIES = _pynumerics.SICONOS_GENERIC_MECHANICAL_SUBS_EQUALITIES
SICONOS_GENERIC_MECHANICAL_ASSEMBLE_EQUALITIES = _pynumerics.SICONOS_GENERIC_MECHANICAL_ASSEMBLE_EQUALITIES
SICONOS_GENERIC_MECHANICAL_MLCP_LIKE = _pynumerics.SICONOS_GENERIC_MECHANICAL_MLCP_LIKE
[docs]class functions_LSA(object):
r"""
Struct holding the necessary pointers to functions needed by the
newton_LSA() procedure.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
compute_F = property(_pynumerics.functions_LSA_compute_F_get, _pynumerics.functions_LSA_compute_F_set, doc=r""" function to evaluate w = F(z)""")
compute_F_merit = property(_pynumerics.functions_LSA_compute_F_merit_get, _pynumerics.functions_LSA_compute_F_merit_set, doc=r"""
function to evaluate F_merit(z)
(e.g. F_FB, F_{min}, ...)
""")
compute_H = property(_pynumerics.functions_LSA_compute_H_get, _pynumerics.functions_LSA_compute_H_set, doc=r""" function to get an element H of T""")
compute_error = property(_pynumerics.functions_LSA_compute_error_get, _pynumerics.functions_LSA_compute_error_set, doc=r""" function to compute the error""")
compute_RHS_desc = property(_pynumerics.functions_LSA_compute_RHS_desc_get, _pynumerics.functions_LSA_compute_RHS_desc_set, doc=r"""
function to evaluate F_desc(z) (e.g. F_FB, F_{min},
...), optional
""")
compute_H_desc = property(_pynumerics.functions_LSA_compute_H_desc_get, _pynumerics.functions_LSA_compute_H_desc_set, doc=r""" function to get an element H_desc of T_desc, optional""")
compute_descent_direction = property(_pynumerics.functions_LSA_compute_descent_direction_get, _pynumerics.functions_LSA_compute_descent_direction_set, doc=r"""
function to get the descent direction, used
for instance in the Newton-Josephy method
""")
compute_JacTheta_merit = property(_pynumerics.functions_LSA_compute_JacTheta_merit_get, _pynumerics.functions_LSA_compute_JacTheta_merit_set, doc=r"""
function to get the descent direction, used
for instance in the Newton-Josephy method
""")
get_set_from_problem_data = property(_pynumerics.functions_LSA_get_set_from_problem_data_get, _pynumerics.functions_LSA_get_set_from_problem_data_set, doc=r""" Function returning the set description from the""")
ls_failure_fn = property(_pynumerics.functions_LSA_ls_failure_fn_get, _pynumerics.functions_LSA_ls_failure_fn_set, doc=r""" Function to call when the line search fails""")
def __init__(self):
_pynumerics.functions_LSA_swiginit(self, _pynumerics.new_functions_LSA())
__swig_destroy__ = _pynumerics.delete_functions_LSA
# Register functions_LSA in _pynumerics:
_pynumerics.functions_LSA_swigregister(functions_LSA)
SICONOS_AVI_CAOFERRIS_STR = cvar.SICONOS_AVI_CAOFERRIS_STR
SICONOS_AVI_PATHAVI_STR = cvar.SICONOS_AVI_PATHAVI_STR
SICONOS_RELAY_PGS_STR = cvar.SICONOS_RELAY_PGS_STR
SICONOS_RELAY_PATH_STR = cvar.SICONOS_RELAY_PATH_STR
SICONOS_RELAY_ENUM_STR = cvar.SICONOS_RELAY_ENUM_STR
SICONOS_RELAY_LEMKE_STR = cvar.SICONOS_RELAY_LEMKE_STR
SICONOS_RELAY_AVI_CAOFERRIS_STR = cvar.SICONOS_RELAY_AVI_CAOFERRIS_STR
SICONOS_RELAY_AVI_CAOFERRIS_TEST_STR = cvar.SICONOS_RELAY_AVI_CAOFERRIS_TEST_STR
SICONOS_FRICTION_2D_NSGS_STR = cvar.SICONOS_FRICTION_2D_NSGS_STR
SICONOS_FRICTION_2D_CPG_STR = cvar.SICONOS_FRICTION_2D_CPG_STR
SICONOS_FRICTION_2D_LEMKE_STR = cvar.SICONOS_FRICTION_2D_LEMKE_STR
SICONOS_FRICTION_2D_ENUM_STR = cvar.SICONOS_FRICTION_2D_ENUM_STR
SICONOS_FRICTION_3D_NSGS_STR = cvar.SICONOS_FRICTION_3D_NSGS_STR
SICONOS_FRICTION_3D_NSGSV_STR = cvar.SICONOS_FRICTION_3D_NSGSV_STR
SICONOS_FRICTION_3D_PROX_STR = cvar.SICONOS_FRICTION_3D_PROX_STR
SICONOS_FRICTION_3D_TFP_STR = cvar.SICONOS_FRICTION_3D_TFP_STR
SICONOS_FRICTION_3D_PFP_STR = cvar.SICONOS_FRICTION_3D_PFP_STR
SICONOS_FRICTION_3D_NSN_AC_STR = cvar.SICONOS_FRICTION_3D_NSN_AC_STR
SICONOS_FRICTION_3D_NSN_AC_TEST_STR = cvar.SICONOS_FRICTION_3D_NSN_AC_TEST_STR
SICONOS_FRICTION_3D_NSN_FB_STR = cvar.SICONOS_FRICTION_3D_NSN_FB_STR
SICONOS_FRICTION_3D_NSN_NM_STR = cvar.SICONOS_FRICTION_3D_NSN_NM_STR
SICONOS_FRICTION_3D_DSFP_STR = cvar.SICONOS_FRICTION_3D_DSFP_STR
SICONOS_FRICTION_3D_VI_EG_STR = cvar.SICONOS_FRICTION_3D_VI_EG_STR
SICONOS_FRICTION_3D_VI_FPP_STR = cvar.SICONOS_FRICTION_3D_VI_FPP_STR
SICONOS_FRICTION_3D_EG_STR = cvar.SICONOS_FRICTION_3D_EG_STR
SICONOS_FRICTION_3D_FPP_STR = cvar.SICONOS_FRICTION_3D_FPP_STR
SICONOS_FRICTION_3D_HP_STR = cvar.SICONOS_FRICTION_3D_HP_STR
SICONOS_FRICTION_3D_NCPGlockerFBFixedPoint_STR = cvar.SICONOS_FRICTION_3D_NCPGlockerFBFixedPoint_STR
SICONOS_FRICTION_3D_ONECONTACT_NSN_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_NSN_STR
SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_STR
SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_HYBRID_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_NSN_GP_HYBRID_STR
SICONOS_FRICTION_3D_NCPGlockerFBNewton_STR = cvar.SICONOS_FRICTION_3D_NCPGlockerFBNewton_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithDiagonalization_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithDiagonalization_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithRegularization_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithRegularization_STR
SICONOS_FRICTION_3D_NCPGlockerFBPATH_STR = cvar.SICONOS_FRICTION_3D_NCPGlockerFBPATH_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinder_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinder_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinderWithLocalIteration_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCylinderWithLocalIteration_STR
SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_velocity_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone_velocity_STR
SICONOS_FRICTION_3D_CONVEXQP_PG_CYLINDER_STR = cvar.SICONOS_FRICTION_3D_CONVEXQP_PG_CYLINDER_STR
SICONOS_FRICTION_3D_VI_FPP_Cylinder_STR = cvar.SICONOS_FRICTION_3D_VI_FPP_Cylinder_STR
SICONOS_FRICTION_3D_GAMS_PATH_STR = cvar.SICONOS_FRICTION_3D_GAMS_PATH_STR
SICONOS_FRICTION_3D_GAMS_PATHVI_STR = cvar.SICONOS_FRICTION_3D_GAMS_PATHVI_STR
SICONOS_FRICTION_3D_GAMS_LCP_PATH_STR = cvar.SICONOS_FRICTION_3D_GAMS_LCP_PATH_STR
SICONOS_FRICTION_3D_GAMS_LCP_PATHVI_STR = cvar.SICONOS_FRICTION_3D_GAMS_LCP_PATHVI_STR
SICONOS_FRICTION_3D_SOCLCP_STR = cvar.SICONOS_FRICTION_3D_SOCLCP_STR
SICONOS_FRICTION_3D_ACLMFP_STR = cvar.SICONOS_FRICTION_3D_ACLMFP_STR
SICONOS_FRICTION_3D_ADMM_STR = cvar.SICONOS_FRICTION_3D_ADMM_STR
SICONOS_GLOBAL_FRICTION_3D_NSGS_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_NSGS_WR_STR
SICONOS_GLOBAL_FRICTION_3D_NSGSV_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_NSGSV_WR_STR
SICONOS_GLOBAL_FRICTION_3D_PROX_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_PROX_WR_STR
SICONOS_GLOBAL_FRICTION_3D_DSFP_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_DSFP_WR_STR
SICONOS_GLOBAL_FRICTION_3D_TFP_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_TFP_WR_STR
SICONOS_GLOBAL_FRICTION_3D_NSGS_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_NSGS_STR
SICONOS_GLOBAL_FRICTION_3D_NSN_AC_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_NSN_AC_WR_STR
SICONOS_GLOBAL_FRICTION_3D_NSN_AC_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_NSN_AC_STR
SICONOS_GLOBAL_FRICTION_3D_GAMS_PATH_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_GAMS_PATH_STR
SICONOS_GLOBAL_FRICTION_3D_GAMS_PATHVI_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_GAMS_PATHVI_STR
SICONOS_GLOBAL_FRICTION_3D_VI_FPP_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_VI_FPP_STR
SICONOS_GLOBAL_FRICTION_3D_VI_EG_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_VI_EG_STR
SICONOS_GLOBAL_FRICTION_3D_ACLMFP_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_ACLMFP_STR
SICONOS_GLOBAL_FRICTION_3D_ADMM_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_ADMM_STR
SICONOS_GLOBAL_FRICTION_3D_ADMM_WR_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_ADMM_WR_STR
SICONOS_GLOBAL_FRICTION_3D_IPM_STR = cvar.SICONOS_GLOBAL_FRICTION_3D_IPM_STR
SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_STR
SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_NU_STR = cvar.SICONOS_FRICTION_3D_ONECONTACT_QUARTIC_NU_STR
SICONOS_ROLLING_FRICTION_3D_NSGS_STR = cvar.SICONOS_ROLLING_FRICTION_3D_NSGS_STR
SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnCone_STR = cvar.SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnCone_STR
SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR = cvar.SICONOS_ROLLING_FRICTION_3D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR
SICONOS_ROLLING_FRICTION_3D_ADMM_STR = cvar.SICONOS_ROLLING_FRICTION_3D_ADMM_STR
SICONOS_ROLLING_FRICTION_2D_NSGS_STR = cvar.SICONOS_ROLLING_FRICTION_2D_NSGS_STR
SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnCone_STR = cvar.SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnCone_STR
SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR = cvar.SICONOS_ROLLING_FRICTION_2D_ONECONTACT_ProjectionOnConeWithLocalIteration_STR
SICONOS_GLOBAL_ROLLING_FRICTION_3D_NSGS_WR_STR = cvar.SICONOS_GLOBAL_ROLLING_FRICTION_3D_NSGS_WR_STR
SICONOS_MCP_OLD_FB_STR = cvar.SICONOS_MCP_OLD_FB_STR
SICONOS_MCP_NEWTON_FB_FBLSA_STR = cvar.SICONOS_MCP_NEWTON_FB_FBLSA_STR
SICONOS_MCP_NEWTON_MIN_FBLSA_STR = cvar.SICONOS_MCP_NEWTON_MIN_FBLSA_STR
SICONOS_NCP_NEWTON_FB_FBLSA_STR = cvar.SICONOS_NCP_NEWTON_FB_FBLSA_STR
SICONOS_NCP_NEWTON_MIN_FBLSA_STR = cvar.SICONOS_NCP_NEWTON_MIN_FBLSA_STR
SICONOS_NCP_PATHSEARCH_STR = cvar.SICONOS_NCP_PATHSEARCH_STR
SICONOS_NCP_PATH_STR = cvar.SICONOS_NCP_PATH_STR
SICONOS_VI_EG_STR = cvar.SICONOS_VI_EG_STR
SICONOS_VI_FPP_STR = cvar.SICONOS_VI_FPP_STR
SICONOS_VI_HP_STR = cvar.SICONOS_VI_HP_STR
SICONOS_VI_BOX_QI_STR = cvar.SICONOS_VI_BOX_QI_STR
SICONOS_VI_BOX_AVI_LSA_STR = cvar.SICONOS_VI_BOX_AVI_LSA_STR
SICONOS_VI_BOX_PATH_STR = cvar.SICONOS_VI_BOX_PATH_STR
SICONOS_GENERIC_MECHANICAL_NSGS_STR = cvar.SICONOS_GENERIC_MECHANICAL_NSGS_STR
NEWTON_STATS_ITERATION = _pynumerics.NEWTON_STATS_ITERATION
class newton_stats(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
id = property(_pynumerics.newton_stats_id_get, _pynumerics.newton_stats_id_set, doc=r""" id of this structure""")
merit_value = property(_pynumerics.newton_stats_merit_value_get, _pynumerics.newton_stats_merit_value_set, doc=r"""
value of the merit function at the end of the
iteration
""")
alpha = property(_pynumerics.newton_stats_alpha_get, _pynumerics.newton_stats_alpha_set, doc=r""" value of the LS parameter""")
status = property(_pynumerics.newton_stats_status_get, _pynumerics.newton_stats_status_set, doc=r""" status of this newton iteration""")
def __init__(self):
_pynumerics.newton_stats_swiginit(self, _pynumerics.new_newton_stats())
__swig_destroy__ = _pynumerics.delete_newton_stats
# Register newton_stats in _pynumerics:
_pynumerics.newton_stats_swigregister(newton_stats)
class newton_LSA_param(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
p = property(_pynumerics.newton_LSA_param_p_get, _pynumerics.newton_LSA_param_p_set, doc=r"""
p value for the acceptance test of the direction solution of
the linear system
""")
sigma = property(_pynumerics.newton_LSA_param_sigma_get, _pynumerics.newton_LSA_param_sigma_set, doc=r"""
ratio for the decrease in norm of the C-function
(:math:`gamma'` in VFBLSA)
""")
rho = property(_pynumerics.newton_LSA_param_rho_get, _pynumerics.newton_LSA_param_rho_set, doc=r""" coefficient for the direction check""")
keep_H = property(_pynumerics.newton_LSA_param_keep_H_get, _pynumerics.newton_LSA_param_keep_H_set, doc=r"""
keep the matrix H untouched. Only used in the dense case,
where a copy of the matrix is factorized
""")
check_dir_quality = property(_pynumerics.newton_LSA_param_check_dir_quality_get, _pynumerics.newton_LSA_param_check_dir_quality_set, doc=r"""
Check the quality of the descent direction
(Eqn 9.1.6 p. 805 in Facchinei & Pang)
""")
def __init__(self):
_pynumerics.newton_LSA_param_swiginit(self, _pynumerics.new_newton_LSA_param())
__swig_destroy__ = _pynumerics.delete_newton_LSA_param
# Register newton_LSA_param in _pynumerics:
_pynumerics.newton_LSA_param_swigregister(newton_LSA_param)
class newton_LSA_data(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
H = property(_pynumerics.newton_LSA_data_H_get, _pynumerics.newton_LSA_data_H_set, doc=r""" matrix""")
def __init__(self):
_pynumerics.newton_LSA_data_swiginit(self, _pynumerics.new_newton_LSA_data())
__swig_destroy__ = _pynumerics.delete_newton_LSA_data
# Register newton_LSA_data in _pynumerics:
_pynumerics.newton_LSA_data_swigregister(newton_LSA_data)
SICONOS_NEWTON_LSA = _pynumerics.SICONOS_NEWTON_LSA
SICONOS_IPARAM_LSA_NONMONOTONE_LS = _pynumerics.SICONOS_IPARAM_LSA_NONMONOTONE_LS
r""" line search based algo use this"""
SICONOS_IPARAM_LSA_NONMONOTONE_LS_M = _pynumerics.SICONOS_IPARAM_LSA_NONMONOTONE_LS_M
SICONOS_IPARAM_LSA_FORCE_ARCSEARCH = _pynumerics.SICONOS_IPARAM_LSA_FORCE_ARCSEARCH
SICONOS_IPARAM_LSA_SEARCH_CRITERION = _pynumerics.SICONOS_IPARAM_LSA_SEARCH_CRITERION
SICONOS_IPARAM_STOPPING_CRITERION = _pynumerics.SICONOS_IPARAM_STOPPING_CRITERION
SICONOS_STOPPING_CRITERION_RESIDU = _pynumerics.SICONOS_STOPPING_CRITERION_RESIDU
SICONOS_STOPPING_CRITERION_STATIONARITY = _pynumerics.SICONOS_STOPPING_CRITERION_STATIONARITY
SICONOS_STOPPING_CRITERION_RESIDU_AND_STATIONARITY = _pynumerics.SICONOS_STOPPING_CRITERION_RESIDU_AND_STATIONARITY
SICONOS_STOPPING_CRITERION_USER_ROUTINE = _pynumerics.SICONOS_STOPPING_CRITERION_USER_ROUTINE
SICONOS_IPARAM_GOLDSTEIN_ITERMAX = _pynumerics.SICONOS_IPARAM_GOLDSTEIN_ITERMAX
SICONOS_IPARAM_NMS_WATCHDOG_TYPE = _pynumerics.SICONOS_IPARAM_NMS_WATCHDOG_TYPE
r""" non-monotone specific part"""
SICONOS_IPARAM_NMS_PROJECTED_GRADIENT_TYPE = _pynumerics.SICONOS_IPARAM_NMS_PROJECTED_GRADIENT_TYPE
SICONOS_IPARAM_NMS_N_MAX = _pynumerics.SICONOS_IPARAM_NMS_N_MAX
SICONOS_DPARAM_LSA_ALPHA_MIN = _pynumerics.SICONOS_DPARAM_LSA_ALPHA_MIN
r""" line-search"""
SICONOS_DPARAM_GOLDSTEIN_C = _pynumerics.SICONOS_DPARAM_GOLDSTEIN_C
SICONOS_DPARAM_GOLDSTEIN_ALPHAMAX = _pynumerics.SICONOS_DPARAM_GOLDSTEIN_ALPHAMAX
SICONOS_DPARAM_NMS_DELTA = _pynumerics.SICONOS_DPARAM_NMS_DELTA
r""" non-monotone specific part"""
SICONOS_DPARAM_NMS_DELTA_VAR = _pynumerics.SICONOS_DPARAM_NMS_DELTA_VAR
SICONOS_DPARAM_NMS_SIGMA = _pynumerics.SICONOS_DPARAM_NMS_SIGMA
SICONOS_DPARAM_NMS_ALPHA_MIN_WATCHDOG = _pynumerics.SICONOS_DPARAM_NMS_ALPHA_MIN_WATCHDOG
SICONOS_DPARAM_NMS_ALPHA_MIN_PGRAD = _pynumerics.SICONOS_DPARAM_NMS_ALPHA_MIN_PGRAD
SICONOS_DPARAM_NMS_MERIT_INCR = _pynumerics.SICONOS_DPARAM_NMS_MERIT_INCR
NEWTON_STATS_NEWTON_STEP = _pynumerics.NEWTON_STATS_NEWTON_STEP
NEWTON_STATS_DESC_DIR = _pynumerics.NEWTON_STATS_DESC_DIR
[docs]def newton_LSA(n: "unsigned int", z: "double *", w: "double *", data: "void *", options: "SolverOptions", functions: "functions_LSA") -> "int *":
r"""
Newton algorithm for finding the zero of a function with a line search.
Mainly used for equation-based reformulation of CP or VI.
:type n: int
:param n: size of the problem
:type z: float
:param z: variable
:type w: float
:param w: value of F(z)
:type info: int
:param info: solver-specific values
:type data: void
:param data: opaque problem definition
:type options: :py:class:`SolverOptions`
:param options: options for this solver
:type functions: :py:class:`functions_LSA`
:param functions: struct of function pointers to compute F, H and the error
"""
return _pynumerics.newton_LSA(n, z, w, data, options, functions)
[docs]def init_lsa_functions(functions: "functions_LSA", compute_F: "compute_F_ptr", merit_function: "compute_F_merit_ptr") -> "void":
r"""
Set the functions to compute F and F_merit and all the other pointers to
NULL
:type functions: :py:class:`functions_LSA`
:param functions: structure to fill
:type compute_F: void
:param compute_F: function to compute F
:type merit_function: void
:param merit_function: function to compute F_merit
"""
return _pynumerics.init_lsa_functions(functions, compute_F, merit_function)
[docs]def set_lsa_params_data(options: "SolverOptions", mat: "NumericsMatrix") -> "void":
r"""
Set the parameters and data for newton_LSA
:type options: :py:class:`SolverOptions`
:param options: the solver option
:type mat: :py:class:`NumericsMatrix`
:param mat: the
"""
return _pynumerics.set_lsa_params_data(options, mat)
[docs]def newton_LSA_free_solverOptions(options: "SolverOptions") -> "void":
r"""
clear the solver-specific data
:type options: :py:class:`SolverOptions`
:param options: the SolverOption structure
"""
return _pynumerics.newton_LSA_free_solverOptions(options)
def newton_lsa_set_default(options: "SolverOptions") -> "void":
return _pynumerics.newton_lsa_set_default(options)
PROJCONE_DUAL = _pynumerics.PROJCONE_DUAL
PROJCONE_INSIDE = _pynumerics.PROJCONE_INSIDE
PROJCONE_BOUNDARY = _pynumerics.PROJCONE_BOUNDARY
[docs]def projectionOnCone(r: "double *", mu: "double") -> "unsigned int":
r"""
projectionOnCone Projection on the second Order Cone in :math:`R^3`, :math:`K \{ r, r_1 \geq 0, 0 \sqrt(r_2^2+r_3^2) \geq mu r_1 \}`
:type r: float, in/out
:param r: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:rtype: int
:return: the type of projection
"""
return _pynumerics.projectionOnCone(r, mu)
[docs]def projectionOnDualCone(u: "double *", mu: "double") -> "unsigned int":
r"""
projectionOnDualCone Projection on the second Order Cone in :math:`R^3`,
:math:`K \{ r, r_1 \geq 0, 0 mu \sqrt(u_2^2+u_3^2) \geq u_1 \}`
:type u: float, in/out
:param u: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:rtype: int
:return: the type of projection
"""
return _pynumerics.projectionOnDualCone(u, mu)
[docs]def projectionOnSecondOrderCone(r: "double *", mu: "double", size: "int") -> "void":
r"""
projectionOnCone Projection on the second Order Cone in :math:`R^n`, :math:`K \{ r, r_1 \geq 0, 0 \|[r_2,r_n]\| \geq mu r_1 \}`
:type r: float, in/out
:param r: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:type size: int, in
:param size: dimension
"""
return _pynumerics.projectionOnSecondOrderCone(r, mu, size)
PROJRCONE_DUAL = _pynumerics.PROJRCONE_DUAL
PROJRCONE_INSIDE = _pynumerics.PROJRCONE_INSIDE
PROJRCONE_BOUNDARY_FRICTION = _pynumerics.PROJRCONE_BOUNDARY_FRICTION
PROJRCONE_BOUNDARY_ROLLING = _pynumerics.PROJRCONE_BOUNDARY_ROLLING
PROJRCONE_BOUNDARY_FRICTION_ROLLING = _pynumerics.PROJRCONE_BOUNDARY_FRICTION_ROLLING
[docs]def projectionOnRollingCone(r: "double *", mu: "double", mur: "double") -> "unsigned int":
r"""
projectionOnCone Projection on the second Order Cone in :math:`R^3`, :math:`K \{ r, r_1 \geq 0, 0 \sqrt(r_2^2+r_3^2) \geq mu r_1 \}`
:type r: float, in/out
:param r: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:rtype: int
:return: the type of projection
"""
return _pynumerics.projectionOnRollingCone(r, mu, mur)
[docs]def projectionOn2DRollingCone(r: "double *", mu: "double", mur: "double") -> "unsigned int":
r"""
projectionOnCone Projection on the second Order Cone in :math:`R^3`, :math:`K \{ r, r_1 \geq 0, 0 \sqrt(r_2^2+r_3^2) \geq mu r_1 \}`
:type r: float, in/out
:param r: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:rtype: int
:return: the type of projection
"""
return _pynumerics.projectionOn2DRollingCone(r, mu, mur)
[docs]def projectionOnDualRollingCone(u: "double *", mu: "double", mur: "double") -> "unsigned int":
r"""
projectionOnDualCone Projection on the second Order Cone in :math:`R^3`, :math:`K \{ r, r_1 \geq 0, 0 mu \sqrt(u_2^2+u_3^2) \geq u_1 \}`
:type u: float, in/out
:param u: the vector to be projected
:type mu: float, in
:param mu: the angle of the cone
:rtype: int
:return: the type of projection
"""
return _pynumerics.projectionOnDualRollingCone(u, mu, mur)
def display_status_rolling_cone(status: "unsigned int") -> "void":
return _pynumerics.display_status_rolling_cone(status)
ENV_IS_C_STRUCT = _pynumerics.ENV_IS_C_STRUCT
ENV_IS_UNKNOWN = _pynumerics.ENV_IS_UNKNOWN
ENV_IS_PYTHON_CLASS = _pynumerics.ENV_IS_PYTHON_CLASS
ENV_IS_PYTHON_FUNCTIONS = _pynumerics.ENV_IS_PYTHON_FUNCTIONS
ENV_IS_PYTHON_FUNCTIONS_WITH_PROJ = _pynumerics.ENV_IS_PYTHON_FUNCTIONS_WITH_PROJ
ENV_IS_MATLAB_FUNCTION_HANDLES = _pynumerics.ENV_IS_MATLAB_FUNCTION_HANDLES
ENV_IS_MATLAB_FUNCTION_NAMES = _pynumerics.ENV_IS_MATLAB_FUNCTION_NAMES
[docs]class MCP(object):
r""" Structure that contains and defines a MixedComplementarityProblem"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
n1 = property(_pynumerics.MCP_n1_get, _pynumerics.MCP_n1_set, doc=r""" number of equalities constraints""")
n2 = property(_pynumerics.MCP_n2_get, _pynumerics.MCP_n2_set, doc=r""" size of complementarity variables""")
compute_Fmcp = property(_pynumerics.MCP_compute_Fmcp_get, _pynumerics.MCP_compute_Fmcp_set, doc=r"""
pointer to the function used to compute
:math:`F_{mcp}(z) = (G(z), H(z))`
""")
compute_nabla_Fmcp = property(_pynumerics.MCP_compute_nabla_Fmcp_get, _pynumerics.MCP_compute_nabla_Fmcp_set, doc=r"""
pointer to the function used to
compute :math:`\nabla_z F_{mcp}`
""")
nabla_Fmcp = property(_pynumerics.MCP_nabla_Fmcp_get, _pynumerics.MCP_nabla_Fmcp_set, doc=r""" storage for :math:`\nabla_z F_{mcp}`""")
env = property(_pynumerics.MCP_env_get, _pynumerics.MCP_env_set, doc=r"""
environment for the compute_Fmcp and compute_nabla_Fmcp
function. When called from Python, it contains an object with
compute_Fmcp and compute_nabla_Fmcp as methods.
When called from C, it can reference a data struct containing
variables needed for the computations.
""")
@staticmethod
def call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.MCP_call_compute_F(problem, n, z, F)
@staticmethod
def call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.MCP_call_compute_nabla_F(problem, n, z, nabla_F)
def __init__(self, *args):
_pynumerics.MCP_swiginit(self, _pynumerics.new_MCP(*args))
def set_compute_F_and_nabla_F_as_C_functions(self, lib_name: "PyObject *", compute_F_name: "PyObject *", compute_nabla_F_name: "PyObject *") -> "void":
return _pynumerics.MCP_set_compute_F_and_nabla_F_as_C_functions(self, lib_name, compute_F_name, compute_nabla_F_name)
def get_env_as_long(self) -> "PyObject *":
return _pynumerics.MCP_get_env_as_long(self)
__swig_destroy__ = _pynumerics.delete_MCP
# Register MCP in _pynumerics:
_pynumerics.MCP_swigregister(MCP)
SICONOS_NEWTON_LSA_STR = cvar.SICONOS_NEWTON_LSA_STR
def MCP_call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.MCP_call_compute_F(problem, n, z, F)
def MCP_call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.MCP_call_compute_nabla_F(problem, n, z, nabla_F)
[docs]class MCP_old(object):
r"""
The structure that defines a Mixed Complementarity problem (MCP) : find two
vectors :math:`(z,w \in {{\mathrm{I\!R}}}^{n+m})` such that:
.. math::
w &= \begin{pmatrix}w_e\\w_i\end{pmatrix} = F(z) \ \
w_e &=0 \ \
0 &\le w_i \perp z_i \ge 0
where "i" (resp. "e") stands for inequalities (resp. equalities). The vector
:math:`z` is splitted like :math:`w`:
.. math::
z =\begin{pmatrix}z_e\\z_i\end{pmatrix}
:math:`z_i,w_i` are vectors of size sizeEqualities, :math:`z_e,w_e` vectors
of size sizeInequalities
and :math:`F` is a non linear function that must be user-defined.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
sizeEqualities = property(_pynumerics.MCP_old_sizeEqualities_get, _pynumerics.MCP_old_sizeEqualities_set, doc=r""" size of equalities :math:`z_e, w_e` size""")
sizeInequalities = property(_pynumerics.MCP_old_sizeInequalities_get, _pynumerics.MCP_old_sizeInequalities_set, doc=r""" size of inequalities :math:`z_i,w_i` size""")
computeFmcp = property(_pynumerics.MCP_old_computeFmcp_get, _pynumerics.MCP_old_computeFmcp_set, doc=r""" pointer to the function to compute F(z)""")
computeNablaFmcp = property(_pynumerics.MCP_old_computeNablaFmcp_get, _pynumerics.MCP_old_computeNablaFmcp_set)
Fmcp = property(_pynumerics.MCP_old_Fmcp_get, _pynumerics.MCP_old_Fmcp_set, doc=r"""
pointer to the function to compute the
jacobian of F(z) The value F(z)
""")
nablaFmcp = property(_pynumerics.MCP_old_nablaFmcp_get, _pynumerics.MCP_old_nablaFmcp_set, doc=r""" jacobian of F(z)""")
def set_computeFmcp(self, o: "PyObject *") -> "void":
return _pynumerics.MCP_old_set_computeFmcp(self, o)
def set_computeNablaFmcp(self, o: "PyObject *") -> "void":
return _pynumerics.MCP_old_set_computeNablaFmcp(self, o)
def test_call_to_callback(self) -> "void":
return _pynumerics.MCP_old_test_call_to_callback(self)
def __init__(self, *args):
_pynumerics.MCP_old_swiginit(self, _pynumerics.new_MCP_old(*args))
__swig_destroy__ = _pynumerics.delete_MCP_old
# Register MCP_old in _pynumerics:
_pynumerics.MCP_old_swigregister(MCP_old)
[docs]def mixedComplementarityProblem_free(mcp: "MCP") -> "void":
r"""
free a MCP problem
:type mcp: :py:class:`MixedComplementarityProblem`
:param mcp: structure to free
"""
return _pynumerics.mixedComplementarityProblem_free(mcp)
[docs]def mixedComplementarityProblem_new() -> "MixedComplementarityProblem *":
r"""
:rtype: :py:class:`MixedComplementarityProblem`
:return: an empty MixedComplementarityProblem instance
"""
return _pynumerics.mixedComplementarityProblem_new()
[docs]def mixedComplementarityProblem_old_free(problem: "MCP_old") -> "void":
r"""
Delete a MixedComplementarityProblem_old
:type problem: :py:class:`MixedComplementarityProblem_old`
:param problem: pointer to a MixedComplementarityProblem_old to delete
"""
return _pynumerics.mixedComplementarityProblem_old_free(problem)
[docs]def mcp_newton_FB_FBLSA(problem: "MCP", z: "double *", Fmcp: "double *", options: "SolverOptions") -> "int *":
r"""
Solver based on Fischer-Burmeister reformulation and line search (VFBLSA
in Facchinei--Pang 2003 p. 834)
:type problem: :py:class:`MixedComplementarityProblem`, in
:param problem: a structure which represents the MCP
:type z: float, in/out
:param z: a n1+n2-vector, initial solution + returns the solution of the problem.
:type Fmcp: float, out
:param Fmcp: n1+n2-vector which contains the value of Fmcp(z) = (G(z), H(z))
:type info: int, out
:param info: termination value: 0 if success else >0.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.mcp_newton_FB_FBLSA(problem, z, Fmcp, options)
[docs]def mcp_newton_min_FBLSA(problem: "MCP", z: "double *", Fmcp: "double *", options: "SolverOptions") -> "int *":
r"""
Solver based on Fischer-Burmeister reformulation and line search. The
descent direction is found using a min reformulation (minFBLSA in
Facchinei--Pang 2003 p. 855)
:type problem: :py:class:`MixedComplementarityProblem`, in
:param problem: a structure which represents the MCP
:type z: float, in/out
:param z: a n1+n2-vector, initial solution + returns the solution of the problem.
:type Fmcp: float, out
:param Fmcp: n1+n2-vector which contains the value of Fmcp(z) = (G(z), H(z))
:type info: int, out
:param info: termination value: 0 if success else >0.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.mcp_newton_min_FBLSA(problem, z, Fmcp, options)
def mcp_compute_error(problem: "MCP", z: "double *", w: "double *") -> "double *":
return _pynumerics.mcp_compute_error(problem, z, w)
[docs]def mcp_old_driver_init(problem: "MCP_old", options: "SolverOptions") -> "void":
r"""
Initialisation of the MCP solver (set problem, allocate working memory and so on. This routine must be called before any attempt to run the mcp_old_driver.
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: the description of the MCP
:type options: :py:class:`SolverOptions`, in
:param options: for the solver
"""
return _pynumerics.mcp_old_driver_init(problem, options)
[docs]def mcp_old_driver_reset(problem: "MCP_old", options: "SolverOptions") -> "void":
r"""
Reset of the MCP solver
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: the description of the MCP
:type options: :py:class:`SolverOptions`, in
:param options: for the solver
"""
return _pynumerics.mcp_old_driver_reset(problem, options)
[docs]def mcp_old_FischerBurmeister(problem: "MCP_old", z: "double *", w: "double *", options: "SolverOptions") -> "int *":
r"""
Fischer Burmeister solver
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: a structure which represents the MCP
:type z: float, in/out
:param z: a m+n-vector, initial solution + returns the solution of the problem.
:type w: float, out
:param w: not used
:type info: int, out
:param info: termination value: 0 if success else >0.
:type options: :py:class:`SolverOptions`, in/out
:param options: structure used to define the solver and its parameters.
"""
return _pynumerics.mcp_old_FischerBurmeister(problem, z, w, options)
[docs]def mcp_old_FischerBurmeister_init(problem: "MCP_old", options: "SolverOptions") -> "void":
r"""
Initialisation of the MCP Fischer solver (set problem, allocate working memory and so on. This routine must be called before any attempt to run the mcp_old_driver.
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: description of the MCP
:type options: :py:class:`SolverOptions`, in
:param options: for the solver
"""
return _pynumerics.mcp_old_FischerBurmeister_init(problem, options)
[docs]def mcp_old_FischerBurmeister_reset(problem: "MCP_old", options: "SolverOptions") -> "void":
r"""
Reset of the MCP Fischer solver (free local variable)
:type problem: :py:class:`MixedComplementarityProblem_old`, in
:param problem: description of the MCP
:type options: :py:class:`SolverOptions`, in
:param options: for the solver
"""
return _pynumerics.mcp_old_FischerBurmeister_reset(problem, options)
def mcp_old_compute_error(problem: "MCP_old", z: "double *", w: "double *") -> "double *":
return _pynumerics.mcp_old_compute_error(problem, z, w)
[docs]class NCP(object):
r"""
The structure that defines a Nonlinear Complementarity Problem (NCP) :
Find two vectors :math:`(z,w \in {{\mathrm{I\!R}}}^{n})` such that:
.. math::
w &= F(z) \\ 0 &\le w \perp z \ge 0
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
n = property(_pynumerics.NCP_n_get, _pynumerics.NCP_n_set, doc=r""" size of the problem""")
compute_F = property(_pynumerics.NCP_compute_F_get, _pynumerics.NCP_compute_F_set, doc=r""" pointer to the function used to compute :math:`F(z)`""")
compute_nabla_F = property(_pynumerics.NCP_compute_nabla_F_get, _pynumerics.NCP_compute_nabla_F_set, doc=r"""
pointer to the function used to
compute :math:`\nabla_z F(z)`
""")
nabla_F = property(_pynumerics.NCP_nabla_F_get, _pynumerics.NCP_nabla_F_set, doc=r""" storage for :math:`\nabla_z F`""")
env = property(_pynumerics.NCP_env_get, _pynumerics.NCP_env_set, doc=r"""
environment for the compute_Fmcp and compute_nabla_F function.
When called from Python, it contains an object with compute_F and
compute_nabla_F as methods.
When called from C, it can reference a data struct containing
variables needed for the computations.
""")
@staticmethod
def call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.NCP_call_compute_F(problem, n, z, F)
@staticmethod
def call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.NCP_call_compute_nabla_F(problem, n, z, nabla_F)
def __init__(self, *args):
_pynumerics.NCP_swiginit(self, _pynumerics.new_NCP(*args))
def set_compute_F_and_nabla_F_as_C_functions(self, lib_name: "PyObject *", compute_F_name: "PyObject *", compute_nabla_F_name: "PyObject *") -> "void":
return _pynumerics.NCP_set_compute_F_and_nabla_F_as_C_functions(self, lib_name, compute_F_name, compute_nabla_F_name)
def get_env_as_long(self) -> "PyObject *":
return _pynumerics.NCP_get_env_as_long(self)
__swig_destroy__ = _pynumerics.delete_NCP
# Register NCP in _pynumerics:
_pynumerics.NCP_swigregister(NCP)
def NCP_call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.NCP_call_compute_F(problem, n, z, F)
def NCP_call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.NCP_call_compute_nabla_F(problem, n, z, nabla_F)
[docs]def freeNCP(ncp: "NCP") -> "void":
r"""
free an NCP problem
:type ncp: :py:class:`NonlinearComplementarityProblem`
:param ncp: structure to free
"""
return _pynumerics.freeNCP(ncp)
[docs]def newNCP() -> "NonlinearComplementarityProblem *":
r"""
create an empty NCP problem
:rtype: :py:class:`NonlinearComplementarityProblem`
:return: an MixedComplementarityProblem instance
"""
return _pynumerics.newNCP()
[docs]def ncp_compute_error(n: "int", z: "double *", F: "double *", tol: "double", err: "double *") -> "int":
r"""
This function compute the complementarity error of the NCP: :math:`0 \leq z \perp F(z) \geq 0`.
:type n: int
:param n: size of the vectors
:type z: float, in
:param z: solution
:type F: float, in
:param F: value of the function at the solution
:type tol: float, in
:param tol: tolerance for the error
:type err: float, out
:param err: value of the error
:rtype: int
:return: 0 if the solution is good enough, 1 otherwise
"""
return _pynumerics.ncp_compute_error(n, z, F, tol, err)
[docs]def ncp_newton_FBLSA(problem: "NCP", z: "double *", F: "double *", options: "SolverOptions") -> "int *":
r"""
NCP Solver using the FB merit function and a Newton-based method with
line-search
:type problem: :py:class:`NonlinearComplementarityProblem`
:param problem: the formalization of the NCP problem
:type z: float, in/out
:param z: on input, initial guess; on output the solution
:type F: float
:param F: the value of the function at the solution
:type info: int
:param info: 0 if everything worked
:type options: :py:class:`SolverOptions`
:param options: struct used to specify the solver parameters
"""
return _pynumerics.ncp_newton_FBLSA(problem, z, F, options)
[docs]def ncp_newton_minFBLSA(problem: "NCP", z: "double *", F: "double *", options: "SolverOptions") -> "int *":
r"""
NCP Solver using the min merit function (+ the FB as backup) and a Newton-based method with
line-search
:type problem: :py:class:`NonlinearComplementarityProblem`
:param problem: the formalization of the NCP problem
:type z: float, in/out
:param z: on input, initial guess; on output the solution
:type F: float
:param F: the value of the function at the solution
:type info: int
:param info: 0 if everything worked
:type options: :py:class:`SolverOptions`
:param options: struct used to specify the solver parameters
"""
return _pynumerics.ncp_newton_minFBLSA(problem, z, F, options)
[docs]def ncp_pathsearch(problem: "NCP", z: "double *", F: "double *", options: "SolverOptions") -> "int *":
r"""
NCP Solver using a path search algorithm, following the work of D. Ralph.
M. Ferris, and many other collaborators of the latter.
:type problem: :py:class:`NonlinearComplementarityProblem`
:param problem: the formalization of the NCP problem
:type z: float, in/out
:param z: on input, initial guess; on output the solution
:type F: float
:param F: the value of the function at the solution
:type info: int
:param info: 0 if everything worked
:type options: :py:class:`SolverOptions`
:param options: struct used to specify the solver parameters
"""
return _pynumerics.ncp_pathsearch(problem, z, F, options)
[docs]def ncp_path(problem: "NCP", z: "double *", F: "double *", options: "SolverOptions") -> "int *":
r"""
NCP Solver using the PATH solver
:type problem: :py:class:`NonlinearComplementarityProblem`
:param problem: the formalization of the NCP problem
:type z: float, in/out
:param z: on input, initial guess; on output the solution
:type F: float
:param F: the value of the function at the solution
:type info: int
:param info: 0 if everything worked
:type options: :py:class:`SolverOptions`
:param options: struct used to specify the solver parameters
"""
return _pynumerics.ncp_path(problem, z, F, options)
class VI(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
size = property(_pynumerics.VI_size_get, _pynumerics.VI_size_set, doc=r""" size of the VI :math:`n`""")
env = property(_pynumerics.VI_env_get, _pynumerics.VI_env_set, doc=r""" pointer onto env object (which is self is the simplest case)""")
F = property(_pynumerics.VI_F_get, _pynumerics.VI_F_set, doc=r""" Function of the VI""")
compute_nabla_F = property(_pynumerics.VI_compute_nabla_F_get, _pynumerics.VI_compute_nabla_F_set, doc=r""" Function to compute the jacobian of F""")
ProjectionOnX = property(_pynumerics.VI_ProjectionOnX_get, _pynumerics.VI_ProjectionOnX_set, doc=r""" Projection on X of the VI""")
normVI = property(_pynumerics.VI_normVI_get, _pynumerics.VI_normVI_set, doc=r""" Norm of the VI problem to compute relative solution""")
istheNormVIset = property(_pynumerics.VI_istheNormVIset_get, _pynumerics.VI_istheNormVIset_set, doc=r"""
Boolean to know if the norm is set
If not (istheNormVIset=0) it will be computed in the first call of variationalInequality_computeError
By default, set istheNormVIset =0
""")
set = property(_pynumerics.VI_set_get, _pynumerics.VI_set_set, doc=r""" opaque struct that represent the set K (possibly empty)""")
nabla_F = property(_pynumerics.VI_nabla_F_get, _pynumerics.VI_nabla_F_set, doc=r""" storage for :math:`\nabla_x F`""")
@staticmethod
def call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.VI_call_compute_F(problem, n, z, F)
@staticmethod
def call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.VI_call_compute_nabla_F(problem, n, z, nabla_F)
def __init__(self, *args):
_pynumerics.VI_swiginit(self, _pynumerics.new_VI(*args))
def set_compute_nabla_F(self, compute_nabla_F: "PyObject *") -> "void":
return _pynumerics.VI_set_compute_nabla_F(self, compute_nabla_F)
def set_box_constraints(self, box_lower_bound: "PyObject *", box_upper_bound: "PyObject *") -> "void":
return _pynumerics.VI_set_box_constraints(self, box_lower_bound, box_upper_bound)
def set_compute_F_and_nabla_F_as_C_functions(self, lib_name: "PyObject *", compute_F_name: "PyObject *", compute_nabla_F_name: "PyObject *") -> "void":
return _pynumerics.VI_set_compute_F_and_nabla_F_as_C_functions(self, lib_name, compute_F_name, compute_nabla_F_name)
def get_env_as_long(self) -> "PyObject *":
return _pynumerics.VI_get_env_as_long(self)
__swig_destroy__ = _pynumerics.delete_VI
# Register VI in _pynumerics:
_pynumerics.VI_swigregister(VI)
def VI_call_compute_F(problem: "void *", n: "int", z: "double *", F: "double *") -> "void":
return _pynumerics.VI_call_compute_F(problem, n, z, F)
def VI_call_compute_nabla_F(problem: "void *", n: "int", z: "double *", nabla_F: "NumericsMatrix") -> "void":
return _pynumerics.VI_call_compute_nabla_F(problem, n, z, nabla_F)
[docs]def variationalInequality_display(vi: "VI") -> "void":
r"""
display a VariationalInequalityProblem
:type vi: :py:class:`VariationalInequality`
:param vi: the problem to display
"""
return _pynumerics.variationalInequality_display(vi)
[docs]def variationalInequality_printInFile(vi: "VI", file: "FILE *") -> "int":
r"""
print a VariationalInequalityProblem in a file (numerics .dat format)
:type vi: :py:class:`VariationalInequality`
:param vi: the problem to print out
:type file: FILE
:param file: the dest file
:rtype: int
:return: ok if successfull
"""
return _pynumerics.variationalInequality_printInFile(vi, file)
[docs]def variationalInequality_newFromFile(vi: "VI", file: "FILE *") -> "int":
r"""
read a VariationalInequalityProblem in a file (numerics .dat format)
:type vi: :py:class:`VariationalInequality`
:param vi: the problem to read
:type file: FILE
:param file: the target file
:rtype: int
:return: ok if successfull
"""
return _pynumerics.variationalInequality_newFromFile(vi, file)
[docs]def freeVariationalInequalityProblem(vi: "VI") -> "void":
r"""
free a VariationalInequalityProblem
:type vi: :py:class:`VariationalInequality`
:param vi: the problem to free
"""
return _pynumerics.freeVariationalInequalityProblem(vi)
[docs]def variationalInequality_clear(vi: "VI") -> "void":
r"""
Clear VariationalInequality structure: set all pointeurs to NULL, double and int to 0
:type vi: :py:class:`VariationalInequality`
:param vi: the problem to clear
"""
return _pynumerics.variationalInequality_clear(vi)
[docs]def variationalInequality_new(size: "int") -> "VariationalInequality *":
r"""
new VariationalInequality problem
:type size: int
:param size: size of the ambient space for the VI
:rtype: :py:class:`VariationalInequality`
:return: a initialized VariationalInequality struct
"""
return _pynumerics.variationalInequality_new(size)
[docs]def newVI() -> "VariationalInequality *":
r"""
new VariationalInequality problem
:rtype: :py:class:`VariationalInequality`
:return: an empty VI
"""
return _pynumerics.newVI()
[docs]def VI_get_env(vi: "void *") -> "void *":
r"""
get the environment from the struct
:type vi: void
:param vi: a VariationalInequality problem
:rtype: void
:return: the environment from the struct
"""
return _pynumerics.VI_get_env(vi)