Loading...
Searching...
No Matches
Functions
Mathematical Functions
Collaboration diagram for Mathematical Functions:

Functions

template<class T >
sign (const T &val)
 
template<class T >
uipow (const T &base, unsigned int exponent)
 
template<class T , size_t d>
std::array< T, d > min (const std::array< T, d > &x, const std::array< T, d > &y)
 
template<class T , size_t d>
std::array< T, d > min (const std::array< T, d > &x, const T &y)
 
template<class T , size_t d>
std::array< T, d > min (const T &x, const std::array< T, d > &y)
 
template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > min (const std::array< std::array< T, n >, d > &x, const T &y)
 
template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > min (const T &x, const std::array< std::array< T, n >, d > &y)
 
template<class T , size_t d, class T1 >
void minval (const std::array< T, d > &x, T1 &min_value)
 
template<class T , size_t d>
std::array< T, d > max (const std::array< T, d > &x, const std::array< T, d > &y)
 
template<class T , size_t d>
std::array< T, d > max (const std::array< T, d > &x, const T &y)
 
template<class T , size_t d>
std::array< T, d > max (const T &x, const std::array< T, d > &y)
 
template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > max (const std::array< std::array< T, n >, d > &x, const T &y)
 
template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > max (const T &x, const std::array< std::array< T, n >, d > &y)
 
template<class T , size_t d, class T1 >
void maxval (const std::array< T, d > &x, T1 &max_value)
 
template<class T , size_t d, class T1 >
void sum (const std::array< T, d > &x, T1 &s)
 
template<class T , size_t d>
std::array< T, d > abs (const std::array< T, d > &x)
 
template<class T , size_t d>
std::array< T, d > pow (std::array< T, d > &x, double p)
 
template<class T , size_t d>
double norm1 (const std::array< T, d > &x)
 
template<class T , size_t d>
double norm2 (const std::array< T, d > &x)
 
template<class T , size_t d>
double norm (const std::array< T, d > &x, int p)
 
template<class T , size_t d>
double normInf (const std::array< T, d > &x)
 
template<class T , size_t d>
dotProduct (const std::array< T, d > &x, const std::array< T, d > &y)
 
template<class T >
std::array< T, 3 > crossProduct (const std::array< T, 3 > &x, const std::array< T, 3 > &y)
 
template<class T >
crossProduct (const std::array< T, 2 > &x, const std::array< T, 2 > &y)
 
template<class T >
std::vector< T > min (const std::vector< T > &x, const std::vector< T > &y)
 
template<class T >
std::vector< T > min (const std::vector< T > &x, const T &y)
 
template<class T >
std::vector< T > min (const T &x, const std::vector< T > &y)
 
template<class T >
std::vector< std::vector< T > > min (const std::vector< std::vector< T > > &x, const T &y)
 
template<class T >
std::vector< std::vector< T > > min (const T &x, const std::vector< std::vector< T > > &y)
 
template<typename T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void minval (const T &x, T &min_value)
 
template<class T , class T1 >
void minval (const std::vector< T > &x, T1 &min_value)
 
template<class T >
std::vector< T > max (const std::vector< T > &x, const std::vector< T > &y)
 
template<class T >
std::vector< T > max (const std::vector< T > &x, const T &y)
 
template<class T >
std::vector< T > max (const T &x, const std::vector< T > &y)
 
template<class T >
std::vector< std::vector< T > > max (const std::vector< std::vector< T > > &x, const T &y)
 
template<class T >
std::vector< std::vector< T > > max (const T &x, const std::vector< std::vector< T > > &y)
 
template<typename T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void maxval (const T &x, T &max_value)
 
template<class T , class T1 >
void maxval (const std::vector< T > &x, T1 &max_value)
 
template<class T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void sum (const T &x, T &s)
 
template<class T , class T1 >
void sum (const std::vector< T > &x, T1 &s)
 
template<class T >
std::vector< T > abs (const std::vector< T > &x)
 
template<class T >
std::vector< T > pow (std::vector< T > &x, double p)
 
template<class T >
double norm1 (const std::vector< T > &x)
 
template<class T >
double norm2 (const std::vector< T > &x)
 
