AutoPas  3.0.0
Loading...
Searching...
No Matches
Functions
autopas::utils::ArrayMath Namespace Reference

Namespace to handle mathematical operations of std::array. More...

Functions

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > add (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Adds two arrays, returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > sub (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Subtracts array b from array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > min (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Takes elementwise minimum, returns the result.
 
template<class T , std::size_t SIZE>
constexpr bool less (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 True iff for all d the following holds: a[d] < b[d].
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > max (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Takes elementwise maximum and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > mul (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Multiplies two array's element wise and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > div (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Divides two array's element-wise and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > addScalar (const std::array< T, SIZE > &a, T s)
 Adds a scalar s to each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > subScalar (const std::array< T, SIZE > &a, T s)
 Subtracts a scalar s from each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > mulScalar (const std::array< T, SIZE > &a, T s)
 Multiplies a scalar s to each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > divScalar (const std::array< T, SIZE > &a, T s)
 Divides an array element-wise by a given scalar and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > divScalar (T s, const std::array< T, SIZE > &a)
 Divides a scalar with by every element of an array to create an array of fractions.
 
template<class T , std::size_t SIZE>
constexpr T dot (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Generates the dot product of two arrays.
 
template<class T >
constexpr std::array< T, 3 > cross (const std::array< T, 3 > &a, const std::array< T, 3 > &b)
 Generates the cross product of two arrays of 3 floats.
 
template<class T , std::size_t SIZE>
constexpr T L2Norm (const std::array< T, SIZE > &a)
 Computes the L2Norm / Euclidean norm.
 
template<class T >
constexpr T::value_type prod (const T &a)
 Computes the product of all elements in a.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > abs (const std::array< T, SIZE > &a)
 Computes the absolute value for all elements in a.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > normalize (const std::array< T, SIZE > &a)
 Generates a normalized array (|a| = 1).
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > ceil (const std::array< T, SIZE > &a)
 For each element in a, computes the smallest integer value not less than the element.
 
template<class T , std::size_t SIZE>
constexpr std::array< int, SIZE > floorToInt (const std::array< T, SIZE > &a)
 Floors all array elements and converts them to integers.
 
template<class T , std::size_t SIZE>
constexpr std::array< int, SIZE > ceilToInt (const std::array< T, SIZE > &a)
 Ceils all array elements and converts them to integers.
 
template<class T , std::size_t SIZE>
bool isNearRel (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b, double maxRelativeDifference=1e-9)
 Returns true if arrays are elementwise relatively near each other.
 
template<class T , std::size_t SIZE>
bool isNearRel (const std::vector< std::array< T, SIZE > > &a, const std::vector< std::array< T, SIZE > > &b, double maxRelativeDifference=1e-9)
 Returns true if vectors of arrays are elementwise relatively near each other.
 
template<class T >
bool isEqual (const std::vector< T > &a, const std::vector< T > &b)
 Returns true if vectors are elementwise equal to each other.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator+ (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Adds two arrays, returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator+= (std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Assignment operator to add two arrays.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator- (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Subtracts array b from array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator-= (std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Assignment operator to subtract two arrays.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator* (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Multiplies two array's element wise and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator*= (std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Assignment operator to multiply two arrays.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator/ (const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Divides two array's element-wise and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator/ (const std::array< T, SIZE > &a, T b)
 Divides an array element-wise by a given scalar and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator/ (T a, const std::array< T, SIZE > &b)
 Divides a scalar by every element of an array to create an array of fractions.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator/= (std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
 Assignment operator to divide two arrays.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator+ (const std::array< T, SIZE > &a, T s)
 Adds a scalar s to each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator+= (std::array< T, SIZE > &a, T s)
 Assignment operator to add a scalar s to each element of array.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator- (const std::array< T, SIZE > &a, T s)
 Subtracts a scalar s from each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator-= (std::array< T, SIZE > &a, T s)
 Assignment operator to subtract a scalar s to each element of array.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > operator* (const std::array< T, SIZE > &a, T s)
 Multiplies a scalar s to each element of array a and returns the result.
 
template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & operator*= (std::array< T, SIZE > &a, T s)
 Assignment operator to multiply a scalar s to each element of array.
 
template<class T , std::size_t SIZE>
double boxDistanceSquared (const std::array< T, SIZE > &aMin, const std::array< T, SIZE > &aMax, const std::array< T, SIZE > &bMin, const std::array< T, SIZE > &bMax)
 Calculate the squared minimum distance between two boxes, which are aligned to the Cartesian grid.
 

Detailed Description

Namespace to handle mathematical operations of std::array.

Function Documentation

◆ abs()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::abs ( const std::array< T, SIZE > &  a)
constexpr

Computes the absolute value for all elements in a.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
absolute values of a

◆ add()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::add ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Adds two arrays, returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst summand
bsecond summand
Returns
a + b

◆ addScalar()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::addScalar ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Adds a scalar s to each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be added to each element of a
Returns
array who's elements are a[i]+s

◆ boxDistanceSquared()

template<class T , std::size_t SIZE>
double autopas::utils::ArrayMath::boxDistanceSquared ( const std::array< T, SIZE > &  aMin,
const std::array< T, SIZE > &  aMax,
const std::array< T, SIZE > &  bMin,
const std::array< T, SIZE > &  bMax 
)

Calculate the squared minimum distance between two boxes, which are aligned to the Cartesian grid.

The boxes are given by their lower and upper corners.

Parameters
aMin
aMax
bMin
bMax
Returns
squared minimum distance

◆ ceil()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::ceil ( const std::array< T, SIZE > &  a)
constexpr

For each element in a, computes the smallest integer value not less than the element.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
rounded up values of a

◆ ceilToInt()

template<class T , std::size_t SIZE>
constexpr std::array< int, SIZE > autopas::utils::ArrayMath::ceilToInt ( const std::array< T, SIZE > &  a)
constexpr

Ceils all array elements and converts them to integers.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
New array with ceiled elements of new type int.

◆ cross()

template<class T >
constexpr std::array< T, 3 > autopas::utils::ArrayMath::cross ( const std::array< T, 3 > &  a,
const std::array< T, 3 > &  b 
)
constexpr

Generates the cross product of two arrays of 3 floats.

Template Parameters
Tfloating point type
Parameters
a3D vector (denoted by array of 3 floats)
b3D vector (denoted by array of 3 floats)
Returns
cross product a x b

◆ div()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::div ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Divides two array's element-wise and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
bdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a[i]/b[i]

◆ divScalar() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::divScalar ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Divides an array element-wise by a given scalar and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
sdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a[i]/s

◆ divScalar() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::divScalar ( s,
const std::array< T, SIZE > &  a 
)
constexpr

Divides a scalar with by every element of an array to create an array of fractions.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
sdivisor.
Returns
element-wise quotient of s and a, i.e., result[i] = s/a[i]

◆ dot()

template<class T , std::size_t SIZE>
constexpr T autopas::utils::ArrayMath::dot ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Generates the dot product of two arrays.

Returns the sum of a[i]*b[i] summed over all i, where i is in [0, SIZE)

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst array
bsecond array
Returns
dot product of a and b

◆ floorToInt()

template<class T , std::size_t SIZE>
constexpr std::array< int, SIZE > autopas::utils::ArrayMath::floorToInt ( const std::array< T, SIZE > &  a)
constexpr

Floors all array elements and converts them to integers.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
New array with floored elements of new type int.

◆ isEqual()

template<class T >
bool autopas::utils::ArrayMath::isEqual ( const std::vector< T > &  a,
const std::vector< T > &  b 
)

Returns true if vectors are elementwise equal to each other.

Also returns false if vectors are of different sizes. Should only be used with an integer type.

Template Parameters
Tinteger type
Parameters
ainput vector
binput vector
Returns

◆ isNearRel() [1/2]

template<class T , std::size_t SIZE>
bool autopas::utils::ArrayMath::isNearRel ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b,
double  maxRelativeDifference = 1e-9 
)

Returns true if arrays are elementwise relatively near each other.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
binput array
maxRelativeDifference
Returns

◆ isNearRel() [2/2]

template<class T , std::size_t SIZE>
bool autopas::utils::ArrayMath::isNearRel ( const std::vector< std::array< T, SIZE > > &  a,
const std::vector< std::array< T, SIZE > > &  b,
double  maxRelativeDifference = 1e-9 
)

Returns true if vectors of arrays are elementwise relatively near each other.

Also returns false if vectors are of different sizes.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput vector of arrays
binput vector of arrays
maxRelativeDifference
Returns

◆ L2Norm()

template<class T , std::size_t SIZE>
constexpr T autopas::utils::ArrayMath::L2Norm ( const std::array< T, SIZE > &  a)
constexpr

Computes the L2Norm / Euclidean norm.

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
L2Norm

◆ less()

template<class T , std::size_t SIZE>
constexpr bool autopas::utils::ArrayMath::less ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

True iff for all d the following holds: a[d] < b[d].

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst parameter
bsecond parameter
Returns
a < b

◆ max()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::max ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Takes elementwise maximum and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
max(a, b)

◆ min()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::min ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Takes elementwise minimum, returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst parameter
bsecond parameter
Returns
min(a, b)

◆ mul()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::mul ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Multiplies two array's element wise and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
element-wise multiplication of a and b

◆ mulScalar()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::mulScalar ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Multiplies a scalar s to each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be multiplied to each element of a
Returns
array who's elements are a[i]*s

◆ normalize()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::normalize ( const std::array< T, SIZE > &  a)
constexpr

Generates a normalized array (|a| = 1).

Template Parameters
Tfloating point type
SIZEsize of the array
Parameters
ainput array
Returns
normalized array of a

◆ operator*() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator* ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Multiplies two array's element wise and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
element-wise multiplication of a and b

◆ operator*() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator* ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Multiplies a scalar s to each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be multiplied to each element of a
Returns
array who's elements are a[i]*s

◆ operator*=() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator*= ( std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Assignment operator to multiply two arrays.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
element-wise multiplication of a and b

◆ operator*=() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator*= ( std::array< T, SIZE > &  a,
s 
)
constexpr

Assignment operator to multiply a scalar s to each element of array.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be multiplied to each element of a
Returns
array who's elements are a[i]*s

◆ operator+() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator+ ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Adds two arrays, returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst summand
bsecond summand
Returns
a + b

◆ operator+() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator+ ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Adds a scalar s to each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be added to each element of a
Returns
array who's elements are a[i]+s

◆ operator+=() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator+= ( std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Assignment operator to add two arrays.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
afirst summand
bsecond summand
Returns
a + b

◆ operator+=() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator+= ( std::array< T, SIZE > &  a,
s 
)
constexpr

Assignment operator to add a scalar s to each element of array.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be added to each element of a
Returns
array who's elements are a[i]+s

◆ operator-() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator- ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Subtracts array b from array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
a - b

◆ operator-() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator- ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Subtracts a scalar s from each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be subtracted from each element of a
Returns
array who's elements are a[i]-s

◆ operator-=() [1/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator-= ( std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Assignment operator to subtract two arrays.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
a - b

◆ operator-=() [2/2]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator-= ( std::array< T, SIZE > &  a,
s 
)
constexpr

Assignment operator to subtract a scalar s to each element of array.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be subtracted from each element of a
Returns
array who's elements are a[i]-s

◆ operator/() [1/3]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator/ ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Divides two array's element-wise and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
bdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a[i]/b[i]

◆ operator/() [2/3]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator/ ( const std::array< T, SIZE > &  a,
b 
)
constexpr

Divides an array element-wise by a given scalar and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
bdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a[i]/b

◆ operator/() [3/3]

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::literals::operator/ ( a,
const std::array< T, SIZE > &  b 
)
constexpr

Divides a scalar by every element of an array to create an array of fractions.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
bdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a/b[i]

◆ operator/=()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > & autopas::utils::ArrayMath::literals::operator/= ( std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Assignment operator to divide two arrays.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
adividend.
bdivisor.
Returns
element-wise quotient of a and b, i.e., result[i] = a[i]/b[i]

◆ prod()

template<class T >
constexpr T::value_type autopas::utils::ArrayMath::prod ( const T &  a)
constexpr

Computes the product of all elements in a.

Template Parameters
Tinput array type, which fulfills the C++ container requirement
Parameters
ainput array
Returns
product

◆ sub()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::sub ( const std::array< T, SIZE > &  a,
const std::array< T, SIZE > &  b 
)
constexpr

Subtracts array b from array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the arrays
Parameters
a
b
Returns
a - b

◆ subScalar()

template<class T , std::size_t SIZE>
constexpr std::array< T, SIZE > autopas::utils::ArrayMath::subScalar ( const std::array< T, SIZE > &  a,
s 
)
constexpr

Subtracts a scalar s from each element of array a and returns the result.

Template Parameters
Tfloating point type
SIZEsize of the array a
Parameters
athe array
sthe scalar to be subtracted from each element of a
Returns
array who's elements are a[i]-s