C++ mpi module for stochmagnet_main Package
Public Member Functions | Protected Member Functions | List of all members
CORE_Array< T, I > Class Template Reference

this class describes an array of values T of dynamical size with algebrical operators and I is an implemented class which implements the following polymorphic methods: More...

#include <CORE_Array.h>

Inheritance diagram for CORE_Array< T, I >:
Inheritance graph
[legend]
Collaboration diagram for CORE_Array< T, I >:
Collaboration graph
[legend]

Public Member Functions

virtual tMemSize getMemorySize () const override
 return the memory size of the class and the memory size of all its attributes/associations More...
 
template<int N>
auto sbegin ()
 return begin stride iterator for writing More...
 
template<int N>
auto send ()
 return end N-stride iterator for writing More...
 
template<int N>
constexpr auto csbegin () const
 return begin N-stride const iterator for writing More...
 
template<int N>
constexpr auto csend () const
 return end N-stride const iterator for writing More...
 
const T & get (const tIndex &i) const
 get the i-th element for reading More...
 
T & get (const tIndex &i)
 get the i-th element for writting More...
 
const T * getValues () const
 get the values of the array for reading More...
 
T * getValues ()
 get the values of the array More...
 
Selfoperator= (const T &v)
 fill the values of the array with v More...
 
Selfoperator= (std::initializer_list< T > values)
 build an array by a copy of c More...
 
template<size_t N, typename Q >
Selfoperator= (const std::array< Q, N > &values)
 build an array by a copy of c More...
 
template<typename Q >
Selfoperator= (const std::valarray< Q > &values)
 build an array by a copy of c More...
 
template<typename Q >
Selfoperator= (const std::vector< Q > &values)
 build an array by a copy of c More...
 
template<typename Q , class I1 >
Selfoperator= (const CORE_Array< Q, I1 > &cpy)
 build an array by a copy of cpy More...
 
Selfoperator= (const Self &cpy)
 build an array by a copy of cpy More...
 
template<typename Q , class I1 >
Selfoperator= (CORE_Array< Q, I1 > &&cpy)
 build an array by a copy of cpy More...
 
Selfoperator= (Self &&cpy)
 build an array by a copy of cpy More...
 
template<typename Q >
void copy (const tIndex &n, const Q *vs)
 initialize the array to the values of pointer of size n More...
 
template<typename Q , size_t N>
void copy (const tIndex &n, const std::array< Q, N > &vs)
 initialize the array to the values of array of size N More...
 
template<typename Q >
void copy (const tIndex &n, const std::valarray< Q > &vs)
 initialize the array to the values of val array More...
 
template<typename Q >
void copy (const tIndex &n, const std::vector< Q > &vs)
 initialize the array to the values of vector More...
 
void copy (const tIndex &n, const std::initializer_list< T > &vs)
 initialize the array to the values of list More...
 
void copy (const tIndex &n, std::initializer_list< T > &&vs)
 initialize the array to the values of list More...
 
template<typename Q , class I1 >
void copy (const CORE_Array< Q, I1 > &cpy)
 copy the container More...
 
template<typename Q , class I1 >
void copy (CORE_Array< Q, I1 > &&cpy)
 copy the conatiner : mv is destroyed after this More...
 
void initialize (const T &v)
 randomize the field
 
virtual void setUniformRandomizeSeed (const tULLInt &seed)
 set the uniform randomize seed More...
 
void setUniformRandomizeSeed ()
 set the uniform randomize seed
 
void uniformRandomize ()
 randomize the field
 
void uniformRandomize (const T &min, const T &max)
 randomize the field
 
I & operator+= (const T &v)
 add operator More...
 
I & operator-= (const T &v)
 sub operator More...
 
I & operator*= (const T &v)
 multiplicator operator More...
 
I & operator/= (const T &v)
 divisor operator More...
 
I & operator%= (const T &v) requires functions_type
 modulo operator More...
 
template<typename Q , class I1 >
I & operator-= (const CORE_Array< Q, I1 > &v)
 array sub operator More...
 
template<typename Q , class I1 >
I & operator*= (const CORE_Array< Q, I1 > &v)
 array multiply operator More...
 
template<typename Q , class I1 >
I & operator/= (const CORE_Array< Q, I1 > &v)
 array divisor operator More...
 