template<class T >
double norm (const std::vector< T > &x, int p)
 
template<class T >
double normInf (const std::vector< T > &x)
 
template<class T >
dotProduct (const std::vector< T > &x, const std::vector< T > &y)
 
template<class T >
std::vector< T > crossProduct (const std::vector< T > &x, const std::vector< T > &y)
 

Detailed Description

Function Documentation

◆ abs() [1/2]

template<class T , size_t d>
std::array< T, d > abs ( const std::array< T, d > & x)

Given a input array, x, returns a array storing the absolute value of elements in x, i.e.: z[i] = abs(x[i]), for i = 0, ..., d-1 where d is the size of x.

Template parameter can be any type such that abs() function is defined. For instance if T = std::array<T1, e>, the abs() function will call itself to return the absolute value of elements in x[i].

Parameters
[in]xinput array
Returns
array having the same dimensions of x storing the absolute value of the elements in x.
Examples
RBF_example_00001.cpp.

Definition at line 591 of file MathOperators_array.tpp.

◆ abs() [2/2]

template<class T >
std::vector< T > abs ( const std::vector< T > & x)

Given a ipnut vector, x, returns a vector storing the absolute value of elements in x, i.e.: z[i] = abs(x[i]), for i = 0, ..., n-1 where n is the size of x.

Template parameter can be any type such that abs() function is defined. For instance if T = std::vector<T1>, the abs() function will call itself to return the absolute value of elements in x[i].

Parameters
[in]xinput vector
Returns
vector having the same dimensions of x storing the absolute value of the elements in x.

Definition at line 748 of file MathOperators_vector.tpp.

◆ crossProduct() [1/3]

template<class T >
T crossProduct ( const std::array< T, 2 > & x,
const std::array< T, 2 > & y )

Compute the cross product in R2 of input arrays, x and y. Template parameter can be any scalar type

Parameters
[in]x1st argument
[in]y2nd argument
Returns
on output returns the cross product product of x and y.

Definition at line 920 of file MathOperators_array.tpp.

◆ crossProduct() [2/3]

template<class T >
std::array< T, 3 > crossProduct ( const std::array< T, 3 > & x,
const std::array< T, 3 > & y )

Compute the cross product in R3 of input arrays, x and y. Template parameter can be any scalar type

Parameters
[in]x1st argument
[in]y2nd argument
Returns
on output returns the cross product product of x and y.

Definition at line 890 of file MathOperators_array.tpp.

◆ crossProduct() [3/3]

template<class T >
std::vector< T > crossProduct ( const std::vector< T > & x,
const std::vector< T > & y )

Compute the cross product in R3 of input vectors, x and y. Template parameter can be any scalar type

Parameters
[in]x1st argument
[in]y2nd argument
Returns
on output returns the cross product product of x and y.

Definition at line 1053 of file MathOperators_vector.tpp.

◆ dotProduct() [1/2]

template<class T , size_t d>
T dotProduct ( const std::array< T, d > & x,
const std::array< T, d > & y )

Compute the scalar product of 2 input arrays, x and y, i.e.: d = sum(x * y).

Template parameter can be any scalar type

Parameters
[in]x1st argument
[in]y2nd argument
Returns
on output returns the scalar product of x and y.
Examples
POD_example_00005.cpp.

Definition at line 851 of file MathOperators_array.tpp.

◆ dotProduct() [2/2]

template<class T >
T dotProduct ( const std::vector< T > & x,
const std::vector< T > & y )

Compute the scalar product of 2 input vectors, x and y, i.e.: d = sum(x * y).

Template parameter can be any scalar type

Parameters
[in]x1st argument
[in]y2nd argument
Returns
on output returns the scalar product of x and y.

Definition at line 1013 of file MathOperators_vector.tpp.

◆ max() [1/10]

template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > max ( const std::array< std::array< T, n >, d > & x,
const T & y )

Element-wise maximum between 2D array and constant. Given a 2D array x and a constant y, returns z such that: z[i][j] = max(x[i][j], y), for all j = 0, ..., n-1, i = 0, ..., d-1 where d is the size of x.

