File numerics/src/tools/NumericsVector.h

Go to the source code of this file

Structure definition and functions related to vector storage in Numerics.

Functions

double *NV_abs(const double *const vec, const unsigned int vecSize)

Compute abs vector.

Return

elemet by element abs vector

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

void NV_add(const double *const vec1, const double *const vec2, const unsigned int vecSize, double *out)

Compute element by element by element sum.

Parameters
  • vec1: is the vector

  • vec2: is the vector

  • vecSize: the size of the vector vec

  • out: is the sum vector

void NV_const_add(const double *const vec, const unsigned int vecSize, const double alpha, const double beta, double *out)

Compute y = alpha * x + beta.

Parameters
  • x: is the vector

  • vecSize: the size of the vector vec

  • alpha: is a scalar

  • beta: is a scalar

  • out: is y = alpha * x + beta

void NV_copy(const double *const vec, unsigned int vecSize, double *out)
void NV_display(const double *const m, int n)

Screen display of the vector content stored as a double * array.

Parameters
  • m: the vector to be displayed

  • n: the size of the vector

double *NV_div(const double *const x, const double *const y, const unsigned int vecSize)

Element by element division of two vectors.

Return

product vector

Parameters
  • x: is the vector

  • y: is the vector

  • vecSize: the size of the vector vec

void NV_dott(const double *const vec1, const double *const vec2, const unsigned int vecSize, NumericsMatrix *out)

Compute scalar product x x^T which is a matrix of rank 1.

Parameters
  • vec1: is the vector

  • vec2: is the vector

  • vecSize: is the size of the vector vec

  • out: is the resut matrix of rank 1.

bool NV_equal(double *x, double *y, int nRow, double tol)

Test if two vectors are equal up to a given tolerance.

Return

1 is equal

Parameters
  • x: the vector to be tested

  • y: the vector to be tested

  • n: the size of the vector

  • tol: the tolerance

void NV_insert(double *x, const unsigned int xSize, const double *const y, const unsigned int ySize, unsigned int i)

Insert the vector y into the vector x starting from position i.

Parameters
  • x: the vector

  • size_x: the size of the vector x

  • y: the vector to be inserted

  • size_y: the size of the vector y

  • i: the position of insertion

int NV_isnan(const double *const vec, const unsigned int vecSize)
double NV_max(const double *const vec, const unsigned int vecSize)

Find a maximum value of vertor.

Return

a minimum value of vertor

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

double NV_min(const double *const vec, const unsigned int vecSize)

Find a minimum value of vertor.

Return

a minimum value of vertor

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

double NV_norm_2(const double *const vec, const unsigned int vecSize)

Find a L-2 norm of vertor ( sqrt(sum(vec^2)) )

Return

a minimum value of vertor

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

double NV_norm_inf(const double *const vec, const unsigned int vecSize)

Find a L-inf norm of vertor ( max(abs(vec)) )

Return

a minimum value of vertor

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

void NV_power2(const double *const vec, const unsigned int vecSize, double *out)

Put all elements of vector to the suqre (element by element)

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

  • out: is the result power2 vector

void NV_prod(const double *const vec1, const double *const vec2, const unsigned int vecSize, double *out)

Element by element product of two vectors.

Parameters
  • vec1: is the vector

  • vec2: is the vector

  • vecSize: the size of the vector vec

  • out: is the result product vector

double NV_reduce(const double *const vec, const unsigned int vecSize)

Sum all the elements in vector.

Return

sum of all the elements in vector

Parameters
  • vec: is the vector

  • vecSize: the size of the vector vec

void NV_sqrt(const double *const vec, const unsigned int vecSize, double *out)

Compute element by element square root.

Parameters
  • vec: is the vector

  • vecSize: is the size of the vector vec

  • out: is the sqrt vector

void NV_sub(const double *const vec1, const double *const vec2, const unsigned int vecSize, double *out)

Compute element by element by element subtraction.

Return

subtract vector

Parameters
  • vec1: is the vector

  • vec2: is the vector

  • vecSize: the size of the vector vec

void NV_write_in_file_python(double *m, int nRow, FILE *file)