File kernel/src/utils/SiconosAlgebra/SimpleMatrixFriends.hpp

Go to the source code of this file

List of friend functions for SimpleMatrix.

Functions

void add(const SiconosMatrix &A, const SiconosMatrix &B, SiconosMatrix &C)

Addition of two matrices C = A+B.

Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • C: a SiconosMatrix

void axpy_prod(const SiconosMatrix&, const SiconosMatrix&, SiconosMatrix&, bool)

prod(A, B, C) computes C = A*B in an optimal way (if init = true, else +=).

Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • C: a SiconosMatrix
  • init: a bool (default = true)

void axpy_prod(const SiconosMatrix &A, const SiconosVector &x, SiconosVector &y, bool init)

computes y = A*x (init = true) or y += A*x (init = false)

Parameters

void gemm(double a, const SiconosMatrix &A, const SiconosMatrix &B, double b, SiconosMatrix &C)

gemm(a, A, B, b, C) computes C = a*A*B+ b*C This function wrapped blas gemm through boost bindings.

Reserved to dense matrices and vectors.

Parameters
  • a: a double
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • b: a double
  • C: a SiconosMatrix

void gemmtranspose(double a, const SiconosMatrix &A, const SiconosMatrix &B, double b, SiconosMatrix &C)

gemmtranspose(a, A, B, b, C) computes C = a*transpose(A)*transpose(B) + b*C This function wrapped blas gemm through boost bindings.

Reserved to dense matrices and vectors.

Parameters
  • a: a double
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • b: a double
  • C: a SiconosMatrix

void gemv(double a, const SiconosMatrix &A, const SiconosVector &x, double b, SiconosVector &y)

gemv(a, A, x, b, y) computes y = a*A*x+ b*y This function wrapped blas gemv through boost bindings.

Reserved to dense matrices and vectors.

Parameters

void gemvtranspose(double a, const SiconosMatrix &A, const SiconosVector &x, double b, SiconosVector &y)

gemvtranspose(a, A, x, b, y) computes y = a*transpose(A)*x + b*y This function wrapped blas gemv through boost bindings.

Reserved to dense matrices and vectors.

Parameters

const SimpleMatrix matrix_pow(const SimpleMatrix &A, unsigned int e)

compute the power of the matrix (!)

Return
a SimpleMatrix
Parameters

bool operator!=(const SiconosMatrix &A, const SiconosMatrix &B)

: A!=B when (A-B).normInf()>tolerance

Return
a boolean
Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix

const SimpleMatrix operator*(const SiconosMatrix &A, double a)

multiplication of a matrix by a double

Return
a SimpleMatrix
Parameters
  • A: a SiconosMatrix
  • a: a double

SP::SimpleMatrix operator*(const SP::SimpleMatrix A, const SP::SimpleMatrix B)

multiplication of a SimpleMatrix by a SimpleMatrix

Return
a const SimpleMatrixmultiplication of a SP::SimpleMatrix by a SP::SimpleMatrix
Return
a SP::SimpleMatrix
Parameters
Parameters
  • A: a SP::SiconosMatrix
  • B: a SP::SimpleMatrix

SimpleMatrix operator*(double a, const SiconosMatrix &A)

multiplication of a matrix by a double

Return
a SimpleMatrix
Parameters
  • a: a double
  • A: a SiconosMatrix

const SimpleMatrix operator+(const SiconosMatrix &A, const SiconosMatrix &B)

Addition of two matrices, C = A+B.

Return
a SimpleMatrix C
Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix

SP::SimpleMatrix operator+(const SP::SimpleMatrix A, const SP::SimpleMatrix B)

Addition of two matrices, C = A+B.

Return
a SP::SimpleMatrix
Parameters
  • A: a SP::SiconosMatrix
  • B: a SP::SiconosMatrix

SimpleMatrix operator+(const SimpleMatrix &A, const SimpleMatrix &B)
void operator+=(SP::SiconosMatrix A, SP::SimpleMatrix B)

operator += add B to A