template<typename LambdaFct >
void transform (LambdaFct &&F)
 transform the transform element with the lambda function Ti = F(Ti) More...
 
template<typename LambdaFct >
void transform (LambdaFct &&F, const Self &X)
 transform the transform element with the lambda function Ti = F(Xi) More...
 
template<typename LambdaFct >
void transform (LambdaFct &&F, const Self &X, const Self &Y)
 transform the transform element with the lambda function Ti = F(Xi,Yi) More...
 
void swap (Self &a)
 swap the contents of the array More...
 
void swap (const tIndex &i, const tIndex &j)
 swap the two elements of the array More...
 
void normalize ()
 normalize the array
 
template<typename Q , class I1 >
void axpy (const Q &alpha, const CORE_Array< Q, I1 > &X, const T &beta)
 compute This=beta.This+ alpha .X More...
 
tBoolean isNANContained () const
 return true if one value is Not A Number More...
 
void sum (T &s) const
 Computes the sum of all the elements. More...
 
void prod (T &p) const
 return the produc of all the elements More...
 
template<typename Q , class I1 >
T & scalarProduct (const CORE_Array< Q, I1 > &X, T &s) const
 return the scalar product More...
 
tReal l2Norm2 () const
 compute the L2 norm squared More...
 
tReal l2Norm () const
 compute the L2 norm More...
 
template<typename Q , class I1 >
tReal l2Distance2 (const CORE_Array< Q, I1 > &X) const
 compute the L2 distance squared More...
 
template<typename Q , class I1 >
tReal l2Distance (const CORE_Array< Q, I1 > &X) const
 compute the L2 distance More...
 
tReal linfNorm (tIndex &i) const
 compute the L infinity norm More...
 
template<typename Q , class I1 >
tReal linfDistance (const CORE_Array< Q, I1 > &X, tIndex &i) const
 compute the Linfinitty norm More...
 
- Public Member Functions inherited from CORE_Collection< T, I >
void setSize (const tIndex &n)
 set the size of the container More...
 
tIndex getSize () const
 return the size of the container More...
 
void resize (const tIndex &n)
 modify the size of the array and keep its old values
 
const T & operator[] (const tIndex &i) const
 get the i-th element for reading. Do not verify the bounds More...
 
T & operator[] (const tIndex &i)
 get the i-th element for writting. Do not verify the bounds More...
 
constexpr auto cbegin () const
 return begin iterator for reading More...
 
constexpr auto cend () const
 return end iterator for reading More...
 
auto begin ()
 return begin iterator for writing More...
 
auto end ()
 return end iterator for writing More...
 
auto rbegin ()
 return reverse begin iterator for writing More...
 
auto rend ()
 return reverse end iterator for writing More...
 
constexpr auto crbegin () const
 return reverse begin iterator for reading More...
 
constexpr auto crend () const
 return reverse end iterator for reading More...
 
template<typename LambdaFct >
void transform (LambdaFct &&F)
 transform the transform element with the lambda function Ti = F(Ti) More...
 
tString getDataTypeName () const
 get the type of data More...
 
virtual tString toString () const override
 return the string representation of the object node More...
 
- Public Member Functions inherited from CORE_Object
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
virtual tMemSize getContentsMemorySize () const
 return nthe memory size of the included associations More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Protected Member Functions

 CORE_Array ()
 instanciation method of a class
 
virtual ~CORE_Array ()
 destroy an instance of class
 
- Protected Member Functions inherited from CORE_Collection< T, I >
 CORE_Collection ()
 build an array of T*
 
virtual ~CORE_Collection ()
 destroy an array of T*
 
- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Additional Inherited Members

- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Detailed Description

template<typename T, class I>
class CORE_Array< T, I >

this class describes an array of values T of dynamical size with algebrical operators and I is an implemented class which implements the following polymorphic methods:

Member Function Documentation

◆ axpy()

template<typename T , class I >
template<typename Q , class I1 >
void CORE_Array< T, I >::axpy ( const Q &  alpha,
const CORE_Array< Q, I1 > &  X,
const T &  beta 
)
inline

compute This=beta.This+ alpha .X

Parameters
[in]alphaalpha parameter
[in]XX array
[in]beta: beta parameter

◆ copy() [1/8]

