5 #include "CORE_Object.h"
8 #include "CORE_Exception.h"
11 #include "CORE_ValArray.h"
75 static inline CORE_UniquePointer<Self>
New() {
76 return CORE_UniquePointer<Self>(
new Self(),
110 Copy(values.size(),values,this->getArray());
117 Copy(values.size(),values,this->getArray());
135 inline Self&
operator=(
const std::valarray<T>& values) {
136 Copy(values.size(),values,this->getArray());
144 Copy(values.size(),values,this->getArray());
167 template<
typename Q,
class I1>
177 template<
typename Q,
class I1>
196 template<
typename Q,
class I>
206 template<
typename Q,
class I>
216 template<
typename Q,
class I>
226 template<
typename Q,
class I>
228 Copy(X.getArray(),this->getArray());
244 Copy(cpy.getArray(),this->getArray());
255 inline void copy(
const tIndex& n ,
const Q* Vs) {
264 inline void copy(
const tIndex& n,
const std::initializer_list<T>& Vs) {
265 tIndex p=functions_numeric::min(n,Vs.size());
272 inline void copy(
const tIndex& n,std::initializer_list<T>&& Vs) {
273 tIndex p=functions_numeric::min(n,Vs.size());
282 template<
typename Q,
size_t N>
283 inline void copy(
const tIndex& n,
const std::array<Q,N>& Vs) {
284 tIndex p=functions_numeric::min(n,N);
285 Copy(p,Vs.getData(),this->getArray());
294 inline void copy(
const tIndex& n,
const std::valarray<Q>& Vs) {
295 tIndex p=functions_numeric::min(n,Vs.size());
304 inline void copy(
const tIndex& n,
const std::vector<Q>& Vs) {
305 tIndex p=functions_numeric::min(n,Vs.size());
319 template<
typename Q,
class I>
324 if (R.size()!=p) R.resize(p);
327 auto iR=std::ranges::begin(R);
332 OMP_PARALLEL_SHARED((p,iX,iR)) {
334 tInteger threadId=OMP_GET_THREAD_ID();
337 tInteger nThreads=OMP_GET_THREADS_NUMBER();
340 tIndex start=threadId*p/nThreads;
343 tIndex
end=(threadId+1)*p/nThreads;
358 std::for_each(iXi,eXi,[&iRi](
const auto& Xi) {(*iRi)=Xi;iRi++;});
371 inline static void Copy(
const std::valarray<Q>& X,std::valarray<T>& R) {
380 inline static void Copy(
const std::valarray<T>& X,std::valarray<T>& R) {
392 inline static void Copy(
const tIndex& n,
const std::valarray<Q>& X,std::valarray<T>& R) {
404 inline static void Copy(
const tIndex& n,
const std::vector<Q>& X,std::valarray<T>& R) {
406 tIndex p=functions_numeric::min(n,X.size());
407 if (R.size()!=p) R.resize(p);
410 auto iR=std::ranges::begin(R);
415 OMP_PARALLEL_SHARED((p,iX,iR)) {
417 tInteger threadId=OMP_GET_THREAD_ID();
420 tInteger nThreads=OMP_GET_THREADS_NUMBER();
423 tIndex start=threadId*p/nThreads;
426 tIndex
end=(threadId+1)*p/nThreads;
441 std::for_each(iXi,eXi,[&iRi](
const auto& Xi) {(*iRi)=Xi;iRi++;});
454 inline static void Copy(
const tIndex& n,
const std::initializer_list<T>& X,std::valarray<T>& R) {
456 tIndex p=functions_numeric::min(n,X.size());
457 if (R.size()!=p) R.resize(p);
460 auto iR=std::ranges::begin(R);
465 OMP_PARALLEL_SHARED((p,iX,iR)) {
467 tInteger threadId=OMP_GET_THREAD_ID();
470 tInteger nThreads=OMP_GET_THREADS_NUMBER();
473 tIndex start=threadId*p/nThreads;
476 tIndex
end=(threadId+1)*p/nThreads;
491 std::for_each(iXi,eXi,[&iRi](
const auto& Xi) {(*iRi)=Xi;iRi++;});
502 inline static void Copy(
const tIndex& n,std::initializer_list<T>&& X,std::valarray<T>& R) {
504 tIndex p=functions_numeric::min(n,X.size());
505 if (R.size()!=p) R.resize(p);
508 auto iR=std::ranges::begin(R);
513 OMP_PARALLEL_SHARED((p,iX,iR)) {
515 tInteger threadId=OMP_GET_THREAD_ID();
518 tInteger nThreads=OMP_GET_THREADS_NUMBER();
521 tIndex start=threadId*p/nThreads;
524 tIndex
end=(threadId+1)*p/nThreads;
539 std::for_each(iXi,eXi,[&iRi](
const auto& Xi) {(*iRi)=Xi;iRi++;});
552 requires functions_type::isArithmeticType<Q>
553 inline static void Copy(
const tIndex& n,
const Q* X,std::valarray<T>& R) {
557 auto iR=std::ranges::begin(R);
559 OMP_PARALLEL_SHARED((n,X,iR)) {
561 tInteger threadId=OMP_GET_THREAD_ID();
564 tInteger nThreads=OMP_GET_THREADS_NUMBER();
567 tIndex start=threadId*n/nThreads;
570 tIndex
end=(threadId+1)*n/nThreads;
585 std::for_each(iRi,iRe,[&iX](
const auto& Ri) {Ri=(*iX);iX++;});
610 inline void Initialize(
const T& x,std::valarray<T>& values) {
611 auto F=[&x](
const auto &Ri){
return x;};
632 T alpha=(max-min)/RAND_MAX;
635 auto iR=std::ranges::begin(values);
638 tIndex n=values.size();
640 OMP_PARALLEL_SHARED((alpha,n,min,iR)) {
643 tInteger nThreads=OMP_GET_THREADS_NUMBER();
646 tInteger threadId=OMP_GET_THREAD_ID();
652 for(start=0;start<=threadId;start++) {
658 start=threadId*n/nThreads;
661 tIndex
end=(threadId+1)*n/nThreads;
666 std::transform(iR+start,iR+
end,
667 iR+start,[&alpha,&min](
const auto& Ri) {
668 return alpha*std::rand()+min;
691 auto F=[&v](
const auto &x){
return x+v;};
699 auto F=[&v](
const auto& x){
return x-v;};
708 auto F=[&v](
const auto &x){
return x*v;};
717 if (fabs(v)<std::numeric_limits<T>::epsilon()) {
719 "OMP_ValArray::/=("+std::to_string(v)+
")",
722 auto F=[&v](
const auto &x){
return x/v;};
734 auto F=[&v](
const auto &x){
return x%v;};
742 inline OMP_ValArray<T>& operator&=(
const T& v) requires functions_type::isIntegerType<T>{
743 auto F=[&v](
const auto &x){
return x&v;};
751 inline OMP_ValArray<T>& operator|=(
const T& v) requires functions_type::isIntegerType<T> {
752 auto F=[&v](
const auto &x){
return x|v;};
760 inline OMP_ValArray<T>& operator^=(
const T& v) requires functions_type::isIntegerType<T> {
761 auto F=[&v](
const auto &x){
return x^v;};
768 inline OMP_ValArray<T>& operator<<=(
const T& v) requires functions_type::isIntegerType<T> {
769 auto F=[&v](
const auto &x){
return x<<v;};
776 inline OMP_ValArray<T>& operator>>=(
const T& v) requires functions_type::isIntegerType<T> {
777 auto F=[&v](
const auto &x){
return x>>v;};
789 template<
typename Q,
class I>
791 tIndex p=functions_numeric::min(X.
getSize(),this->getSize());
793 auto iV=this->
begin();
794 OMP_PARALLEL_SHARED((p,iX,iV)) {
796 tInteger threadId=OMP_GET_THREAD_ID();
799 tInteger nThreads=OMP_GET_THREADS_NUMBER();
802 tIndex start=threadId*p/nThreads;
805 tIndex
end=(threadId+1)*p/nThreads;
807 std::transform(iX+start,iX+
end,
809 iV+start,[](
const auto& Xi,
const auto &Vi) {
return Vi+Xi;});
823 template<
typename Q,
class I>
825 tIndex p=functions_numeric::min(X.
getSize(),this->getSize());
827 auto iV=this->
begin();
828 OMP_PARALLEL_SHARED((p,iX,iV)) {
830 tInteger threadId=OMP_GET_THREAD_ID();
833 tInteger nThreads=OMP_GET_THREADS_NUMBER();
836 tIndex start=threadId*p/nThreads;
839 tIndex
end=(threadId+1)*p/nThreads;
841 std::transform(iX+start,iX+
end,
843 iV+start,[](
const auto& Xi,
const auto &Vi) {
return Vi-Xi;});
856 template<
typename Q,
class I>
858 tIndex p=functions_numeric::min(X.
getSize(),this->getSize());
860 auto iV=this->
begin();
861 OMP_PARALLEL_SHARED((p,iX,iV)) {
863 tInteger threadId=OMP_GET_THREAD_ID();
866 tInteger nThreads=OMP_GET_THREADS_NUMBER();
869 tIndex start=threadId*p/nThreads;
872 tIndex
end=(threadId+1)*p/nThreads;
874 std::transform(iX+start,iX+
end,
876 iV+start,[](
const auto& Xi,
const auto &Vi) {
return Vi*Xi;});
888 template<
typename Q,
class I>
890 tIndex p=functions_numeric::min(X.
getSize(),this->getSize());
891 Q eps=std::numeric_limits<Q>::epsilon();
893 auto iV=this->
begin();
894 OMP_PARALLEL_SHARED((p,eps,iX,iV)) {
896 tInteger threadId=OMP_GET_THREAD_ID();
899 tInteger nThreads=OMP_GET_THREADS_NUMBER();
902 tIndex start=threadId*p/nThreads;
905 tIndex
end=(threadId+1)*p/nThreads;
907 std::transform(iX+start,iX+
end,
909 iV+start,[&eps](
const auto& Xi,
const auto &Vi) {
927 template<
typename LambdaFct>
937 template<
typename LambdaFct>
948 template<
typename LambdaFct>
961 template<
typename LambdaFct>
980 OMP_PARALLEL_SHARED((n,iX,iR,F)) {
983 tInteger threadId=OMP_GET_THREAD_ID();
986 tInteger nThreads=OMP_GET_THREADS_NUMBER();
988 tInteger start=threadId*n/nThreads;
989 tInteger
end=(threadId+1)*n/nThreads;
991 std::transform(iX+start,iX+
end,
1006 template<
typename LambdaFct>
1030 OMP_PARALLEL_SHARED((n,iX,iR,F)) {
1033 tInteger threadId=OMP_GET_THREAD_ID();
1036 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1038 tInteger start=threadId*n/nThreads;
1039 tInteger
end=(threadId+1)*n/nThreads;
1041 std::transform(iX+start,iX+
end,
1056 template<
typename LambdaFct>
1067 "OMP_ValArray::Transform(F,X,Y,R)",
1068 "X ("+std::to_string(X.
getSize())+
") & Y ("+std::to_string(Y.
getSize())+
") have not same size");
1089 OMP_PARALLEL_SHARED((n,iX,iY,iR,F)) {
1092 tInteger threadId=OMP_GET_THREAD_ID();
1094 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1096 tInteger start=threadId*n/nThreads;
1097 tInteger
end=(threadId+1)*n/nThreads;
1099 std::transform(iX+start,iX+
end,
1115 OMP_PARALLEL_SHARED_REDUCTION((n,iV),(+:
norm2)) {
1117 tInteger threadId=OMP_GET_THREAD_ID();
1120 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1123 tIndex start=threadId*n/nThreads;
1126 tIndex
end=(threadId+1)*n/nThreads;
1130 std::for_each(iV+start,iV+
end,[&
norm2](
const auto &Vi){
norm2+=Vi*Vi;});
1142 auto iV=this->
begin();
1145 if (inorm>std::numeric_limits<T>::epsilon()) {
1149 OMP_PARALLEL_SHARED((n,inorm,iV)) {
1151 tInteger threadId=OMP_GET_THREAD_ID();
1154 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1157 tIndex start=threadId*n/nThreads;
1160 tIndex
end=(threadId+1)*n/nThreads;
1162 std::transform(iV+start,iV+
end,iV+start,
1163 iV+start,[&inorm](
const auto& Vi){
return Vi*inorm;});
1179 template<
typename Q,
class I>
1181 tIndex p=functions_numeric::min(X.
getSize(),this->getSize());
1184 auto iY=this->
begin();
1185 OMP_PARALLEL_SHARED((p,alpha,beta,iX,iY)) {
1188 tInteger threadId=OMP_GET_THREAD_ID();
1190 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1193 tIndex start=threadId*p/nThreads;
1196 tIndex
end=(threadId+1)*p/nThreads;
1199 std::transform(iX+start,iX+
end,
1201 iY+start,[&alpha,&beta](
const auto& Xi,
const auto& Yi) {
return beta*Yi+alpha*Xi;});
1212 tBoolean isnan=
false;
1215 OMP_PARALLEL_SHARED_REDUCTION((n,iV),(max:isnan)) {
1218 tInteger threadId=OMP_GET_THREAD_ID();
1221 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1224 tInteger start=threadId*n/nThreads;
1227 tInteger
end=(threadId+1)*n/nThreads;
1229 isnan=(std::find_if(iV+start,iV+
end,[](
const auto& Vi) {
return std::isnan(Vi);})!=iV+
end);
1253 template<
typename Q,
class I>
1259 OMP_PARALLEL_SHARED_REDUCTION((p,iX,iV),(+:s)) {
1262 tInteger threadId=OMP_GET_THREAD_ID();
1265 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1268 tInteger start=threadId*p/nThreads;
1271 tInteger
end=(threadId+1)*p/nThreads;
1277 std::for_each(iV+start,iV+
end,[&s,&iXi](
const auto& Vi) {s+=Vi*(*iXi);iXi++;});
1291 OMP_PARALLEL_SHARED_REDUCTION((n,iV),(+:s)) {
1294 tInteger threadId=OMP_GET_THREAD_ID();
1297 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1300 tInteger start=threadId*n/nThreads;
1303 tInteger
end=(threadId+1)*n/nThreads;
1307 std::for_each(iV+start,iV+
end,[&s](
const auto& Vi) {s+=Vi;});
1322 OMP_PARALLEL_SHARED_REDUCTION((n,iV),(*:p)) {
1325 tInteger threadId=OMP_GET_THREAD_ID();
1328 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1331 tInteger start=threadId*n/nThreads;
1334 tInteger
end=(threadId+1)*n/nThreads;
1338 std::for_each(iV+start,iV+
end,[&p](
const auto& Vi) {p*=Vi;});
1362 template<
typename Q,
class I>
1377 template<
typename Q>
1379 const std::valarray<T>& Y) {
1386 tIndex n=functions_numeric::min(nX,Y.size());
1388 auto Ys=std::cbegin(Y);
1390 OMP_PARALLEL_SHARED_REDUCTION((n,Xs,Ys),(+:d2)) {
1393 tInteger threadId=OMP_GET_THREAD_ID();
1395 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1398 tIndex start=threadId*n/nThreads;
1400 tIndex
end=(threadId+1)*n/nThreads;
1404 const Q *iX=Xs+start;
1410 std::for_each(Ys+start,Ys+
end,
1411 [&d2,&iX,&tmp](
const auto& Yi) {
1421 OMP_PARALLEL_SHARED_REDUCTION((p,n,Xs),(+:d2)) {
1424 tInteger threadId=OMP_GET_THREAD_ID();
1426 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1429 tIndex start=threadId*p/nThreads;
1431 tIndex
end=(threadId+1)*p/nThreads;
1434 const Q *iX=Xs+n+start;
1436 const Q *iXe=Xs+n+
end;
1449 OMP_PARALLEL_SHARED_REDUCTION((p,n,Ys),(+:d2)) {
1452 tInteger threadId=OMP_GET_THREAD_ID();
1454 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1457 tIndex start=threadId*p/nThreads;
1459 tIndex
end=(threadId+1)*p/nThreads;
1461 std::for_each(Ys+n+start,Ys+n+
end,
1462 [&d2](
const auto& Yi) {d2+=Yi*Yi;});
1486 template<
typename Q,
class I>
1501 template<
typename Q>
1503 const std::valarray<T>& Y,
1509 tIndex n=functions_numeric::min(nX,Y.size());
1512 std::pair<tIndex,T> S(0,0);
1514 auto Ys=std::cbegin(Y);
1517 OMP_PARALLEL_SHARED_REDUCTION((n,Ys,Xs), (argrmax:S)) {
1519 tInteger threadId=OMP_GET_THREAD_ID();
1521 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1524 tIndex start=threadId*n/nThreads;
1526 tIndex
end=(threadId+1)*n/nThreads;
1531 const Q *iX=Xs+start;
1537 std::for_each(Ys+start,Ys+
end,
1538 [&i,&
norm2,&iX,&S](
const auto& Yi) {
1541 if (S.second<
norm2) {
1552 OMP_PARALLEL_SHARED_REDUCTION((n,p,Xs), (argrmax:S)) {
1554 tInteger threadId=OMP_GET_THREAD_ID();
1556 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1559 tIndex start=threadId*p/nThreads;
1561 tIndex
end=(threadId+1)*p/nThreads;
1565 const Q*iX=Xs+n+start;
1567 const Q *iXe=Xs+n+
end;
1575 if (S.second<
norm2) {
1587 OMP_PARALLEL_SHARED_REDUCTION((n,p,Ys), (argrmax:S)) {
1589 tInteger threadId=OMP_GET_THREAD_ID();
1591 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1594 tIndex start=threadId*p/nThreads;
1596 tIndex
end=(threadId+1)*p/nThreads;
1602 std::for_each(Ys+n+start,Ys+n+
end,
1603 [&i,&S,&mod2](
const auto& Yi) {
1606 if (S.second<mod2) {
1617 return sqrt(S.second);
1632 inline void min(T& minV)
const requires functions_type::isOrderedType<T> {
1638 OMP_PARALLEL_SHARED_REDUCTION((n,iV),(min:minV)) {
1641 tInteger threadId=OMP_GET_THREAD_ID();
1644 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1647 tInteger start=threadId*n/nThreads;
1650 tInteger
end=(threadId+1)*n/nThreads;
1655 std::for_each(iVs,iV+
end,[&minV](
const auto& Vi) {minV=(minV<Vi)?minV:Vi;});
1666 inline void max(T& maxV)
const requires functions_type::isOrderedType<T> {
1672 OMP_PARALLEL_SHARED_REDUCTION((n,iV),
1676 tInteger threadId=OMP_GET_THREAD_ID();
1679 tInteger nThreads=OMP_GET_THREADS_NUMBER();
1682 tInteger start=threadId*n/nThreads;
1685 tInteger
end=(threadId+1)*n/nThreads;
1690 std::for_each(iVs,iV+
end,[&maxV](
const auto& Vi) {maxV=(maxV>Vi)?maxV:Vi;});
1702 inline void directionalSort(
const tUChar& order) requires functions_type::isOrderedType<T>{
1705 std::sort(this->
begin(),this->
end(),std::less<T>());
1708 std::sort(this->
begin(),this->
end(),std::greater<T>());
this class describes an array of values T of dynamical size with algebrical operators and I is an imp...
Definition: CORE_Array.h:91
const T * getValues() const
get the values of the array for reading
Definition: CORE_Array.h:206
constexpr auto cbegin() const
return begin iterator for reading
Definition: CORE_Collection.h:143
tIndex getSize() const
return the size of the container
Definition: CORE_Collection.h:111
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:17
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
this class describes an arithmetic array type implemented with a std::valarray object with implementa...
Definition: CORE_ValArray.h:70
constexpr auto cbegin() const
return begin iterator for reading
Definition: CORE_ValArray.h:199
virtual tMemSize getContentsMemorySize() const override
return the memory size of the included associations
Definition: CORE_ValArray.h:126
tIndex getSize() const
return the size of the array for writing
Definition: CORE_ValArray.h:147
auto end()
return end iterator for writing
Definition: CORE_ValArray.h:217
auto begin()
return begin iterator for writing
Definition: CORE_ValArray.h:211
std::valarray< T > & getArray()
get the array
Definition: CORE_ValArray.h:257
this class describes a standart arithmetic array type implemented with a std::valarray object of type...
Definition: OMP_ValArray.h:19
OMP_ValArray(const tIndex &n)
build an instance of class of size n
Definition: OMP_ValArray.h:38
static CORE_UniquePointer< Self > New()
return a unique pointer of the class
Definition: OMP_ValArray.h:75
Self & operator=(Self &&values)
build an array by a copy of c (in mirror with the copy operator)
Definition: OMP_ValArray.h:157
Self & operator=(const CORE_Array< Q, I1 > &values)
build an array by a copy of c
Definition: OMP_ValArray.h:168
void transform(LambdaFct &&F, const CORE_Array< T, Self > &X, const CORE_Array< T, Self > &Y)
transform the transform element with the lambda function Ti := F(const Xi,const Yi)
Definition: OMP_ValArray.h:949
void copy(const CORE_ValArray< Q, I > &X)
copy the container
Definition: OMP_ValArray.h:217
static tReal LinfDistance(const tIndex &nX, const Q *Xs, const std::valarray< T > &Y, tIndex &imax)
compute the index of the array where the module of the difference between X & Y is max
Definition: OMP_ValArray.h:1502
Self & operator=(const std::array< T, N > &values)
build an array by a copy of c
Definition: OMP_ValArray.h:126
requires static functions_type::isArithmeticType< Q > void Copy(const tIndex &n, const Q *X, std::valarray< T > &R)
copy the n values of a pointers array
Definition: OMP_ValArray.h:553
static void Copy(const tIndex &n, const std::valarray< Q > &X, std::valarray< T > &R)
copy the the n first values of a valarray
Definition: OMP_ValArray.h:392
void axpy(const Q &alpha, const CORE_Array< Q, I > &X, const T &beta)
compute This=beta.This+ alpha .X
Definition: OMP_ValArray.h:1180
static void Copy(const tIndex &n, const std::vector< Q > &X, std::valarray< T > &R)
copy the the n first values of an initializer
Definition: OMP_ValArray.h:404
static void Copy(const std::valarray< T > &X, std::valarray< T > &R)
copy 2 std::valarray with same type : no parallelization : faster with the intrinsect method
Definition: OMP_ValArray.h:380
Self & operator=(const CORE_Array< Q, I1 > &&values)
build an array by a copy of c (in mirror with the copy operator)
Definition: OMP_ValArray.h:178
virtual ~OMP_ValArray()
destroy an instance of class
Definition: OMP_ValArray.h:48
Self & operator=(const std::initializer_list< T > &values)
build an array by a copy of c
Definition: OMP_ValArray.h:109
Self & operator=(const Self &values)
build an array by a copy of c
Definition: OMP_ValArray.h:150
void normalize()
normalize the array
Definition: OMP_ValArray.h:1141
T norm2() const
compute the norm 2 of the array
Definition: OMP_ValArray.h:1110
Self & operator=(const std::valarray< T > &values)
build an array by a copy of c
Definition: OMP_ValArray.h:135
tReal linfNorm(tIndex &imax) const
compute the Linf-norm of this
Definition: OMP_ValArray.h:1475
void sum(T &s) const
return the sum of all the elements
Definition: OMP_ValArray.h:1287
void initialize(const T &x)
initialize the array to the value x
Definition: OMP_ValArray.h:601
OMP_ValArray< T > & operator*=(const T &v)
multiplicator operator
Definition: OMP_ValArray.h:707
T & scalarProduct(const CORE_Array< Q, I > &X, T &s) const
return the scalar product
Definition: OMP_ValArray.h:1254
Self & operator/=(const CORE_Array< Q, I > &X)
array divisor operator
Definition: OMP_ValArray.h:889
OMP_ValArray< T > & operator-=(const T &v)
sub operator
Definition: OMP_ValArray.h:698
void copy(Self &&cpy)
copy the conatiner : mv is destroyed after this
Definition: OMP_ValArray.h:243
void copy(CORE_ValArray< Q, I > &&X)
copy the conatiner : mv is destroyed after this
Definition: OMP_ValArray.h:227
void Initialize(const T &x, std::valarray< T > &values)
initialize the array to the value x
Definition: OMP_ValArray.h:610
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: OMP_ValArray.h:64
tBoolean isNANContained() const
return true if one value is Not A Number
Definition: OMP_ValArray.h:1211
void copy(const tIndex &n, const Q *Vs)
initialize the array to the values of pointer of size n
Definition: OMP_ValArray.h:255
void transform(LambdaFct &&F)
transform the transform element in parallel to the lambda function Ti=F(const Ti)
Definition: OMP_ValArray.h:928
void transform(LambdaFct &&F, const CORE_Array< T, Self > &X)
transform the transform element in parallel to the lambda function Ti=F(const Xi)
Definition: OMP_ValArray.h:938
OMP_ValArray< T > & operator+=(const T &v)
add operator
Definition: OMP_ValArray.h:690
void copy(const tIndex &n, const std::array< Q, N > &Vs)
initialize the array to the values of array of size N
Definition: OMP_ValArray.h:283
static void Transform(LambdaFct &&F, const CORE_Array< T, Self > &X, Self &R)
transform the transform element with the lambda function Ri = F(const Xi)
Definition: OMP_ValArray.h:1007
void prod(T &p) const
return the produc of all the elements
Definition: OMP_ValArray.h:1318
Self & operator=(std::initializer_list< T > &&values)
build an array by a copy of c
Definition: OMP_ValArray.h:116
OMP_ValArray()
build an instance of class
Definition: OMP_ValArray.h:31
void copy(const Self &cpy)
copy the container
Definition: OMP_ValArray.h:236
tReal linfDistance(const CORE_Array< Q, I > &X, tIndex &imax) const
compute the square of L2-distance of this to X
Definition: OMP_ValArray.h:1487
void copy(const tIndex &n, const std::initializer_list< T > &Vs)
initialize the array to the values of list
Definition: OMP_ValArray.h:264
void uniformRandomize(const T &min, const T &max)
randomize the vector in [min,max]
Definition: OMP_ValArray.h:619
static void Transform(LambdaFct &&F, const CORE_Array< T, Self > &X, const CORE_Array< T, Self > &Y, Self &R)
transform the transform element with the lambda function Ri = F(const Xi,const Yi)
Definition: OMP_ValArray.h:1057
static void Copy(const tIndex &n, const std::initializer_list< T > &X, std::valarray< T > &R)
copy the the n first values of an initializer
Definition: OMP_ValArray.h:454
OMP_ValArray< T > & operator/=(const T &v)
divisor operator
Definition: OMP_ValArray.h:716
static void UniformRandomize(const T &min, const T &max, std::valarray< T > &values)
generate a random val array
Definition: OMP_ValArray.h:631
void copy(const tIndex &n, const std::vector< Q > &Vs)
initialize the array to the values of vector
Definition: OMP_ValArray.h:304
static tReal L2Distance2(const tIndex &nX, const Q *Xs, const std::valarray< T > &Y)
compute the square of L2 distance of X to Y
Definition: OMP_ValArray.h:1378
void copy(const tIndex &n, const std::valarray< Q > &Vs)
initialize the array to the values of val array
Definition: OMP_ValArray.h:294
Self & operator%=(const T &v) requires functions_type
modulo operator
Definition: OMP_ValArray.h:733
Self & operator-=(const CORE_Array< Q, I > &X)
array sub operator
Definition: OMP_ValArray.h:824
tReal l2Norm2() const
compute the square of L2-norm of this
Definition: OMP_ValArray.h:1351
Self & operator=(const std::vector< T > &values)
build an array by a copy of c
Definition: OMP_ValArray.h:143
Self & operator*=(const CORE_Array< Q, I > &X)
array multiply operator
Definition: OMP_ValArray.h:857
static void Copy(const tIndex &n, std::initializer_list< T > &&X, std::valarray< T > &R)
copy the the n first values of an initializer
Definition: OMP_ValArray.h:502
static void Transform(LambdaFct &&F, Self &X)
transform the transform element with the lambda function Xi = F(const Xi)
Definition: OMP_ValArray.h:962
void copy(const CORE_Array< Q, I > &X)
copy the array
Definition: OMP_ValArray.h:197
void copy(CORE_Array< Q, I > &&X)
copy the array
Definition: OMP_ValArray.h:207
static void Copy(const std::valarray< Q > &X, std::valarray< T > &R)
copy 2 std::valarray with different type
Definition: OMP_ValArray.h:371
tReal l2Distance2(const CORE_Array< Q, I > &X) const
compute the square of L2-distance of this to X
Definition: OMP_ValArray.h:1363
Self & operator=(const T &v)
fill the values of the array with v
Definition: OMP_ValArray.h:102
void copy(const tIndex &n, std::initializer_list< T > &&Vs)
initialize the array to the values of list
Definition: OMP_ValArray.h:272
static void Copy(const CORE_Array< Q, I > &X, std::valarray< T > &R)
copy 2 std::valarray with different type
Definition: OMP_ValArray.h:320