Parameters
  • A: a SP::SiconosMatrix
  • B: a SP::SiconosMatrix

const SimpleMatrix operator-(const SiconosMatrix &A, const SiconosMatrix &B)

Subtraction of two matrices, C = A-B.

Return
a SimpleMatrix
Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix

const SimpleMatrix operator/(const SiconosMatrix &A, double a)

division of the matrix by a double

Return
a SimpleMatrix
Parameters
  • A: a SiconosMatrix
  • a: a double

bool operator==(const SiconosMatrix &A, const SiconosMatrix &B)

: A==B when (A-B).normInf()<tolerance

Return
a boolean
Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix

void private_addprod(const SiconosMatrix&, unsigned int, unsigned int, const SiconosVector&, SiconosVector&)

If x is a block vector, it call the present function for all blocks.

Parameters
  • A: a pointer to SiconosMatrix
  • startRow: an int, sub-block position
  • startCol: an int, sub-block position
  • x: a pointer to a SiconosVector
  • res: a DenseVect

void private_addprod(double, SPC::SiconosMatrix, unsigned int, unsigned int, SPC::SiconosVector, SP::SiconosVector)

If x is a block vector, it call the present function for all blocks.

Parameters
  • a: a double
  • A: a pointer to SiconosMatrix
  • startRow: an int, sub-block position
  • startCol: an int, sub-block position
  • x: a pointer to a SiconosVector
  • res: a DenseVect

void private_addprod(SPC::SiconosVector, SPC::SiconosMatrix, unsigned int, unsigned int, SP::SiconosVector)

If x is a block vector, it call the present function for all blocks.

Parameters
  • x: a pointer to a SiconosVector
  • A: a pointer to SiconosMatrix
  • startRow: an int, sub-block position
  • startCol: an int, sub-block position
  • res: a DenseVect, res.

void private_addprod(const SiconosMatrix&, unsigned int, unsigned int, const BlockVector&, SiconosVector&)
void private_addprod(SPC::BlockVector, SPC::SiconosMatrix, unsigned int, unsigned int, SP::SiconosVector)
void private_prod(const SiconosMatrix &A, unsigned int, const SiconosVector&, SiconosVector&, bool)

If x is a block vector, it call the present function for all blocks.

Parameters
  • A: a pointer to SiconosMatrix
  • startRow: an int, sub-block position
  • x: a pointer to a SiconosVector
  • y: a pointer to a SiconosVector
  • init: a bool

void private_prod(const SiconosMatrix &A, unsigned int, const BlockVector&, SiconosVector&, bool)
void private_prod(SPC::SiconosMatrix, unsigned int, SPC::SiconosVector, SP::BlockVector, bool)
void private_prod(SPC::SiconosMatrix, unsigned int, SPC::BlockVector, SP::BlockVector, bool)
void private_prod(double, SPC::SiconosMatrix, unsigned int, SPC::SiconosVector, SP::SiconosVector, bool)

If x is a block vector, it call the present function for all blocks.

Parameters
  • a: a double
  • A: a pointer to SiconosMatrix
  • start: an int, sub-block position
  • x: a pointer to a SiconosVector
  • y: a pointer to a SiconosVector
  • inita: bool

void private_prod(SPC::SiconosVector, SPC::SiconosMatrix, unsigned int, SP::SiconosVector, bool)

If x is a block vector, it call the present function for all blocks.

Parameters
  • x: a pointer to a SiconosVector
  • A: a pointer to SiconosMatrix
  • start: an int, sub-block position
  • y: a pointer to a SiconosVector
  • init: a bool

void private_prod(SPC::BlockVector, SPC::SiconosMatrix, unsigned int, SP::SiconosVector, bool)
void private_prod(SPC::BlockVector, SPC::SiconosMatrix, unsigned int, SP::BlockVector, bool)
void private_prod(SPC::SiconosVector, SPC::SiconosMatrix, unsigned int, SP::BlockVector, bool)
const SimpleMatrix prod(const SiconosMatrix &A, const SiconosMatrix &B)

