23 #ifndef NDARRAY_ArrayRef_h_INCLUDED
24 #define NDARRAY_ArrayRef_h_INCLUDED
45 template <
typename T,
int N,
int C>
64 template <
typename T_,
int C_>
78 template <
typename T_,
int C_>
109 template <
typename Other>
113 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
119 template <
typename Scalar>
121 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
126 Super::Traits::fill(this->
begin(),this->
end(),scalar);
131 template <
typename Other>
135 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
137 typename Other::Iterator j = expr.
begin();
138 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) += (*j);
143 template <
typename Scalar>
145 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
151 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) += scalar;
156 template <
typename Other>
160 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
162 typename Other::Iterator j = expr.
begin();
163 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) -= (*j);
168 template <
typename Scalar>
170 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
176 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) -= scalar;
181 template <
typename Other>
185 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
187 typename Other::Iterator j = expr.
begin();
188 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) *= (*j);
193 template <
typename Scalar>
195 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
201 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) *= scalar;
206 template <
typename Other>
210 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
212 typename Other::Iterator j = expr.
begin();
213 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) /= (*j);
218 template <
typename Scalar>
220 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
226 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) /= scalar;
231 template <
typename Other>
235 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
237 typename Other::Iterator j = expr.
begin();
238 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) %= (*j);
243 template <
typename Scalar>
245 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
251 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) %= scalar;
256 template <
typename Other>
260 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
262 typename Other::Iterator j = expr.
begin();
263 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) ^= (*j);
268 template <
typename Scalar>
270 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
276 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) ^= scalar;
281 template <
typename Other>
285 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
287 typename Other::Iterator j = expr.
begin();
288 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) &= (*j);
293 template <
typename Scalar>
295 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
301 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) &= scalar;
306 template <
typename Other>
310 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
312 typename Other::Iterator j = expr.
begin();
313 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) |= (*j);
318 template <
typename Scalar>
320 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
326 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) |= scalar;
331 template <
typename Other>
333 operator <<=(ExpressionBase<Other>
const & expr)
const {
335 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
337 typename Other::Iterator j = expr.begin();
338 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) <<= (*j);
343 template <
typename Scalar>
345 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
351 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) <<= scalar;
356 template <
typename Other>
360 == this->
getShape().template first<ExpressionBase<Other>::ND::value>());
362 typename Other::Iterator j = expr.
begin();
363 for (
Iterator i = this->
begin(); i != i_end; ++i, ++j) (*i) >>= (*j);
368 template <
typename Scalar>
370 typename boost::enable_if<boost::is_convertible<Scalar,T>,
ArrayRef const &>::type
376 for (
Iterator i = this->
begin(); i != i_end; ++i) (*i) >>= scalar;
382 template <
typename T_,
int N_,
int C_>
friend class Array;
383 template <
typename T_,
int N_,
int C_>
friend class ArrayRef;
395 #endif // !NDARRAY_ArrayRef_h_INCLUDED
A proxy class for Array with deep assignment operators.
ArrayRef(ArrayRef const &other)
Non-converting copy constructor.
ArrayRef const & operator=(Array< T, N, C > const &other) const
= assignment of arrays and array expressions.
Dimension-specialized traits shared by Array and ArrayRef.
ArrayRef const & operator%=(ExpressionBase< Other > const &expr) const
%= assignment of arrays and array expressions.
Index getShape() const
Return a Vector of the sizes of all dimensions.
ArrayRef const & operator|=(ExpressionBase< Other > const &expr) const
|= assignment of arrays and array expressions.
Traits::Iterator Iterator
Nested array or element iterator.
ArrayRef const & operator/=(ExpressionBase< Other > const &expr) const
/= assignment of arrays and array expressions.
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
ArrayRef const & operator&=(ExpressionBase< Other > const &expr) const
&= assignment of arrays and array expressions.
ArrayBaseN< ArrayRef > Super
Forward declarations and default template parameters for ndarray.
ArrayRef const & operator=(ArrayRef const &other) const
= assignment of arrays and array expressions.
#define NDARRAY_ASSERT(ARG)
Index getShape() const
Return a Vector of the sizes of all dimensions.
Definitions for ArrayAccess.
ArrayRef const & operator-=(ExpressionBase< Other > const &expr) const
-= assignment of arrays and array expressions.
An intermediate CRTP base class for Array and ArrayRef.
ArrayRef const & operator^=(ExpressionBase< Other > const &expr) const
^= assignment of arrays and array expressions.
ArrayRef(ArrayRef< T_, N, C_ > const &other)
Converting copy constructor.
ArrayRef(Array< T_, N, C_ > const &other)
Converting copy constructor.
CRTP implementation for Array and ArrayRef.
ArrayRef const & operator+=(ExpressionBase< Other > const &expr) const
+= assignment of arrays and array expressions.
Iterator begin() const
Return an Iterator to the beginning of the expression.
A multidimensional strided array.
Iterator end() const
Return an Iterator to one past the end of the array.
Iterator end() const
Return an Iterator to one past the end of the expression.
ArrayRef const & operator<<=(ExpressionBase< Other > const &expr) const
<<= assignment of arrays and array expressions.
ArrayRef const & operator>>=(ExpressionBase< Other > const &expr) const
>>= assignment of arrays and array expressions.
ArrayRef(T *data, CorePtr const &core)
Public interface for arbitrary views into arrays.
Definition of ArrayBaseN, a dimension-specialized CRTP base class for Array and ArrayRef.
ArrayRef const & operator*=(ExpressionBase< Other > const &expr) const
*= assignment of arrays and array expressions.
CRTP base class for all multidimensional expressions.
Iterator begin() const
Return an Iterator to the beginning of the array.