Template parameters T can be any type such that max is defined. For instance if T = std::array<T1, e>, max function call itself to return the element-wise maximum between x[i][j] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x, storing the element-wise maximum between x and y.

Definition at line 421 of file MathOperators_array.tpp.

◆ max() [2/10]

template<class T , size_t d>
std::array< T, d > max ( const std::array< T, d > & x,
const std::array< T, d > & y )

Element-wise maximum between two arrays. Given two array x and y, returns z such that: z[i] = max(x[i], y[i]), for all i = 0, ..., d-1 where the d is the size of x and y.

Template parameters T can be any type such that max is defined. For instance if T = std::array<T1, e>, max function call itself to return the element-wise maximum between x[i] and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x and y, storing the element-wise maximum between x and y.

Definition at line 306 of file MathOperators_array.tpp.

◆ max() [3/10]

template<class T , size_t d>
std::array< T, d > max ( const std::array< T, d > & x,
const T & y )

Element-wise maximum between array and constant. Given a array x and a constant y, returns z such that: z[i] = max(x[i], y), for all i = 0, ..., d-1 where d is the size of x.

Template parameters T can be any type such that max is defined. For instance if T = std::array<T1, e>, max function call itself to return the element-wise maximum between x[i] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x, storing the element-wise maximum between x and y.

Definition at line 345 of file MathOperators_array.tpp.

◆ max() [4/10]

template<class T >
std::vector< std::vector< T > > max ( const std::vector< std::vector< T > > & x,
const T & y )

Element-wise maximum between 2D vector and constant. Given a 2D vector x and a constant y, returns z such that: z[i][j] = max(x[i][j], y), for all j = 0, ..., x[i].size(), i = 0, ..., n-1 where n = x.size().

Template parameters T can be any type such that max is defined. For instance if T = std::vector<T1>, max function call itself to return the element-wise maximum between x[i][j] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x, storing the element-wise maximum between x and y.

Definition at line 478 of file MathOperators_vector.tpp.

◆ max() [5/10]

template<class T >
std::vector< T > max ( const std::vector< T > & x,
const std::vector< T > & y )

Element-wise maximum between two vectors. Given two vectors x and y, returns z such that: z[i] = max(x[i], y[i]), for all i = 0, ..., n-1 where the n = min(x.size(), y.size()).

Template parameters T can be any type such that max is defined. For instance if T = std::vector<T1>, max function call itself to return the element-wise maximum between x[i] and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x and y, storing the element-wise maximum between x and y.

Definition at line 360 of file MathOperators_vector.tpp.

◆ max() [6/10]

template<class T >
std::vector< T > max ( const std::vector< T > & x,
const T & y )

Element-wise maximum between vector and constant. Given a vector x and a constant y, returns z such that: z[i] = max(x[i], y), for all i = 0, ..., n-1 where n = x.size().

Template parameters T can be any type such that max is defined. For instance if T = std::vector<T1>, max function call itself to return the element-wise maximum between x[i] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x, storing the element-wise maximum between x and y.

Definition at line 401 of file MathOperators_vector.tpp.

◆ max() [7/10]

template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > max ( const T & x,
const std::array< std::array< T, n >, d > & y )

Element-wise maximum between constant and 2D array. Given a constant x and a 2D array y, returns z such that: z[i][j] = max(x, y[i][j]), for all j = 0, ..., n-1, i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that max is defined. For instance if T = std::array<T1, e>, max function call itself to return the element-wise maximum between x and y[i][j].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a array having the same dimensions of y, storing the element-wise maximum between x and y.

Definition at line 460 of file MathOperators_array.tpp.

◆ max() [8/10]

template<class T , size_t d>
std::array< T, d > max ( const T & x,
const std::array< T, d > & y )

Element-wise maximum between constant and array. Given a constant x and a array y, returns z such that: z[i] = max(x, y[i]), for all i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that max is defined. For instance if T = std::array<T1, e>, max function call itself to return the element-wise maximum between x and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of y, storing the element-wise maximum between x and y.

Definition at line 384 of file MathOperators_array.tpp.

◆ max() [9/10]

template<class T >
std::vector< std::vector< T > > max ( const T & x,
const std::vector< std::vector< T > > & y )