product of two matrices, C = A*B

Return
C a SimpleMatrix
Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix

void prod(const SiconosMatrix &A, const SiconosMatrix &B, SiconosMatrix &C, bool init = true)

prod(A, B, C) computes C = A*B in an optimal way, or C += AB if init = false.

Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • C: a SiconosMatrix
  • init: a bool (default = true)

const SiconosVector prod(const SiconosMatrix &A, const SiconosVector &x)

prod(A, x) returns the product Ax

Return
a SiconosVector
Parameters

void prod(const SiconosMatrix &A, const SiconosVector &x, SiconosVector &y, bool init = true)

prod(A, x, y, init) computes y = A*x or y += A*x if init = false

Parameters

void prod(const SiconosMatrix &A, const BlockVector &x, SiconosVector &y, bool init = true)

prod(A, x, y, init) computes y = A*x or y += A*x if init = false

Parameters

void prod(const SiconosMatrix &A, const SiconosVector &x, BlockVector &y, bool init = true)

prod(A, x, y, init) computes y = A*x or y += A*x if init = false

Parameters

void prod(double a, const SiconosMatrix &A, const SiconosVector &x, SiconosVector &y, bool init = true)

prod(a, A, x, y, init) computes y = a*A*x or y += a*A*x if init = false

Parameters

void prod(const SiconosVector &x, const SiconosMatrix &A, SiconosVector &y, bool init = true)

prod(x, A, y) computes y = trans(A)*x (init = true) or y += trans(A)*x (init = false)

Parameters

void prod(const SiconosVector &x, const SiconosMatrix &A, BlockVector &y, bool init = true)
void scal(double a, const SiconosMatrix &A, SiconosMatrix &B, bool = true)

multiplication of a matrix by a scalar, B = a*A (init = true) or B += a*A (init = false)

Parameters
  • a: a double
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • init: a bool

void setBlock(SPC::SiconosMatrix MIn, SP::SiconosMatrix MOut, const Index &dim, const Index &start)

Copy a subBlock of MIn into a sub-block of MOut - Dim and positions of the sub-block are given in dim and start.

Parameters
  • MIn: a SPC::SiconosMatrix
  • MOut: a SP::SiconosMatrix
  • dim: an Index, dim[0], dim[1]: number of rows and columns of the sub-block
  • start: an Index, start[0], start[1]: position (row, column) of the first element of the sub-block in MIn start[2], start[3]: position (row, column) of the first element of the sub-block in MOut.

void sub(const SiconosMatrix &A, const SiconosMatrix &B, SiconosMatrix &C)

Subtraction of two matrices C = A-B.

Parameters
  • A: a SiconosMatrix
  • B: a SiconosMatrix
  • C: a SiconosMatrix

void subprod(const SiconosMatrix &A, const BlockVector &x, SiconosVector &y, const Index &coord, bool init = true)

subprod(A, x, y) computes sub_y = sub_A*sub_x or sub_y += sub_A*sub_x if init = false

Parameters
  • A: a SiconosMatrix
  • x: a BlockVector
  • y: a SiconosVector
  • coord: an Index = [r0A r1A c0A c1A r0x r1x r0y r1y]; subA is the sub-matrix of A, for row numbers between r0A and r1A-1 and columns between c0A and c1A-1; The same for x and y with rix and riy.
  • init: a bool (default = true)

void subprod(const SiconosMatrix &A, const SiconosVector &x, SiconosVector &y, const Index &coord, bool init = true)

subprod(A, x, y) computes sub_y = sub_A*sub_x or sub_y += sub_A*sub_x if init = false

Parameters
  • A: a SiconosMatrix
  • x: a SiconosVector
  • y: a SiconosVector
  • coord: an Index = [r0A r1A c0A c1A r0x r1x r0y r1y]; subA is the sub-matrix of A, for row numbers between r0A and r1A-1 and columns between c0A and c1A-1; The same for x and y with rix and riy.
  • init: a bool (default = true)