# File kernel/src/utils/SiconosAlgebra/SiconosVectorFriends.hpp¶

Go to the source code of this file

List of friend functions for SiconosVectors.

Functions

void setBlock(const SiconosVector &vIn, SP::SiconosVector vOut, unsigned int sizeB, unsigned int startIn, unsigned int startOut)

Copy a subBlock of size sizeB of vIn (from index startIn) into a subBlock of vOut (from index startOut)

Parameters
• vIn – block to copy

• vOut – vector to change (destination)

• sizeB – number of the elements to copy

• startIn – the beginning of the range of elements to copy from

• startOut – the beginning of the destination range

bool operator==(const SiconosVector&, const SiconosVector&)

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

Parameters
Returns

a boolean

SiconosVector operator*(double, const SiconosVector&)

multiplication of a vector by a scalar

Parameters
• a – double

Returns
SiconosVector operator*(const SiconosVector&, double)

multiplication of a vector by a double

Parameters
• a – double

Returns
SiconosVector operator/(const SiconosVector&, double)

division of the vector by a double

Parameters
• a – double

Returns
SiconosVector operator+(const SiconosVector&, const SiconosVector&)

Addition of two vectors.

Parameters
Returns
void add(const SiconosVector&, const SiconosVector&, SiconosVector&)

computes z = x + y

Parameters
SiconosVector operator-(const SiconosVector&, const SiconosVector&)

Subtraction of two vectors.

Parameters
Returns
void sub(const SiconosVector&, const SiconosVector&, SiconosVector&)

computes z = x - y

Parameters
void axpby(double, const SiconosVector&, double, SiconosVector&)

computes y = a*x + b*y with blas axpy.

Parameters
void axpy(double, const SiconosVector&, SiconosVector&)

computes y = a*x + y with blas axpy.

Parameters
double inner_prod(const SiconosVector&, const SiconosVector&)

compute dot product m1.m2

Parameters

2 – SiconosVectors

Returns

a double

SimpleMatrix outer_prod(const SiconosVector&, const SiconosVector&)

compute the product m1 * trans(m2)

Parameters

2 – SiconosVectors

Returns
void scal(double a, const SiconosVector &x, SiconosVector &y, bool init = true)

multiplication of a vector by a scalar, y = a*x (init = true) or y += a*x (init = false)

Parameters
void subscal(double a, const SiconosVector &x, SiconosVector &y, const Index &coord, bool init = true)

multiplication of a vector by a scalar, sub_y = a*sub_x (init = true) or sub_y += a*sub_x (init = false)

Parameters
• a – a double

• x – a SiconosVector (IN)

• y – a SiconosVector (IN-OUT)

• coord – an Index = [r0x r1x r0y r1y]; subX is the sub-vector of x, for row numbers between r0x and r1x-1. The same for y with riy.

• init – if true sub_y = a*sub_x else sub_y += a*sub_x (default true)

void cross_product(const SiconosVector &V1, const SiconosVector &V2, SiconosVector &VOUT)

cross product

Parameters
• V1 – a SiconosVector of dimention 3.

• V2 – aSiconosVector of dimention 3.

• VOUT – aSiconosVector of dimention 3, the resulting cross product between V1 and V2.

void abs_wise(const SiconosVector &V, SiconosVector &Vabs)

get an absolute vector

Parameters
void getMax(const SiconosVector&, double&, unsigned int&)

get maximal element of a vector

Parameters
• 1, aSiconosVector (Input).

• 2, a – double variable giving the maximum element (Output).

• 3, an – unsigned int variable giving the position of the maximum element (Output)

void getMin(const SiconosVector&, double&, unsigned int&)

get minimum element of a vector

Parameters
• 1, aSiconosVector (Input).

• 2, a – double variable giving the minimum element (Output).

• 3, an – unsigned int variable giving the position of the minimum element (Output)