template<typename T , class I >
template<typename Q , class I1 >
void CORE_Array< T, I >::copy ( const CORE_Array< Q, I1 > &  cpy)
inline

copy the container

Parameters
[in]cpy: container to copy

◆ copy() [2/8]

template<typename T , class I >
template<typename Q >
void CORE_Array< T, I >::copy ( const tIndex &  n,
const Q *  vs 
)
inline

initialize the array to the values of pointer of size n

Parameters
[in]n: size of vs
[in]vs: values of the array

◆ copy() [3/8]

template<typename T , class I >
template<typename Q , size_t N>
void CORE_Array< T, I >::copy ( const tIndex &  n,
const std::array< Q, N > &  vs 
)
inline

initialize the array to the values of array of size N

Parameters
[in]n: the size of vs to copy
[in]vs: values of the array

◆ copy() [4/8]

template<typename T , class I >
void CORE_Array< T, I >::copy ( const tIndex &  n,
const std::initializer_list< T > &  vs 
)
inline

initialize the array to the values of list

Parameters
[in]n: the size of vs to copy
[in]vs: values of the array

◆ copy() [5/8]

template<typename T , class I >
template<typename Q >
void CORE_Array< T, I >::copy ( const tIndex &  n,
const std::valarray< Q > &  vs 
)
inline

initialize the array to the values of val array

Parameters
[in]n: the size of vs to copy
[in]vs: values of the array

◆ copy() [6/8]

template<typename T , class I >
template<typename Q >
void CORE_Array< T, I >::copy ( const tIndex &  n,
const std::vector< Q > &  vs 
)
inline

initialize the array to the values of vector

Parameters
[in]n: max values to copy
[in]vs: values of the array

◆ copy() [7/8]

template<typename T , class I >
void CORE_Array< T, I >::copy ( const tIndex &  n,
std::initializer_list< T > &&  vs 
)
inline

initialize the array to the values of list

Parameters
[in]n: the size of vs to copy
[in]vs: values of the array

◆ copy() [8/8]

template<typename T , class I >
template<typename Q , class I1 >
void CORE_Array< T, I >::copy ( CORE_Array< Q, I1 > &&  cpy)
inline

copy the conatiner : mv is destroyed after this

Parameters
[in]cpy:container to move

◆ csbegin()

template<typename T , class I >
template<int N>
constexpr auto CORE_Array< T, I >::csbegin ( ) const
inlineconstexpr

return begin N-stride const iterator for writing

Returns
begin stride const iterator

◆ csend()

template<typename T , class I >
template<int N>
constexpr auto CORE_Array< T, I >::csend ( ) const
inlineconstexpr

return end N-stride const iterator for writing

Returns
end stride const iterator

◆ get() [1/2]

template<typename T , class I >
T& CORE_Array< T, I >::get ( const tIndex &  i)
inline

get the i-th element for writting

Parameters
[in]iindex of the element

◆ get() [2/2]

template<typename T , class I >
const T& CORE_Array< T, I >::get ( const tIndex &  i) const
inline

get the i-th element for reading

Parameters
[in]iindex of the element

◆ getMemorySize()

template<typename T , class I >
virtual tMemSize CORE_Array< T, I >::getMemorySize ( ) const
inlineoverridevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Collection< T, I >.

Reimplemented in OMP_ValArray< T >, OMP_PtrArray< T >, CORE_ValArray< T, I >, CORE_ValArray< T, CORE_StdValArray< T > >, CORE_ValArray< T, OMP_ValArray< T > >, CORE_StdValArray< T >, CORE_StdPtrArray< T >, CORE_PtrArray< T, I >, CORE_PtrArray< T, CORE_StdPtrArray< T > >, and CORE_PtrArray< T, OMP_PtrArray< T > >.

◆ getValues() [1/2]

template<typename T , class I >
T* CORE_Array< T, I >::getValues ( )
inline

get the values of the array

Returns
the values of the array

◆ getValues() [2/2]

template<typename T , class I >
const T* CORE_Array< T, I >::getValues ( ) const
inline

get the values of the array for reading

Returns
the values of the array

◆ isNANContained()

template<typename T , class I >
tBoolean CORE_Array< T, I >::isNANContained ( ) const
inline

return true if one value is Not A Number

Returns
false if all the values is a Number

◆ l2Distance()