Element-wise maximum between constant and 2D vector. Given a constant x and a 2D vector y, returns z such that: z[i][j] = max(x, y[i][j]), for all j = 0, ..., y[i].size(), i = 0, ..., n-1 where n = y.size().

Template parameters T can be any type such that max is defined. For instance if T = std::vector<T1>, max function call itself to return the element-wise maximum between x and y[i][j].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of y, storing the element-wise maximum between x and y.

Definition at line 518 of file MathOperators_vector.tpp.

◆ max() [10/10]

template<class T >
std::vector< T > max ( const T & x,
const std::vector< T > & y )

Element-wise maximum between constant and vector. Given a constant x and a vector y, returns z such that: z[i] = max(x, y[i]), for all i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that max is defined. For instance if T = std::vector<T1>, max function call itself to return the element-wise maximum between x and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of y, storing the element-wise maximum between x and y.

Definition at line 441 of file MathOperators_vector.tpp.

◆ maxval() [1/3]

template<class T , size_t d, class T1 >
void maxval ( const std::array< T, d > & x,
T1 & max_value )

Returns the element with the largest value within a array, i.e. given an input array, x max_value = max(x[i]) over all i = 0, ..., n-1 where n = x.size().

Parameters template can be of any type with the following requirements:

  1. minval must be defined for any type T
  2. type T1 must be a scalar type (for instance, T = std::array<double, e>, T1 = double)
Parameters
[in]xinput array
[in,out]max_valueon output stores the elements with the largest value.

Definition at line 497 of file MathOperators_array.tpp.

◆ maxval() [2/3]

template<class T , class T1 >
void maxval ( const std::vector< T > & x,
T1 & max_value )

Returns the element with the largest value within a vector, i.e. given an input vector, x max_value = max(x[i]) over all i = 0, ..., n-1 where n = x.size().

Parameters template can be of any type with the following requirements:

  1. minval must be defined for any type T
  2. type T1 must be a scalar type (for instance, T = std::vector<double>, T1 = double)
Parameters
[in]xinput vector
[in,out]max_valueon output stores the elements with the largest value.

Definition at line 603 of file MathOperators_vector.tpp.

◆ maxval() [3/3]

template<typename T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void maxval ( const T & x,
T & max_value )
inline

Overloading of maxval() function for scalar types.

Parameters
[in]xinput scalar
[in,out]max_valueon output returns the input value

Definition at line 547 of file MathOperators_vector.tpp.

◆ min() [1/10]

template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > min ( const std::array< std::array< T, n >, d > & x,
const T & y )

Element-wise minimum between 2D array and constant. Given a 2D array x and a constant y, returns z such that: z[i][j] = min(x[i][j], y), for all j = 0, ..., n-1, i = 0, ..., d-1 where d is the size of x.

Template parameters T can be any type such that min is defined. For instance if T = std::array<T1, e>, min function call itself to return the element-wise minimum between x[i][j] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x, storing the element-wise minimum between x and y.

Definition at line 182 of file MathOperators_array.tpp.

◆ min() [2/10]

template<class T , size_t d>
std::array< T, d > min ( const std::array< T, d > & x,
const std::array< T, d > & y )

Element-wise minimum between two arrays. Given two array x and y, returns z such that: z[i] = min(x[i], y[i]), for all i = 0, ..., d-1 where the d is the size of x and y.

Template parameters T can be any type such that min is defined. For instance if T = std::array<T1, e>, min function call itself to return the element-wise minimum between x[i] and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x and y, storing the element-wise minimum between x and y.

Definition at line 67 of file MathOperators_array.tpp.

◆ min() [3/10]

template<class T , size_t d>
std::array< T, d > min ( const std::array< T, d > & x,
const T & y )

Element-wise minimum between array and constant. Given a array x and a constant y, returns z such that: z[i] = min(x[i], y), for all i = 0, ..., d-1 where d is the size of x.

Template parameters T can be any type such that min is defined. For instance if T = std::array<T1, e>, min function call itself to return the element-wise minimum between x[i] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of x, storing the element-wise minimum between x and y.

Definition at line 106 of file MathOperators_array.tpp.

◆ min() [4/10]

