# Class FirstOrderLinearDS¶

class FirstOrderLinearDS : public FirstOrderNonLinearDS

First Order Linear Systems - $$M(t) \dot x = A(t)x(t)+ b(t) + r, \quad x(t_0)=x_0$$.

This class represents first order linear systems of the form:

$M(t) \dot x = A(t)x(t)+ b(t) + r, x(t_0)=x_0$

where

• $$x \in R^{n}$$ is the state,

• $$r \in R^{n}$$ the input due to the Non Smooth Interaction.

• $$M \in R^{n\times n}$$ is an invertible matrix

• $$A \in R^{n\times n}$$

• $$b \in R^{n}$$

The following operators can be plugged, in the usual way (see User Guide)

• $$A(t)$$

• $$b(t)$$

• $$M(t)$$

Subclassed by FirstOrderLinearTIDS

Right-hand side computation

virtual void initRhs(double time)

Initialization function for the rhs and its jacobian.

Parameters
• time: time of initialization.

virtual void computeRhs(double time)

update right-hand side for the current state

Parameters
• time: of interest

void computeJacobianRhsx(double time)

update $$\nabla_x rhs$$ for the current state

Parameters
• time: of interest

Attributes access

SP::SiconosMatrix A() const

get the matrix $$A$$

Return

pointer (SP) on a matrix

virtual SP::SiconosMatrix jacobianfx() const

get jacobian of f(x,t,z) with respect to x (pointer link)

Return

SP::SiconosMatrix

void setAPtr(SP::SiconosMatrix newA)

set A to pointer newPtr

Parameters
• newA: the new A matrix

void setA(const SiconosMatrix &newA)

set A to a new matrix

Parameters
• newA: the new A matrix

SP::SiconosVector b() const

Return

a SP::SiconosVector

void setbPtr(SP::SiconosVector b)

Parameters

void setb(const SiconosVector &b)

set b vector (copy)

Parameters

Plugins management

virtual void updatePlugins(double time)

Call all plugged-function to initialize plugged-object values.

Parameters
• time: value

void setComputeAFunction(const std::string &pluginPath, const std::string &functionName)

set a specified function to compute the matrix A => same action as setComputeJacobianfxFunction

Parameters
• pluginPath: the complete path to the plugin

• functionName: the function name to use in this plugin

Exceptions
• SiconosSharedLibraryException:

void setComputeAFunction(LDSPtrFunction fct)

set a specified function to compute the matrix A

Parameters
• fct: a pointer on a function

void setComputebFunction(const std::string &pluginPath, const std::string &functionName)

set a specified function to compute the vector b

Parameters
• pluginPath: the complete path to the plugin file

• functionName: the function name to use in this plugin

Exceptions
• SiconosSharedLibraryException:

void setComputebFunction(LDSPtrFunction fct)

set a specified function to compute the vector b

Parameters
• fct: a pointer on a function

virtual void computeA(double time)

default function to compute matrix A => same action as computeJacobianfx

Parameters
• time: time instant used to compute A

virtual void computeb(double time)

default function to compute vector b

Parameters
• time: time instant used to compute b

SP::PluggedObject getPluginA() const

Get _pluginA.

Return

the plugin for A

SP::PluggedObject getPluginB() const

Get _pluginb.

Return

the plugin for b

void setPluginA(SP::PluggedObject newPluginA)

Set _pluginA.

Parameters
• newPluginA: the new plugin

void setPluginB(SP::PluggedObject newPluginB)

Set _pluginb.

Parameters
• newPluginB: the new plugin

Miscellaneous public methods

void display(bool brief = true) const

data display on screen

virtual bool isLinear()

True if the system is linear.

Return

a boolean

Public Types

typedef void (*LDSPtrFunction)(double, unsigned int, double *, unsigned int, double *)

plugin signature

Public Functions

FirstOrderLinearDS(SP::SiconosVector newX0, const std::string &APlugin, const std::string &bPlugin)

constructor from initial state and plugins

Parameters
• newX0: the initial state of this DynamicalSystem

• APlugin: plugin for A

• bPlugin: plugin for b

FirstOrderLinearDS(SP::SiconosVector newX0, SP::SiconosMatrix newA)

constructor from initial state and plugin for A

Parameters
• newX0: the initial state of this DynamicalSystem

• newA: matrix A

FirstOrderLinearDS(SP::SiconosVector newX0)

constructor from initial state

Parameters

FirstOrderLinearDS(SP::SiconosVector newX0, SP::SiconosMatrix newA, SP::SiconosVector newB)

constructor from a initial state and constant matrices

Parameters
• newX0: the initial state of this DynamicalSystem

• newA: matrix A

• newB: b

FirstOrderLinearDS(const FirstOrderLinearDS &FOLDS)

Copy constructor.

Parameters

virtual ~FirstOrderLinearDS()

destructor