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

this class describes an arithmetic array type implemented with a std::valarray object with implementatation within I class which have to implment the template polymorphic methods: More...

#include <CORE_ValArray.h>

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

Public Member Functions

 CORE_ValArray ()
 build an array of T*
 
 CORE_ValArray (const tIndex &n)
 build an array of size n More...
 
virtual ~CORE_ValArray ()
 destroy an instance of this
 
virtual tMemSize getMemorySize () const override
 return the memory size of the class More...
 
virtual tMemSize getContentsMemorySize () const override
 return the memory size of the included associations More...
 
void setSize (const tIndex &n)
 set the number of values More...
 
tIndex getSize () const
 return the size of the array for writing 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...
 
std::valarray< T > & getArray ()
 get the array More...
 
const std::valarray< T > & getArray () const
 get the array for reading More...
 
const T * getValues () const
 get the values of the array for reading More...
 
T * getValues ()
 get the values of the array More...
 
void swap (CORE_ValArray< T, I > &a)
 swap the contents of the array More...
 
void swap (const tIndex &i, const tIndex &j)
 swap the 2 elements of the array More...
 
- Public Member Functions inherited from CORE_Array< T, I >
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...
 
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...
 

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...
 
- Protected Member Functions inherited from CORE_Array< T, I >
 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

 

Detailed Description

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

this class describes an arithmetic array type implemented with a std::valarray object with implementatation within I class which have to implment the template polymorphic methods:

Constructor & Destructor Documentation

◆ CORE_ValArray()

template<typename T , class I >
CORE_ValArray< T, I >::CORE_ValArray ( const tIndex &  n)
inlineexplicit

build an array of size n

Parameters
[in]nsize of the array

Member Function Documentation

◆ begin()

template<typename T , class I >
auto CORE_ValArray< T, I >::begin ( )
inline

return begin iterator for writing

Returns
begin iterator

◆ cbegin()

template<typename T , class I >
constexpr auto CORE_ValArray< T, I >::cbegin ( ) const
inlineconstexpr

return begin iterator for reading

Returns
begin iterator

◆ cend()

template<typename T , class I >
constexpr auto CORE_ValArray< T, I >::cend ( ) const
inlineconstexpr

return end iterator for reading

Returns
end iterator

◆ crbegin()

template<typename T , class I >
constexpr auto CORE_ValArray< T, I >::crbegin ( ) const
inlineconstexpr

return reverse begin iterator for reading

Returns
begin iterator

◆ crend()

template<typename T , class I >
constexpr auto CORE_ValArray< T, I >::crend ( ) const
inlineconstexpr

return reverse end iterator for reading

Returns
end iterator

◆ end()

template<typename T , class I >
auto CORE_ValArray< T, I >::end ( )
inline

return end iterator for writing

Returns
end iterator

◆ getArray() [1/2]

template<typename T , class I >
std::valarray<T>& CORE_ValArray< T, I >::getArray ( )
inline

get the array

Returns
the internal array

◆ getArray() [2/2]

template<typename T , class I >
const std::valarray<T>& CORE_ValArray< T, I >::getArray ( ) const
inline

get the array for reading

Returns
the internal array

◆ getContentsMemorySize()

template<typename T , class I >
virtual tMemSize CORE_ValArray< T, I >::getContentsMemorySize ( ) const
inlineoverridevirtual

return the memory size of the included associations

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

Reimplemented from CORE_Object.

◆ getMemorySize()

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

return the memory size of the class

Returns
the memory size of the class in bytes 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Array< T, I >.

Reimplemented in OMP_ValArray< T >, and CORE_StdValArray< T >.

◆ getSize()

template<typename T , class I >
tIndex CORE_ValArray< T, I >::getSize ( ) const
inline

return the size of the array for writing

Returns
the size of the array

◆ getValues() [1/2]

template<typename T , class I >
T* CORE_ValArray< 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_ValArray< T, I >::getValues ( ) const
inline

get the values of the array for reading

Returns
the values of the array

◆ operator[]() [1/2]

template<typename T , class I >
T& CORE_ValArray< T, I >::operator[] ( const tIndex &  i)
inline

get the i-th element for writting. Do not verify the bounds

Parameters
[in]iindex of the element

◆ operator[]() [2/2]

template<typename T , class I >
const T& CORE_ValArray< T, I >::operator[] ( const tIndex &  i) const
inline

get the i-th element for reading. Do not verify the bounds

Parameters
[in]iindex of the element

◆ rbegin()

template<typename T , class I >
auto CORE_ValArray< T, I >::rbegin ( )
inline

return reverse begin iterator for writing

Returns
begin iterator

◆ rend()

template<typename T , class I >
auto CORE_ValArray< T, I >::rend ( )
inline

return reverse end iterator for writing

Returns
end iterator

◆ setSize()

template<typename T , class I >
void CORE_ValArray< T, I >::setSize ( const tIndex &  n)
inline

set the number of values

Parameters
[in]n:number of values of the array

Note that all the old values are deleted.

◆ swap() [1/2]

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

swap the 2 elements of the array

Parameters
[in]i: first element to swap
[in]jsecond element to swa

◆ swap() [2/2]

template<typename T , class I >
void CORE_ValArray< T, I >::swap ( CORE_ValArray< T, I > &  a)
inline

swap the contents of the array

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

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