88 template <
typename T,
class I>
177 inline constexpr
auto csend()
const {
204 return static_cast<const I*
>(
this)->
getValues();
210 return static_cast<I*
>(
this)->
getValues();
228 copy(values.size(),values);
235 template<
size_t N,
typename Q>
247 copy(values.size(),values);
256 copy(values.size(),values);
262 template<
typename Q,
class I1>
277 template<
typename Q,
class I1>
302 static_cast<I*
>(
this)->
copy(n,vs);
309 template<
typename Q,
size_t N>
310 inline void copy(
const tIndex& n,
const std::array<Q,N>& vs) {
311 static_cast<I*
>(
this)->
copy(n,vs);
318 inline void copy(
const tIndex& n,
const std::valarray<Q>& vs) {
319 static_cast<I*
>(
this)->
copy(n,vs);
328 static_cast<I*
>(
this)->
copy(n,vs);
335 inline void copy(
const tIndex& n,
const std::initializer_list<T>& vs) {
336 static_cast<I*
>(
this)->
copy(n,vs);
341 inline void copy(
const tIndex& n,std::initializer_list<T>&& vs) {
342 static_cast<I*
>(
this)->
copy(n,vs);
349 template<
typename Q,
class I1>
351 static_cast<I*
>(
this)->
copy(cpy);
357 template<
typename Q,
class I1>
359 static_cast<I
>(*this)->copy(cpy);
378 if (std::is_floating_point_v<T>)
401 return (*
static_cast<I*
>(
this))+=v;
408 return (*
static_cast<I*
>(
this))-=v;
415 return (*
static_cast<I*
>(
this))*=v;
422 return (*
static_cast<I*
>(
this))/=v;
431 inline I&
operator%=(
const T& v) requires core_functions::isIntegerType<T> {
432 return (*
static_cast<I
>(
this))%=v;
438 inline I& operator&=(
const T& v) requires core_functions::isIntegerType<T> {
439 return (*
static_cast<I
>(
this))&=v;
445 inline I& operator|=(
const T& v)requires core_functions::isIntegerType<T> {
446 return (*
static_cast<I
>(
this))|=v;
452 inline I& operator^=(
const T& v) requires core_functions::isIntegerType<T> {
453 return (*
static_cast<I
>(
this))^=v;
458 inline I& operator<<=(
const T& v) requires core_functions::isIntegerType<T> {
459 return (*
static_cast<I
>(
this))<<=v;
465 inline I& operator>>=(
const T& v) requires core_functions::isIntegerType<T> {
466 return (*
static_cast<I
>(
this))>>=v;
476 template<
typename Q,
class I1>
478 return (*
static_cast<I*
>(
this))+=v;
483 template<
typename Q,
class I1>
485 return (*
static_cast<I*
>(
this))-=v;
490 template<
typename Q,
class I1>
492 return (*
static_cast<I*
>(
this))*=v;
497 template<
typename Q,
class I1>
499 return (*
static_cast<I*
>(
this))/=v;
511 template<
typename LambdaFct>
520 template<
typename LambdaFct>
531 template<
typename LambdaFct>
546 static_cast<I*
>(
this)->
swap(a);
553 static_cast<I*
>(
this)->
swap(i,j);
572 template<
typename Q,
class I1>
574 static_cast<I*
>(
this)->
axpy(alpha,X,beta);
602 inline void sum(T& s)
const {
603 return static_cast<const I*
>(
this)->
sum(s);
609 static_cast<const I*
>(
this)->
prod(p);
616 template<
typename Q,
class I1>
626 return static_cast<const I*
>(
this)->
l2Norm2();
639 template<
typename Q,
class I1>
641 return static_cast<const I*
>(
this)->
l2Distance2(X);
647 template<
typename Q,
class I1>
657 return static_cast<const I*
>(
this)->
linfNorm(i);
663 template<
typename Q,
class I1>
675 inline void min(T& m)
const requires core_functions::isOrderedType<T>{
676 static_cast<const I*
>(
this)->
min(m);
682 inline void max(T& m)
const requires core_functions::isOrderedType<T> {
683 return static_cast<const I*
>(
this)->
min(m);
690 directionalSort(
'i');
696 inline void directionalSort(
const tUChar& order) requires core_functions::isOrderedType<T> {
697 static_cast<I*
>(
this)->directionalSort(order);
this class describes an array of values T of dynamical size with algebrical operators and I is an imp...
Definition: CORE_Array.h:89
I & operator-=(const T &v)
sub operator
Definition: CORE_Array.h:407
auto sbegin()
return begin stride iterator for writing
Definition: CORE_Array.h:155
I & operator*=(const T &v)
multiplicator operator
Definition: CORE_Array.h:414
Self & operator=(const CORE_Array< Q, I1 > &cpy)
build an array by a copy of cpy
Definition: CORE_Array.h:263
void swap(const tIndex &i, const tIndex &j)
swap the two elements of the array
Definition: CORE_Array.h:552
Self & operator=(const T &v)
fill the values of the array with v
Definition: CORE_Array.h:220
Self & operator=(const std::vector< Q > &values)
build an array by a copy of c
Definition: CORE_Array.h:255
Self & operator=(const std::array< Q, N > &values)
build an array by a copy of c
Definition: CORE_Array.h:236
Self & operator=(CORE_Array< Q, I1 > &&cpy)
build an array by a copy of cpy
Definition: CORE_Array.h:278
I & operator*=(const CORE_Array< Q, I1 > &v)
array multiply operator
Definition: CORE_Array.h:491
virtual tMemSize getMemorySize() const override
return the memory size of the class and the memory size of all its attributes/associations
Definition: CORE_Array.h:125
CORE_Array()
instanciation method of a class
Definition: CORE_Array.h:101
void sum(T &s) const
Computes the sum of all the elements.
Definition: CORE_Array.h:602
const T & get(const tIndex &i) const
get the i-th element for reading
Definition: CORE_Array.h:189
I & operator/=(const CORE_Array< Q, I1 > &v)
array divisor operator
Definition: CORE_Array.h:498
void transform(LambdaFct &&F)
transform the transform element with the lambda function Ti = F(Ti)
Definition: CORE_Array.h:512
void initialize(const T &v)
randomize the field
Definition: CORE_Array.h:370
tReal linfDistance(const CORE_Array< Q, I1 > &X, tIndex &i) const
compute the Linfinitty norm
Definition: CORE_Array.h:664
auto send()
return end N-stride iterator for writing
Definition: CORE_Array.h:162
CORE_Array< T, I > Self
Definition: CORE_Array.h:94
T * getValues()
get the values of the array
Definition: CORE_Array.h:209
T & get(const tIndex &i)
get the i-th element for writting
Definition: CORE_Array.h:195
void copy(const CORE_Array< Q, I1 > &cpy)
copy the container
Definition: CORE_Array.h:350
void copy(CORE_Array< Q, I1 > &&cpy)
copy the conatiner : mv is destroyed after this
Definition: CORE_Array.h:358
tReal l2Norm() const
compute the L2 norm
Definition: CORE_Array.h:632
tReal l2Norm2() const
compute the L2 norm squared
Definition: CORE_Array.h:625
void transform(LambdaFct &&F, const Self &X, const Self &Y)
transform the transform element with the lambda function Ti = F(Xi,Yi)
Definition: CORE_Array.h:532
void copy(const tIndex &n, const std::valarray< Q > &vs)
initialize the array to the values of val array
Definition: CORE_Array.h:318
void uniformRandomize(const T &min, const T &max)
randomize the field
Definition: CORE_Array.h:387
void prod(T &p) const
return the produc of all the elements
Definition: CORE_Array.h:608
void copy(const tIndex &n, const std::vector< Q > &vs)
initialize the array to the values of vector
Definition: CORE_Array.h:327
tBoolean isNANContained() const
return true if one value is Not A Number
Definition: CORE_Array.h:587
void copy(const tIndex &n, const Q *vs)
initialize the array to the values of pointer of size n
Definition: CORE_Array.h:301
void normalize()
normalize the array
Definition: CORE_Array.h:559
I & operator%=(const T &v) requires core_functions
modulo operator
Definition: CORE_Array.h:431
Self & operator=(Self &&cpy)
build an array by a copy of cpy
Definition: CORE_Array.h:285
const T * getValues() const
get the values of the array for reading
Definition: CORE_Array.h:203
constexpr auto csbegin() const
return begin N-stride const iterator for writing
Definition: CORE_Array.h:170
void transform(LambdaFct &&F, const Self &X)
transform the transform element with the lambda function Ti = F(Xi)
Definition: CORE_Array.h:521
I & operator-=(const CORE_Array< Q, I1 > &v)
array sub operator
Definition: CORE_Array.h:484
constexpr auto csend() const
return end N-stride const iterator for writing
Definition: CORE_Array.h:177
Self & operator=(const std::valarray< Q > &values)
build an array by a copy of c
Definition: CORE_Array.h:246
tReal l2Distance2(const CORE_Array< Q, I1 > &X) const
compute the L2 distance squared
Definition: CORE_Array.h:640
void copy(const tIndex &n, const std::initializer_list< T > &vs)
initialize the array to the values of list
Definition: CORE_Array.h:335
tReal linfNorm(tIndex &i) const
compute the L infinity norm
Definition: CORE_Array.h:656
I & operator+=(const T &v)
add operator
Definition: CORE_Array.h:400
I & operator/=(const T &v)
divisor operator
Definition: CORE_Array.h:421
void axpy(const Q &alpha, const CORE_Array< Q, I1 > &X, const T &beta)
compute This=beta.This+ alpha .X
Definition: CORE_Array.h:573
void swap(Self &a)
swap the contents of the array
Definition: CORE_Array.h:545
virtual ~CORE_Array()
destroy an instance of class
Definition: CORE_Array.h:109
T & scalarProduct(const CORE_Array< Q, I1 > &X, T &s) const
return the scalar product
Definition: CORE_Array.h:617
void uniformRandomize()
randomize the field
Definition: CORE_Array.h:377
Self & operator=(const Self &cpy)
build an array by a copy of cpy
Definition: CORE_Array.h:270
void copy(const tIndex &n, const std::array< Q, N > &vs)
initialize the array to the values of array of size N
Definition: CORE_Array.h:310
void copy(const tIndex &n, std::initializer_list< T > &&vs)
initialize the array to the values of list
Definition: CORE_Array.h:341
Self & operator=(std::initializer_list< T > values)
build an array by a copy of c
Definition: CORE_Array.h:227
tReal l2Distance(const CORE_Array< Q, I1 > &X) const
compute the L2 distance
Definition: CORE_Array.h:648
this class describes a general container of values of type T where implemented class is I
Definition: CORE_Collection.h:49
tIndex getSize() const
return the size of the container
Definition: CORE_Collection.h:111
this class describes a const iterator with a constant stride 2 templates parameter:
Definition: CORE_ConstantStrideIterator.h:12
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:259
this class describes a const iterator with a constant stride 2 templates parameter:
Definition: CORE_StrideIterator.h:12
Definition: functions.h:66
concept isOrderedType
Definition: functions.h:90
requires core_functions::isArithmeticType< T > const T & min(const T &a, const T &b)
min function
Definition: functions.h:415
requires core_functions::isArithmeticType< T > const T & max(const T &a, const T &b)
max function
Definition: functions.h:425
#define tIndex
Definition: types.h:157
#define tUChar
Definition: types.h:25
#define tMemSize
Definition: types.h:166
#define tBoolean
Definition: types.h:151
#define tReal
Definition: types.h:137