template<class T >
std::vector< std::vector< T > > min ( const std::vector< std::vector< T > > & x,
const T & y )

Element-wise minimum between 2D vector and constant. Given a 2D vector x and a constant y, returns z such that: z[i][j] = min(x[i][j], y), for all j = 0, ..., x[i].size(), i = 0, ..., n-1 where n = x.size().

Template parameters T can be any type such that min is defined. For instance if T = std::vector<T1>, min function call itself to return the element-wise minimum between x[i][j] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x, storing the element-wise minimum between x and y.

Definition at line 184 of file MathOperators_vector.tpp.

◆ min() [5/10]

template<class T >
std::vector< T > min ( const std::vector< T > & x,
const std::vector< T > & y )

Element-wise minimum between two vectors. Given two vectors x and y, returns z such that: z[i] = min(x[i], y[i]), for all i = 0, ..., n-1 where the n = min(x.size(), y.size()).

Template parameters T can be any type such that min is defined. For instance if T = std::vector<T1>, min function call itself to return the element-wise minimum between x[i] and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x and y, storing the element-wise minimum between x and y.

Definition at line 66 of file MathOperators_vector.tpp.

◆ min() [6/10]

template<class T >
std::vector< T > min ( const std::vector< T > & x,
const T & y )

Element-wise minimum between vector and constant. Given a vector x and a constant y, returns z such that: z[i] = min(x[i], y), for all i = 0, ..., n-1 where n = x.size().

Template parameters T can be any type such that min is defined. For instance if T = std::vector<T1>, min function call itself to return the element-wise minimum between x[i] and y.

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of x, storing the element-wise minimum between x and y.

Definition at line 107 of file MathOperators_vector.tpp.

◆ min() [7/10]

template<class T , size_t d, size_t n>
std::array< std::array< T, n >, d > min ( const T & x,
const std::array< std::array< T, n >, d > & y )

Element-wise minimum between constant and 2D array. Given a constant x and a 2D array y, returns z such that: z[i][j] = min(x, y[i][j]), for all j = 0, ..., n-1, i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that min is defined. For instance if T = std::array<T1, e>, min function call itself to return the element-wise minimum between x and y[i][j].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a array having the same dimensions of y, storing the element-wise minimum between x and y.

Definition at line 221 of file MathOperators_array.tpp.

◆ min() [8/10]

template<class T , size_t d>
std::array< T, d > min ( const T & x,
const std::array< T, d > & y )

Element-wise minimum between constant and array. Given a constant x and a array y, returns z such that: z[i] = min(x, y[i]), for all i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that min is defined. For instance if T = std::array<T1, e>, min function call itself to return the element-wise minimum between x and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns an array having the same dimensions of y, storing the element-wise minimum between x and y.

Definition at line 145 of file MathOperators_array.tpp.

◆ min() [9/10]

template<class T >
std::vector< std::vector< T > > min ( const T & x,
const std::vector< std::vector< T > > & y )

Element-wise minimum between constant and 2D vector. Given a constant x and a 2D vector y, returns z such that: z[i][j] = min(x, y[i][j]), for all j = 0, ..., y[i].size(), i = 0, ..., n-1 where n = y.size().

Template parameters T can be any type such that min is defined. For instance if T = std::vector<T1>, min function call itself to return the element-wise minimum between x and y[i][j].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of y, storing the element-wise minimum between x and y.

Definition at line 224 of file MathOperators_vector.tpp.

◆ min() [10/10]

template<class T >
std::vector< T > min ( const T & x,
const std::vector< T > & y )

Element-wise minimum between constant and vector. Given a constant x and a vector y, returns z such that: z[i] = min(x, y[i]), for all i = 0, ..., d-1 where d is the size of y.

Template parameters T can be any type such that min is defined. For instance if T = std::vector<T1>, min function call itself to return the element-wise minimum between x and y[i].

Parameters
[in]x1st argument
[in]y2nd argument
Returns
returns a vector having the same dimensions of y, storing the element-wise minimum between x and y.

Definition at line 147 of file MathOperators_vector.tpp.

◆ minval() [1/3]

template<class T , size_t d, class T1 >
void minval ( const std::array< T, d > & x,
T1 & min_value )

