23 #ifndef NDARRAY_initialization_h_INCLUDED
24 #define NDARRAY_initialization_h_INCLUDED
38 template <
int N,
typename Derived>
42 template <
typename T,
int C>
44 return static_cast<Derived
const *
>(
this)->
template apply<
Array<T,N,C> >();
47 template <
typename T,
int C>
49 return static_cast<Derived
const *
>(
this)->
template apply<
ArrayRef<T,N,C> >();
58 template <
typename Target>
61 typedef typename Access::Core
Core;
62 typedef typename Access::Element Element;
75 template <
typename T,
int N,
typename Owner>
79 template <
typename Target>
82 typedef typename Access::Core
Core;
84 if (!boost::is_same<Owner,NullOwner>::value) {
149 template <
typename Derived>
150 inline ArrayRef<typename boost::remove_const<typename Derived::Element>::type,
151 Derived::ND::value, Derived::ND::value>
154 Derived::ND::value,Derived::ND::value> r(
166 for (
int n=N-1; n > 0; --n) r[n-1] = r[n] * shape[n];
168 for (
int n=1; n < N; ++n) r[n] = r[n-1] * shape[n-1];
186 template <
typename T,
int N,
typename Owner>
208 template <
typename T,
int N>
230 template <
typename T,
int N,
typename Owner>
252 template <
typename T,
int N>
267 #endif // !NDARRAY_initialization_h_INCLUDED
ExternalInitializer(T *data, Vector< int, N > const &shape, Vector< int, N > const &strides, Owner const &owner)
A proxy class for Array with deep assignment operators.
static Ptr create(Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager=Manager::Ptr())
Create a Core::Ptr with the given shape, strides, and manager.
Vector< int, N > computeStrides(Vector< int, N > const &shape, DataOrderEnum order=ROW_MAJOR)
Compute row- or column-major strides for the given shape.
Index getShape() const
Return a Vector of the sizes of all dimensions.
detail::ExternalInitializer< T, N, Owner > external(T *data, Vector< int, N > const &shape, Vector< int, N > const &strides, Owner const &owner)
Create an expression that initializes an Array with externally allocated memory.
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition of Manager, which manages the ownership of array data.
T product() const
Return the product of all elements.
boost::intrusive_ptr< Manager > Ptr
Vector< T, N > makeVector(T v1, T v2,..., T vN)
Variadic constructor for Vector.
Vector< int, N > _strides
Vector< T, M > first() const
Create a new Vector from the first M elements of this.
detail::SimpleInitializer< N > allocate(Vector< int, N > const &shape)
Create an expression that allocates uninitialized memory for an array.
DataOrderEnum
An enumeration for stride computation.
A multidimensional strided array.
static std::pair< Manager::Ptr, T * > allocate(int size)
Manager::Ptr makeManager(T const &owner)
CRTP base class for all multidimensional expressions.
SimpleInitializer(Vector< int, N > const &shape)