template<typename T , class I >
template<typename Q , class I1 >
tReal CORE_Array< T, I >::l2Distance ( const CORE_Array< Q, I1 > &  X) const
inline

compute the L2 distance

Returns
the L2 dista,ce \( \sqrt{L2Distance2(X)} \)

◆ l2Distance2()

template<typename T , class I >
template<typename Q , class I1 >
tReal CORE_Array< T, I >::l2Distance2 ( const CORE_Array< Q, I1 > &  X) const
inline

compute the L2 distance squared

Parameters
[in]XX array
Returns
\( \sum_{i=0}^{n-1} |T_i-X_i|^2 \)

◆ l2Norm()

template<typename T , class I >
tReal CORE_Array< T, I >::l2Norm ( ) const
inline

compute the L2 norm

Returns
the L2 norm \( \sqrt{L2Norm2()} \)

◆ l2Norm2()

template<typename T , class I >
tReal CORE_Array< T, I >::l2Norm2 ( ) const
inline

compute the L2 norm squared

Returns
\( \sum_{i=0}^{n-1} |T_i|^2 \)

◆ linfDistance()

template<typename T , class I >
template<typename Q , class I1 >
tReal CORE_Array< T, I >::linfDistance ( const CORE_Array< Q, I1 > &  X,
tIndex &  i 
) const
inline

compute the Linfinitty norm

Returns
the max of |T_i-X_i| and i

◆ linfNorm()

template<typename T , class I >
tReal CORE_Array< T, I >::linfNorm ( tIndex &  i) const
inline

compute the L infinity norm

Returns
the max of |T_i| and i

◆ operator%=()

template<typename T , class I >
I& CORE_Array< T, I >::operator%= ( const T &  v)
inline

modulo operator

Parameters
[in]v: modulo value

and operator

Parameters
[in]vand value

or operator

Parameters
[in]vand value

complementary operator

Parameters
[in]vcomplementary value

left shift operator

Parameters
[in]vleft shift value

right shift operator

Parameters
[in]vleft shift value

array add operator

Parameters
[in]varray to multiply

◆ operator*=() [1/2]

template<typename T , class I >
template<typename Q , class I1 >
I& CORE_Array< T, I >::operator*= ( const CORE_Array< Q, I1 > &  v)
inline

array multiply operator

Parameters
[in]varray to multiply

◆ operator*=() [2/2]

template<typename T , class I >
I& CORE_Array< T, I >::operator*= ( const T &  v)
inline

multiplicator operator

Parameters
[in]v: multiplicator value

◆ operator+=()

template<typename T , class I >
I& CORE_Array< T, I >::operator+= ( const T &  v)
inline

add operator

Parameters
[in]v: add value

◆ operator-=() [1/2]

template<typename T , class I >
template<typename Q , class I1 >
I& CORE_Array< T, I >::operator-= ( const CORE_Array< Q, I1 > &  v)
inline

array sub operator

Parameters
[in]varray to multiply

◆ operator-=() [2/2]

template<typename T , class I >
I& CORE_Array< T, I >::operator-= ( const T &  v)
inline

sub operator

Parameters
[in]v: sub value

◆ operator/=() [1/2]

template<typename T , class I >
template<typename Q , class I1 >
I& CORE_Array< T, I >::operator/= ( const CORE_Array< Q, I1 > &  v)
inline

array divisor operator

Parameters
[in]varray to multiply

◆ operator/=() [2/2]

template<typename T , class I >
I& CORE_Array< T, I >::operator/= ( const T &  v)
inline

divisor operator

Parameters
[in]v: divisor value

◆ operator=() [1/9]

template<typename T , class I >
template<typename Q , class I1 >
Self& CORE_Array< T, I >::operator= ( const CORE_Array< Q, I1 > &  cpy)
inline

build an array by a copy of cpy

Parameters
[in]cpy: array to copy

◆ operator=() [2/9]

template<typename T , class I >
Self& CORE_Array< T, I >::operator= ( const Self cpy)
inline

build an array by a copy of cpy

Parameters
[in]cpy: array to copy

◆ operator=() [3/9]

template<typename T , class I >
template<size_t N, typename Q >
Self& CORE_Array< T, I >::operator= ( const std::array< Q, N > &  values)
inline

build an array by a copy of c

Parameters
[in]valuesvalues to copy