Returns the element with the smallest value within a array, i.e. given an input array, x min_value = min(x[i]) over all i = 0, ..., d-1

Parameters template can be of any type with the following requirements:

  1. minval must be defined for any type T
  2. type T1 must be a scalar type (for instance, T = std::array<double, e>, T1 = double)
Parameters
[in]xinput array
[in,out]min_valueon output stores the elements with the smallest value.

Definition at line 256 of file MathOperators_array.tpp.

◆ minval() [2/3]

template<class T , class T1 >
void minval ( const std::vector< T > & x,
T1 & min_value )

Returns the element with the smallest value within a vector, i.e. given an input vector, x min_value = min(x[i]) over all i = 0, ..., n-1 where n = x.size().

Parameters template can be of any type with the following requirements:

  1. minval must be defined for any type T
  2. type T1 must be a scalar type (for instance, T = std::vector<double>, T1 = double)
Parameters
[in]xinput vector
[in,out]min_valueon output stores the elements with the smallest value.

Definition at line 309 of file MathOperators_vector.tpp.

◆ minval() [3/3]

template<typename T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void minval ( const T & x,
T & min_value )
inline

Overloading of minval() function for scalar types.

Parameters
[in]xinput scalar
[in,out]min_valueon output returns the input value

Definition at line 253 of file MathOperators_vector.tpp.

◆ norm() [1/2]

template<class T , size_t d>
double norm ( const std::array< T, d > & x,
int p )

Compute the generic norm of a input array, x, i.e.: n = pow( sum( pow( abs(x), p ) ), 1/p ).

Template parameter can be any scalar type

Parameters
[in]xinput array
[in]pnorm index
Returns
on output returns the p-norm of the input array.

Definition at line 754 of file MathOperators_array.tpp.

◆ norm() [2/2]

template<class T >
double norm ( const std::vector< T > & x,
int p )

Compute the generic norm of a input vector, x, i.e.: n = pow( sum( pow( abs(x), p ) ), 1/p ).

Template parameter can be any scalar type

Parameters
[in]xinput vector
[in]pnorm index
Returns
on output returns the p-norm of the input vector.

Definition at line 916 of file MathOperators_vector.tpp.

◆ norm1() [1/2]

template<class T , size_t d>
double norm1 ( const std::array< T, d > & x)

Compute the 1-norm of a input array, x, i.e.: n = sum(abs(x)).

Template parameter can be any scalar type

Parameters
[in]xinput array
Returns
on output returns the 1-norm of the input array.

Definition at line 675 of file MathOperators_array.tpp.

◆ norm1() [2/2]

template<class T >
double norm1 ( const std::vector< T > & x)

Compute the 1-norm of a input vector, x, i.e.: n = sum(abs(x)).

Template parameter can be any scalar type

Parameters
[in]xinput vector
Returns
on output returns the 1-norm of the input vector.

Definition at line 837 of file MathOperators_vector.tpp.

◆ norm2() [1/2]

template<class T , size_t d>
double norm2 ( const std::array< T, d > & x)

Compute the 2-norm of a input array, x, i.e.: n = sqrt(sum(pow(x, 2))).

Template parameter can be any scalar type

Parameters
[in]xinput array
Returns
on output returns the 2-norm of the input array.

Definition at line 714 of file MathOperators_array.tpp.

◆ norm2() [2/2]

template<class T >
double norm2 ( const std::vector< T > & x)

Compute the 2-norm of a input vector, x, i.e.: n = sqrt(sum(pow(x, 2))).

Template parameter can be any scalar type

Parameters
[in]xinput vector
Returns
on output returns the 2-norm of the input vector.

Definition at line 877 of file MathOperators_vector.tpp.

◆ normInf() [1/2]

template<class T , size_t d>
double normInf ( const std::array< T, d > & x)

Compute the infinity-norm of a input array, x, i.e.: n = maxval(abs(x)).

Template parameter can be any scalar type

Parameters
[in]xinput array
Returns
on output returns the inf-norm of the input array.

Definition at line 805 of file MathOperators_array.tpp.

◆ normInf() [2/2]

