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

Go to the source code of this file

List of friend functions for SiconosVectors.

Functions

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

get an absolute vector

Parameters

void add(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
• aa: double.

• xa: SiconosVector , IN.

• ba: double.

• ya: SiconosVector , IN-OUT.

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

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

Parameters

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 getMax(const SiconosVector&, double&, unsigned int&)

get maximal element of a vector

Parameters
• 1a: SiconosVector (Input).

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

• 3an: 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
• 1a: SiconosVector (Input).

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

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

double inner_prod(const SiconosVector&, const SiconosVector&)

compute dot product m1.m2

Return

a double

Parameters
• 2: SiconosVectors

SiconosVector operator*(double, const SiconosVector&)

multiplication of a vector by a scalar

Return
Parameters

SiconosVector operator*(const SiconosVector&, double)

multiplication of a vector by a double

Return
Parameters

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

Return
Parameters

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

Subtraction of two vectors.

Return
Parameters

SiconosVector operator/(const SiconosVector&, double)

division of the vector by a double

Return
Parameters
Exceptions
• SiconosVectorExceptionif: the double d = 0

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

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

Return

a boolean

Parameters

SimpleMatrix outer_prod(const SiconosVector&, const SiconosVector&)

compute the product m1 * trans(m2)

Return
Parameters
• 2: SiconosVectors

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
• a: a double

• [in] x: a SiconosVector

• [inout] y: a SiconosVector

• init: if true y = a*x else y += a*x (default = true)

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)

Copy a part of a vector into a sublock of another vector.

Parameters
• vIn: block to copy

• vOut: vector to change (destination)

• sizeB: size of the block to copy

• startIn: starting position for the block (vIn)

• startOut: starting position for the destination (vOut)

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

computes z = x - y

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)