◆ operator=() [4/9]

template<typename T , class I >
template<typename Q >
Self& CORE_Array< T, I >::operator= ( const std::valarray< Q > &  values)
inline

build an array by a copy of c

Parameters
[in]valuesvalues to copy

◆ operator=() [5/9]

template<typename T , class I >
template<typename Q >
Self& CORE_Array< T, I >::operator= ( const std::vector< Q > &  values)
inline

build an array by a copy of c

Parameters
[in]valuesvalues to copy

◆ operator=() [6/9]

template<typename T , class I >
Self& CORE_Array< T, I >::operator= ( const T &  v)
inline

fill the values of the array with v

Parameters
[in]v: value to fill

◆ operator=() [7/9]

template<typename T , class I >
template<typename Q , class I1 >
Self& CORE_Array< T, I >::operator= ( CORE_Array< Q, I1 > &&  cpy)
inline

build an array by a copy of cpy

Parameters
[in]cpy: array to copy ( in mirror with th ecopy operator)

◆ operator=() [8/9]

template<typename T , class I >
Self& CORE_Array< T, I >::operator= ( Self &&  cpy)
inline

build an array by a copy of cpy

Parameters
[in]cpy: array to copy ( in mirror with th ecopy operator)

◆ operator=() [9/9]

template<typename T , class I >
Self& CORE_Array< T, I >::operator= ( std::initializer_list< T >  values)
inline

build an array by a copy of c

Parameters
[in]valuesvalues to copy

◆ prod()

template<typename T , class I >
void CORE_Array< T, I >::prod ( T &  p) const
inline

return the produc of all the elements

Parameters
[out]p: the product of all the elements

◆ sbegin()

template<typename T , class I >
template<int N>
auto CORE_Array< T, I >::sbegin ( )
inline

return begin stride iterator for writing

Returns
begin stride iterator

◆ scalarProduct()

template<typename T , class I >
template<typename Q , class I1 >
T& CORE_Array< T, I >::scalarProduct ( const CORE_Array< Q, I1 > &  X,
T &  s 
) const
inline

return the scalar product

Parameters
[in]X: argument vector
[out]sthe scalar product \( s=<T,X>=\sum_{i=0}^{N-1} T_i.A_i \)

◆ send()

template<typename T , class I >
template<int N>
auto CORE_Array< T, I >::send ( )
inline

return end N-stride iterator for writing

Returns
end stride iterator

◆ setUniformRandomizeSeed()

template<typename T , class I >
virtual void CORE_Array< T, I >::setUniformRandomizeSeed ( const tULLInt &  seed)
inlinevirtual

set the uniform randomize seed

Parameters
[in]seed: seed;

◆ sum()

template<typename T , class I >
void CORE_Array< T, I >::sum ( T &  s) const
inline

Computes the sum of all the elements.

Parameters
[out]s: the sum of all the elements

◆ swap() [1/2]

template<typename T , class I >
void CORE_Array< T, I >::swap ( const tIndex &  i,
const tIndex &  j 
)
inline

swap the two elements of the array

Parameters
[in]i: index to swap
[in]j: index to swap

◆ swap() [2/2]

template<typename T , class I >
void CORE_Array< T, I >::swap ( Self a)
inline

swap the contents of the array

Parameters
[in]athe array with witch the contents is swap

◆ transform() [1/3]

template<typename T , class I >
template<typename LambdaFct >
void CORE_Array< T, I >::transform ( LambdaFct &&  F)
inline

transform the transform element with the lambda function Ti = F(Ti)

Parameters
[in]F: lambda function with one variable

◆ transform() [2/3]

template<typename T , class I >
template<typename LambdaFct >
void CORE_Array< T, I >::transform ( LambdaFct &&  F,
const Self X 
)
inline

transform the transform element with the lambda function Ti = F(Xi)

Parameters
[in]F: lambda function with one variable
[in]X: argument of F

◆ transform() [3/3]

template<typename T , class I >
template<typename LambdaFct >
void CORE_Array< T, I >::transform ( LambdaFct &&  F,
const Self X,
const Self Y 
)
inline

transform the transform element with the lambda function Ti = F(Xi,Yi)

Parameters
[in]F: lambda function with one variable
[in]X: first argument of F
[in]Y: second argument of F

The documentation for this class was generated from the following file: