1 #ifndef CORE_StdValField_H
2 #define CORE_StdValField_H
5 #include "CORE_Field.h"
8 #include "CORE_StdValArray.h"
16 template <
typename T,
typename K,K D>
68 static inline CORE_UniquePointer<Self>
New() {
117 template<
size_t N,
typename Q>
165 template<
typename Q,
class S1,
class I1>
176 template<
typename Q,
class S1,
class I1>
196 auto F=[&iA,&iAe](
auto& Vi) {
200 std::for_each(iA,iAe,[&Vid](
const auto& Aid){(*Vid)=Aid;Vid++;});
265 inline Self& operator&=(
const T& v) requires functions_type::isIntegerType<T>{
273 inline Self& operator|=(
const T& v) requires functions_type::isIntegerType<T>{
281 inline Self& operator^=(
const T& v) requires functions_type::isIntegerType<T> {
288 inline Self& operator<<=(
const T& v) requires functions_type::isIntegerType<T> {
296 inline Self& operator>>=(
const T& v) requires functions_type::isIntegerType<T> {
310 template<
class Q,
class S,
class I>
321 template<
class Q,
class S,
class I>
332 template<
class Q,
class S,
class I>
344 template<
class Q,
class S,
class I>
361 template<
typename LambdaFct>
375 template<
typename LambdaFct>
389 T eps=std::numeric_limits<T>::epsilon();
395 auto F=[&norm,&eps](
auto& Vi) {
398 std::for_each_n(&Vi,D,[&norm](
const auto& Vid){
408 std::for_each_n(&Vi,D,[&norm](
auto& Vid){Vid*=norm;});
447 std::for_each_n(&(*Vi),D,[&Xi](
const auto& Vid) {Xi+=Vid*Vid;});
462 template<
class Q,
class S1,
class I1>
476 template<
class Q,
class S1,
class I1>
484 if (weights.size()==0) {
489 tBoolean incW=(weights.size()>1);
491 const tReal *iWs=&weights[0];
495 const T* iYe=iYs+n*D;
509 s+=(*iWs)*(*iXd)*(*iYs);
524 #ifndef DIMENSION_TYPE
525 #define DIMENSION_TYPE
526 typedef tUCInt tDimension;
this class describes an array of values T of dynamical size with algebrical operators and I is an imp...
Definition: CORE_Array.h:91
void setSize(const tIndex &n)
set the size of the container
Definition: CORE_Collection.h:104
this class describes an field. A field is composed by
Definition: CORE_Field.h:49
virtual tMemSize getContentsMemorySize() const override
return the memory size of the included associations
Definition: CORE_Field.h:102
void copy(const tIndex &n, const Q *vs)
initialize the field to the values of pointer of size n
Definition: CORE_Field.h:447
const T * getValues() const
get the values of the array for reading
Definition: CORE_Field.h:323
auto sbegin()
return begin stride iterator for writing
Definition: CORE_Field.h:276
auto send()
return end N-stride iterator for writing
Definition: CORE_Field.h:282
tIndex getElementsNumber() const
return the number values of the container
Definition: CORE_Field.h:135
constexpr auto csbegin() const
return begin N-stride const iterator for writing
Definition: CORE_Field.h:289
const CORE_StdValArray< T > & getStorage() const
get the storage
Definition: CORE_Field.h:336
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
this class describes a standart arithmetic array type implemented with a std::valarray object of type...
Definition: CORE_StdValArray.h:14
this class describes a standart arithmetic array type implemented with a CORE_StdValArray object
Definition: CORE_StdValField.h:17
Self & operator=(Self &&values)
build an array by a copy of c
Definition: CORE_StdValField.h:154
void initialize(const std::array< Q, D > &a)
copy at element elemnt the array of size D
Definition: CORE_StdValField.h:192
T & scalarProduct(const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
return the weight scalar product
Definition: CORE_StdValField.h:463
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: CORE_StdValField.h:57
Self & operator=(std::initializer_list< T > &&values)
build an array by a copy of c
Definition: CORE_StdValField.h:106
virtual ~CORE_StdValField()
destroy an array of T*
Definition: CORE_StdValField.h:38
void elementsTransform(LambdaFct &&F)
apply the transform element with the lambda function Xid = F(Xid)
Definition: CORE_StdValField.h:376
Self & operator=(const std::vector< Q > &values)
build an array by a copy of c
Definition: CORE_StdValField.h:139
Self & operator=(const Self &values)
build an array by a copy of c
Definition: CORE_StdValField.h:147
Self & operator%=(const T &v) requires functions_type
modulo operator
Definition: CORE_StdValField.h:257
Self & operator/=(const CORE_Field< Q, K, D, S, I > &X)
array divisor operator
Definition: CORE_StdValField.h:345
Self & operator-=(const CORE_Field< Q, K, D, S, I > &X)
array sub operator
Definition: CORE_StdValField.h:322
void mod2(CORE_Array< T, I > &X) const
return the norm2 array per exch element
Definition: CORE_StdValField.h:442
static CORE_UniquePointer< Self > New()
return a new unique pointer of this
Definition: CORE_StdValField.h:68
void normalize()
normalize all the elements of the field return false if the method is not compatible with the floatin...
Definition: CORE_StdValField.h:386
Self & operator=(const std::initializer_list< T > &values)
build an array by a copy of c
Definition: CORE_StdValField.h:99
Self & operator=(const T &v)
fill the values of the array with v
Definition: CORE_StdValField.h:92
Self & operator=(const std::valarray< Q > &values)
build an array by a copy of c
Definition: CORE_StdValField.h:129
T & scalarProduct(const std::valarray< Q > &weights, const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
return the scalar product
Definition: CORE_StdValField.h:477
CORE_StdValField()
build an array of T*
Definition: CORE_StdValField.h:30
static void ElementsTransform(LambdaFct &&F, Self &X)
apply the transform element with the lambda function Ri = F(Xi)
Definition: CORE_StdValField.h:362
Self & operator*=(const T &v)
multiplicator operator
Definition: CORE_StdValField.h:239
Self & operator=(const std::array< Q, N > &values)
build an array by a copy of c
Definition: CORE_StdValField.h:118
Self & operator=(CORE_Field< Q, K, D, S1, I1 > &&values)
build an array by a copy of c
Definition: CORE_StdValField.h:177
Self & operator/=(const T &v)
divisor operator
Definition: CORE_StdValField.h:247
Self & operator+=(const T &v)
add operator
Definition: CORE_StdValField.h:223
Self & operator*=(const CORE_Field< Q, K, D, S, I > &X)
array multiply operator
Definition: CORE_StdValField.h:333
Self & operator=(const CORE_Field< Q, K, D, S1, I1 > &values)
build an array by a copy of c
Definition: CORE_StdValField.h:166
Self & operator-=(const T &v)
sub operator
Definition: CORE_StdValField.h:230