template<class T >
double normInf ( const std::vector< T > & x)

Compute the infinity-norm of a input vector, x, i.e.: n = maxval(abs(x)).

Template parameter can be any scalar type

Parameters
[in]xinput vector
Returns
on output returns the inf-norm of the input vector.

Definition at line 966 of file MathOperators_vector.tpp.

◆ pow() [1/2]

template<class T , size_t d>
std::array< T, d > pow ( std::array< T, d > & x,
double p )

Given a input array, x, returns a array storing the p-th power of its elements, i.e.: z[i] = pow(x[i], p), for i = 0, ..., d-1 where d is the size of x.

Template parameter can be any type such that pow function is defined. For instance if T = std::array<T1, e>, the pow() function will call itself to return the p-th power of the elements in x[i].

Parameters
[in]xinput array
[in]ppower index
Returns
array having the same dimensions of x storing the p-th power of the elements in x.
Examples
PABLO_bubbles_2D.cpp, PABLO_bubbles_3D.cpp, PABLO_example_00001.cpp, PABLO_example_00002.cpp, PABLO_example_00003.cpp, PABLO_example_00004.cpp, PABLO_example_00005.cpp, PABLO_example_00006.cpp, PABLO_example_00007.cpp, PABLO_example_00008.cpp, PABLO_example_00009.cpp, and PABLO_example_00010.cpp.

Definition at line 637 of file MathOperators_array.tpp.

◆ pow() [2/2]

template<class T >
std::vector< T > pow ( std::vector< T > & x,
double p )

Given a input vector, x, returns a vector storing the p-th power of its elements, i.e.: z[i] = pow(x[i], p), for i = 0, ..., n-1 where n is the size of x.

Template parameter can be any type such that pow function is defined. For instance if T = std::vector<T1>, the pow() function will call itself to return the p-th power of the elements in x[i].

Parameters
[in]xinput vector
[in]ppower index
Returns
vector having the same dimensions of x storing the p-th power of the elements in x.

Definition at line 796 of file MathOperators_vector.tpp.

◆ sign()

template<class T >
T sign ( const T & val)

Sign function. Given a a variable of integral type, val, returns: 1 if val > 0 -1, othersize.

Template parameters can be any integral type such that operator< is defined.

Returns
returns the sign of the input value.

Definition at line 38 of file Operators.tpp.

◆ sum() [1/3]

template<class T , size_t d, class T1 >
void sum ( const std::array< T, d > & x,
T1 & s )

Given a input array, x, returns the sum of its elements, i.e.: s = sum (x[i]) over all i = 0, ..., n-1 where n = x.size().

Parameters template can be of any type with the following requirements:

  1. operator += must be defined for type T
  2. type T1 must be a scalar type (for instance, T = std::array<double, e>, T1 = double)
Parameters
[in]xinput array
[in,out]ssum of element in x.

Definition at line 544 of file MathOperators_array.tpp.

◆ sum() [2/3]

template<class T , class T1 >
void sum ( const std::vector< T > & x,
T1 & s )

Given a input vector, x, returns the sum of its elements, i.e.: s = sum (x[i]) over all i = 0, ..., n-1 where n = x.size().

Parameters template can be of any type with the following requirements:

  1. operator += must be defined for type T
  2. type T1 must be a scalar type (for instance, T = std::vector<double>, T1 = double)
Parameters
[in]xinput vector
[in,out]ssum of element in x.

Definition at line 700 of file MathOperators_vector.tpp.

◆ sum() [3/3]

template<class T , typename std::enable_if< std::is_scalar< T >::value >::type * >
void sum ( const T & x,
T & s )
inline

Overloading of sum() function for scalar type.

Parameters
[in]xinput scalar
[in,out]son output stores the value of the input scalar

Definition at line 644 of file MathOperators_vector.tpp.

◆ uipow()

template<class T >
T uipow ( const T & base,
unsigned int exponent )

Power function with unsigned integer exponent.

Parameters
[in]baseInput argument
[in]exponentPower index

Template parameter can be any type such that *operator is defined.

Returns
returns the p-th power of the input argument.

Definition at line 55 of file Operators.tpp.

--- layout: doxygen_footer ---