84 { return UnaryOperator<FUNCTOR<Type>, Derived>(this->asDerived()); }
85
87#define MAKE_UNARY_OPERATOR_1ARG(FUNCTION, FUNCTOR) \
88 inline UnaryOperator<FUNCTOR<Type>, Derived> FUNCTION(Type const& value) const \
89 { return UnaryOperator<FUNCTOR<Type>, Derived>(this->asDerived(), FUNCTOR<Type>(value)); }
90
92#define MAKE_RESHAPE_OPERATOR(OPERATOR, SHAPE) \
93 inline OPERATOR##Operator< Derived> const SHAPE() const \
94 { return OPERATOR##Operator< Derived>(this->asDerived()); }
95
96
98{
99
111template<class Derived>
112class ExprBase: public ITContainer<Derived, hidden::Traits<Derived>::structure_>
113{
114 public:
115 enum
116 {
117 structure_ = hidden::Traits<Derived>::structure_,
118 orient_ = hidden::Traits<Derived>::orient_,
119 sizeRows_ = hidden::Traits<Derived>::sizeRows_,
120 sizeCols_ = hidden::Traits<Derived>::sizeCols_,
121 storage_ = hidden::Traits<Derived>::storage_
122 };
123 typedef ITContainer<Derived, structure_>
Base;
124 typedef typename hidden::Traits<Derived>::Type
Type;
125 typedef typename hidden::Traits<Derived>::TypeConst
TypeConst;
126
127 protected:
132
133 public:
134
135
139 template<typename Visitor>
140 typename Visitor::TypeConst
visit(Visitor& visitor)
const;
156 bool const any()
const;
164 bool const all()
const;
167
228
233
244
257
261 template<typename Rhs>
262 Type const wsum(ExprBase<Rhs>
const& weights)
const;
266 template<typename Rhs>
267 Type const wsumSafe(ExprBase<Rhs>
const& weights)
const;
271 template<typename Rhs>
272 Type const wnorm(ExprBase<Rhs>
const& weights)
const;
276 template<typename Rhs>
281 template<typename Rhs>
282 Type const wnorm2(ExprBase<Rhs>
const& weights)
const;
286 template<typename Rhs>
291 template<typename Rhs>
292 Type const wmean(ExprBase<Rhs>
const& weights)
const;
296 template<typename Rhs>
301 template<typename Rhs>
306 template<typename Rhs>
311 template<typename Rhs>
316 template<typename Rhs>
318
319
320
333
334
344
345
349
350
354
355
361
362
363
398
399
412
413
417
418
428
429
433
434
440
441
445
446
447 inline UnaryOperator<SafeOp<Type>, Derived>
const safe(
Type const value =
Type())
const
448 { return UnaryOperator<SafeOp<Type>, Derived>(this->asDerived(), SafeOp<Type>(value)); }
449
450
452 inline friend UnaryOperator<SumWithOp<Type>, Derived> const
454 { return other.asDerived() + value;}
456 inline friend UnaryOperator<SubstractToOp<Type>, Derived > const
458 { return UnaryOperator<SubstractToOp<Type>, Derived>(other.asDerived(), SubstractToOp<Type>(value));}
460 inline friend UnaryOperator< ProductWithOp<Type>, Derived> const
462 { return other.asDerived()*value; }
463
465 template<typename OtherType>
466 inline UnaryOperator<CastOp<Type, OtherType>, Derived>
const cast()
const
467 { return UnaryOperator<CastOp<Type, OtherType>, Derived>(this->asDerived());}
468
469
471 inline UnaryOperator<Law::PdfOp<Type>, Derived>
pdf( Law::IUnivLaw<Type>
const& law)
const
472 { return UnaryOperator<Law::PdfOp<Type>, Derived>(this->asDerived(), Law::PdfOp<Type>(law));}
474 inline UnaryOperator<Law::LogPdfOp<Type>, Derived>
lpdf( Law::IUnivLaw<Type>
const& law)
const
475 { return UnaryOperator<Law::LogPdfOp<Type>, Derived>(this->asDerived(), Law::LogPdfOp<Type>(law));}
477 inline UnaryOperator<Law::CdfOp<Type>, Derived>
cdf( Law::IUnivLaw<Type>
const& law)
const
478 { return UnaryOperator<Law::CdfOp<Type>, Derived>(this->asDerived(), Law::CdfOp<Type>(law));}
480 inline UnaryOperator<Law::LogCdfOp<Type>, Derived>
lcdf( Law::IUnivLaw<Type>
const& law)
const
481 { return UnaryOperator<Law::LogCdfOp<Type>, Derived>(this->asDerived(), Law::LogCdfOp<Type>(law));}
483 inline UnaryOperator<Law::CdfcOp<Type>, Derived>
cdfc( Law::IUnivLaw<Type>
const& law)
const
484 { return UnaryOperator<Law::CdfcOp<Type>, Derived>(this->asDerived(), Law::CdfcOp<Type>(law));}
486 inline UnaryOperator<Law::LogCdfcOp<Type>, Derived>
lcdfc( Law::IUnivLaw<Type>
const& law)
const
487 { return UnaryOperator<Law::LogCdfcOp<Type>, Derived>(this->asDerived(), Law::LogCdfcOp<Type>(law));}
489 inline UnaryOperator<Law::IcdfOp<Type>, Derived>
icdf( Law::IUnivLaw<Type>
const& law)
const
490 { return UnaryOperator<Law::IcdfOp<Type>, Derived>(this->asDerived(), Law::IcdfOp<Type>(law));}
491
492
494 template< template<typename> class OtherOperator>
495 inline UnaryOperator<OtherOperator<Type>, Derived>
const funct0()
const
496 { return UnaryOperator<OtherOperator<Type>, Derived>(this->asDerived());}
498 template< template<typename> class OtherOperator>
499 inline UnaryOperator<OtherOperator<Type>, Derived>
const funct1(
Type const value)
const
500 { return UnaryOperator<OtherOperator<Type>, Derived>(this->asDerived(), OtherOperator<Type>(value));}
501
502
519
520
522 template<int Size_>
523 inline SubVectorOperator<Derived, Size_>
const sub(TRange<Size_>
const& I)
const
524 {
526 return SubVectorOperator<Derived, Size_>(this->asDerived(), I);
527 }
528
530 inline ColOperator<Derived>
const col(
int j)
const
531 { return ColOperator<Derived> (this->asDerived(), j);}
533 inline RowOperator<Derived>
const row(
int i)
const
534 { return RowOperator<Derived> (this->asDerived(), i);}
536 template<int Size_>
537 inline SubOperator<Derived, sizeRows_, Size_>
const col(TRange<Size_>
const& J)
const
538 { return SubOperator<Derived, sizeRows_, Size_> (this->asDerived(), this->rows(), J);}
540 template<int Size_>
541 inline SubOperator<Derived, Size_, sizeCols_>
const row(TRange<Size_>
const& I)
const
542 { return SubOperator<Derived, Size_, sizeCols_> (this->asDerived(), I, this->cols());}
543
545 template<int SizeRows_, int SizeCols_>
546 inline SubOperator<Derived, SizeRows_, SizeCols_>
const sub(TRange<SizeRows_>
const& I,TRange<SizeCols_>
const& J)
const
547 {
549 return SubOperator<Derived, SizeRows_, SizeCols_>(this->asDerived(), I, J);
550 }
551
552
556 template<class Rhs>
558 dot(ExprBase<Rhs>
const& other)
const;
562 template<class Rhs>
564 dotSafe(ExprBase<Rhs>
const& other)
const;
565
567 template<typename Rhs>
568 typename hidden::ProductSelector<Derived, Rhs, hidden::Traits<Derived>::structure_, hidden::Traits<Rhs>::structure_>::ProductType const
569 operator*( ExprBase<Rhs>
const& other)
const;
570};
571
572}
573
574#undef DEFINE_BINARY_OPERATOR
575#undef MAKE_UNARY_OPERATOR_NOARG
576#undef MAKE_UNARY_OPERATOR_1ARG
577#undef MAKE_RESHAPE_OPERATOR
578
583
584
585#endif
#define MAKE_RESHAPE_OPERATOR(OPERATOR, SHAPE)
utility macro allowing to construct unary operators
In this file we define the dot product and its particular cases.
In this file we define the matrix-matrix product and its particular cases.
In this file we define the Visitors for ExprBase.
#define MAKE_UNARY_OPERATOR_NOARG(FUNCTION, FUNCTOR)
utility macro allowing to construct unary operators
#define MAKE_UNARY_OPERATOR_1ARG(FUNCTION, FUNCTOR)
utility macro allowing to construct unary operators with one argument
#define DEFINE_BINARY_OPERATOR(OPERATORNAME, BINARYOPERATORNAME)
utility macro allowing to define binary operators
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
#define STK_STATIC_ASSERT_TWO_DIMENSIONS_ONLY(EXPR)
UnaryOperator< CosOp< Type >, Derived > cos() const
UnaryOperator< NegOp< Type >, Derived > neg() const
friend UnaryOperator< ProductWithOp< Type >, Derived > const operator*(Type const value, ExprBase< Derived > const &other)
UnaryOperator< TanOp< Type >, Derived > tan() const
UnaryOperator< LogOp< Type >, Derived > log() const
TransposeOperator< Derived > const transpose() const
Type const varianceSafe() const
UnaryOperator< Law::PdfOp< Type >, Derived > pdf(Law::IUnivLaw< Type > const &law) const
compute pdf values to this using distribution law given by user
ITContainer< Derived, structure_ > Base
hidden::Traits< Derived >::TypeConst TypeConst
bool const any() const
check if there is any non-zero element in an expression.
UnaryOperator< AbsOp< Type >, Derived > abs() const
Type const wmean(ExprBase< Rhs > const &weights) const
UnaryOperator< Law::IcdfOp< Type >, Derived > icdf(Law::IUnivLaw< Type > const &law) const
compute inverse cumulative distribution function using distribution law given by user
hidden::OperatorSelector< Derived, Rhs, Arrays::maxOp_ >::Result const max(ExprBase< Rhs > const &other) const
RowOperator< Derived > const row(int i) const
bool const all() const
check if all the elements in an expression are not zero.
friend UnaryOperator< SumWithOp< Type >, Derived > const operator+(Type const &value, ExprBase< Derived > const &other)
Type const wnorm2(ExprBase< Rhs > const &weights) const
DiagonalizeOperator< Derived > const diagonalize() const
LowerTriangularizeOperator< Derived > const lowerTriangularize() const
DiagonalGetterOperator< Derived > const getDiagonal() const
Type const meanSafe() const
Type const minElt() const
Type const wnorm2Safe(ExprBase< Rhs > const &weights) const
Type const variance() const
UnaryOperator< SafeOp< Type >, Derived > const safe(Type const value=Type()) const
UnaryOperator< SqrtOp< Type >, Derived > sqrt() const
int count() const
compute the value of non-zero element in an expression.
Type const sumSafe() const
UnaryOperator< SafeInverseOp< Type >, Derived > safeInverse(Type const &value) const
UnaryOperator< CastOp< Type, OtherType >, Derived > const cast() const
UnaryOperator< CubeOp< Type >, Derived > cube() const
hidden::Traits< Derived >::Type Type
UnaryOperator< PowOp< Type >, Derived > pow(Type const &value) const
int nbAvailableValues() const
UnaryOperator< IsFiniteOp< Type >, Derived > isFinite() const
UpperTriangularizeOperator< Derived > const upperTriangularize() const
Visitor::TypeConst visit(Visitor &visitor) const
Visit the container using a constant visitor.
UnaryOperator< IsInfiniteOp< Type >, Derived > isInfinite() const
Type const maxElt() const
Type const minEltSafe() const
Type const wmeanSafe(ExprBase< Rhs > const &weights) const
hidden::OperatorSelector< Derived, Rhs, Arrays::productOp_ >::Result const prod(ExprBase< Rhs > const &other) const
hidden::Promote< Type, typenameRhs::Type >::result_type const dotSafe(ExprBase< Rhs > const &other) const
UnaryOperator< AsinOp< Type >, Derived > asin() const
hidden::Promote< Type, typenameRhs::Type >::result_type const dot(ExprBase< Rhs > const &other) const
UnaryOperator< SquareOp< Type >, Derived > square() const
UnaryOperator< OtherOperator< Type >, Derived > const funct1(Type const value) const
Type const normInf() const
ColOperator< Derived > const col(int j) const
UnaryOperator< Law::LogPdfOp< Type >, Derived > lpdf(Law::IUnivLaw< Type > const &law) const
compute log-pdf values to this using distribution law given by user
SubVectorOperator< Derived, Size_ > const sub(TRange< Size_ > const &I) const
Type const wnormSafe(ExprBase< Rhs > const &weights) const
UnaryOperator< OtherOperator< Type >, Derived > const funct0() const
Type const wvarianceSafe(ExprBase< Rhs > const &weights) const
UnaryOperator< AcosOp< Type >, Derived > acos() const
UnaryOperator< IsNaOp< Type >, Derived > isNA() const
UnaryOperator< Law::LogCdfOp< Type >, Derived > lcdf(Law::IUnivLaw< Type > const &law) const
compute log-cumulative distribution function of this using distribution law given by user
Type const wnorm(ExprBase< Rhs > const &weights) const
SymmetrizeOperator< Derived > const symmetrize() const
ExprBase()
Default constructor.
UnaryOperator< InverseOp< Type >, Derived > inverse() const
UnaryOperator< Law::LogCdfcOp< Type >, Derived > lcdfc(Law::IUnivLaw< Type > const &law) const
compute complementary cumulative distribution function of this using distribution law given by user
hidden::OperatorSelector< Derived, Rhs, Arrays::minOp_ >::Result const min(ExprBase< Rhs > const &other) const
UpperSymmetrizeOperator< Derived > const upperSymmetrize() const
UnaryOperator< Law::CdfcOp< Type >, Derived > cdfc(Law::IUnivLaw< Type > const &law) const
compute complementary cumulative distribution function of this using distribution law given by user
UnaryOperator< Law::CdfOp< Type >, Derived > cdf(Law::IUnivLaw< Type > const &law) const
compute cumulative distribution function of this using distribution law given by user
UnaryOperator< SinOp< Type >, Derived > sin() const
LowerSymmetrizeOperator< Derived > const lowerSymmetrize() const
UnaryOperator< OppositeOp< Type >, Derived > operator-() const
Type const normSafe() const
Type const wvariance(ExprBase< Rhs > const &weights) const
UnaryOperator< ExpOp< Type >, Derived > exp() const
Type const wsum(ExprBase< Rhs > const &weights) const
Type const norm2Safe() const
Type const wsumSafe(ExprBase< Rhs > const &weights) const
Type const maxEltSafe() const
The namespace STK is the main domain space of the Statistical ToolKit project.