36#ifndef STK_ARRAYBASEASSIGN_H
37#define STK_ARRAYBASEASSIGN_H
42#define IS_VALID_ASSIGN(lhs,rhs) \
43( ( ( lhs==Arrays::array2D_ || lhs==Arrays::square_) \
45 ( rhs==Arrays::array2D_ || rhs==Arrays::square_ \
46 || rhs==Arrays::diagonal_ || rhs==Arrays::number_ \
47 || rhs==Arrays::lower_triangular_ || rhs==Arrays::upper_triangular_ \
48 || rhs==Arrays::lower_symmetric_ || rhs==Arrays::upper_symmetric_ \
49 || rhs==Arrays::symmetric_ \
53 ( ( lhs==Arrays::array2D_) \
55 (rhs==Arrays::vector_ || rhs==Arrays::point_|| rhs==Arrays::number_) \
58 ( lhs==Arrays::lower_triangular_ && rhs==Arrays::lower_triangular_) \
60 ( lhs==Arrays::upper_triangular_ && rhs==Arrays::upper_triangular_) \
62 ( ( lhs==Arrays::diagonal_ || lhs==Arrays::vector_ || lhs==Arrays::point_) \
64 (rhs==Arrays::diagonal_ || rhs==Arrays::vector_ || rhs==Arrays::point_) \
67 ( lhs==Arrays::number_ && rhs==Arrays::number_) \
74template<
class Derived>
94 return this->asDerived();
98template<
class Derived>
101template<
class Derived>
104template<
class Derived>
105template<
typename Rhs>
107{
return assign(rhs.asDerived());}
111template<
class Derived>
112template<
typename Rhs>
120 return this->asDerived();
122template<
class Derived>
123template<
typename Rhs>
131 return this->asDerived();
134template<
class Derived>
135template<
typename Rhs>
143 return this->asDerived();
146template<
class Derived>
147template<
typename Rhs>
156 this->asDerived() = this->asDerived() * rhs.asDerived();
157 return this->asDerived();
160template<
class Derived>
161template<
typename Rhs>
169 return this->asDerived();
174template<
class Derived>
180 return this->asDerived();
182template<
class Derived>
188 return this->asDerived();
190template<
class Derived>
196 return this->asDerived();
198template<
class Derived>
204 return this->asDerived();
206template<
class Derived>
212 return this->asDerived();
219template<
class Derived>
225 if (this->sizeRows() != rhs.sizeRows())
227 if (this->sizeCols() != rhs.sizeCols())
231 for (
int jRhs=rhs.beginCols(), jLhs=this->beginCols(); jRhs<rhs.endCols(); jLhs++, jRhs++)
232 for (
int iRhs=rhs.beginRows(), iLhs=this->beginRows(); iRhs<rhs.endRows(); iLhs++, iRhs++)
234 setValue(iLhs, jLhs, rhs.elt(iRhs, jRhs));
237 return this->asDerived();
242#undef IS_VALID_ASSIGN
#define IS_VALID_ASSIGN(lhs, rhs)
In this file we implement the copy and assign methods used when copying an array or an expression (rh...
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
#define STK_STATIC_ASSERT_DENSE_ONLY(EXPR)
Derived & operator+=(ExprBase< Rhs > const &other)
Add Rhs to this.
Derived & operator=(Type const &value)
Derived & copy(ExprBase< Rhs > const &rhs)
overwrite this with src.
Derived & setValue(TypeConst value)
set a value to this container.
hidden::Traits< Derived >::Type Type
Derived & assign(ExprBase< Rhs > const &rhs)
Derived & operator/=(ExprBase< Rhs > const &other)
divide this by Rhs.
Derived & operator*=(ExprBase< Rhs > const &other)
multiply this by Rhs.
Derived & operator-=(ExprBase< Rhs > const &other)
subtract a Rhs to this.
Derived & operator%=(ExprBase< Rhs > const &other)
Take modulo of this by Rhs.
ExprBase()
Default constructor.
Generic expression when unary operator is applied to an expression.
Structure
structures of Arrays that can be handled by STK++
String structureToString(Structure const &type)
convert an Arrays::Structure to a String.
@ square_
square matrix/array/expression
#define STK_STATIC_ASSERT(COND, MSG)
Static assertion with a symbolic message.
The namespace STK is the main domain space of the Statistical ToolKit project.
utility class that select if the copy will be by row or by column
helper defining the return type of the selector involving expressions of the form expr + number and e...
static void run(Lhs &lhs, ExprBase< Rhs > const &rhs)