ndarray
NumPy-friendly multidimensional arrays in C++
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
ndarray::ArrayRef< T, N, C > Class Template Reference

A proxy class for Array with deep assignment operators. More...

#include <ArrayRef.h>

Inheritance diagram for ndarray::ArrayRef< T, N, C >:
ndarray::ArrayBaseN< ArrayRef< T, N, C > > ndarray::ArrayBase< Derived > ndarray::ExpressionBase< Derived >

Public Types

typedef Super::Iterator Iterator
 
- Public Types inherited from ndarray::ArrayBaseN< ArrayRef< T, N, C > >
typedef Super::Element Element
 
- Public Types inherited from ndarray::ArrayBase< Derived >
typedef Traits::Element Element
 Data type of array elements.
 
typedef Traits::Iterator Iterator
 Nested array or element iterator.
 
typedef Traits::Reference Reference
 Nested array or element reference.
 
typedef Traits::Value Value
 Nested array or element value type.
 
typedef Traits::ND ND
 Number of dimensions (boost::mpl::int_).
 
typedef Traits::RMC RMC
 Number of guaranteed row-major contiguous dimensions, counted from the end (boost::mpl::int_).
 
typedef Vector< Size, ND::value > Index
 Vector type for N-dimensional indices and shapes.
 
typedef Vector< Offset, ND::value > Strides
 Vector type for N-dimensional offsets and strides.
 
typedef ArrayRef< Element, ND::value,-RMC::value > FullTranspose
 ArrayRef to a reverse-ordered contiguous array; the result of a call to transpose().
 
typedef ArrayRef< Element, ND::value, 0 > Transpose
 ArrayRef to a noncontiguous array; the result of a call to transpose(...).
 
typedef Array< Element, ND::value, RMC::value > Shallow
 The corresponding Array type.
 
typedef ArrayRef< Element, ND::value, RMC::value > Deep
 The corresponding ArrayRef type.
 
- Public Types inherited from ndarray::ExpressionBase< Derived >
typedef ExpressionTraits< Derived >::Element Element
 Data type of expression elements.
 
typedef ExpressionTraits< Derived >::ND ND
 Number of dimensions (boost::mpl::int_).
 
typedef ExpressionTraits< Derived >::Iterator Iterator
 Nested expression or element iterator.
 
typedef ExpressionTraits< Derived >::Reference Reference
 Nested expression or element reference.
 
typedef ExpressionTraits< Derived >::Value Value
 Nested expression or element value type.
 
typedef Vector< Size, ND::value > Index
 Vector type for N-dimensional indices.
 
typedef Derived Self
 CRTP derived type.
 
typedef Value value_type
 
typedef Iterator iterator
 
typedef Iterator const_iterator
 
typedef Reference reference
 
typedef Reference const_reference
 
typedef Iterator pointer
 
typedef Offset difference_type
 
typedef Size size_type
 

Public Member Functions

 ArrayRef (Size n1, Size n2=1, Size n3=1, Size n4=1, Size n5=1, Size n6=1, Size n7=1, Size n8=1)
 Construct an array with the given dimensions and allocated but uninitialized memory.
 
template<typename U >
 ArrayRef (Vector< U, N > const &shape)
 Construct an array with the given dimensions and allocated but uninitialized memory.
 
 ArrayRef (ArrayRef const &other)
 Non-converting copy constructor.
 
template<typename T_ , int C_>
 ArrayRef (Array< T_, N, C_ > const &other, typename boost::enable_if< detail::Convertible< N, T_, C_, T, C >, void * >::type=0)
 Converting copy constructor.
 
template<typename T_ , int C_>
 ArrayRef (ArrayRef< T_, N, C_ > const &other, typename boost::enable_if< detail::Convertible< N, T_, C_, T, C >, void * >::type=0)
 Converting copy constructor.
 
Assignment and Augmented Assignment Operators

ArrayRef assignment is deep, and requires that the ArrayRef being assigned to has the same shape as the input array expression. Scalar assignment sets all elements of the ArrayRef to a single value.

ArrayRef const & operator= (Array< T, N, C > const &other) const
 
ArrayRef const & operator= (ArrayRef const &other) const
 
template<typename Other >
ArrayRef const & operator= (ExpressionBase< Other > const &expr) const
 = assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator= (Scalar const &scalar) const
 = assignment of scalars.
 
template<typename Other >
ArrayRef const & operator+= (ExpressionBase< Other > const &expr) const
 += assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator+= (Scalar const &scalar) const
 += assignment of scalars.
 
template<typename Other >
ArrayRef const & operator-= (ExpressionBase< Other > const &expr) const
 -= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator-= (Scalar const &scalar) const
 -= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator*= (ExpressionBase< Other > const &expr) const
 *= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator*= (Scalar const &scalar) const
 *= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator/= (ExpressionBase< Other > const &expr) const
 /= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator/= (Scalar const &scalar) const
 /= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator%= (ExpressionBase< Other > const &expr) const
 %= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator%= (Scalar const &scalar) const
 %= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator^= (ExpressionBase< Other > const &expr) const
 ^= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator^= (Scalar const &scalar) const
 ^= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator&= (ExpressionBase< Other > const &expr) const
 &= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator&= (Scalar const &scalar) const
 &= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator|= (ExpressionBase< Other > const &expr) const
 |= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator|= (Scalar const &scalar) const
 |= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator<<= (ExpressionBase< Other > const &expr) const
 <<= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator<<= (Scalar const &scalar) const
 <<= assignment of scalars.
 
template<typename Other >
ArrayRef const & operator>>= (ExpressionBase< Other > const &expr) const
 >>= assignment of arrays and array expressions.
 
template<typename Scalar >
boost::enable_if< boost::is_convertible< Scalar, T >, ArrayRefconst & >::type operator>>= (Scalar const &scalar) const
 >>= assignment of scalars.
 
- Public Member Functions inherited from ndarray::ArrayBase< Derived >
Reference operator[] (Size n) const
 Return a single subarray.
 
Elementoperator[] (Index const &i) const
 Return a single element from the array.
 
Iterator begin () const
 Return an Iterator to the beginning of the array.
 
Iterator end () const
 Return an Iterator to one past the end of the array.
 
ElementgetData () const
 Return a raw pointer to the first element of the array.
 
bool isEmpty () const
 Return true if the array has a null data point.
 
Manager::Ptr getManager () const
 Return the opaque object responsible for memory management.
 
template<int P>
Size getSize () const
 Return the size of a specific dimension.
 
template<int P>
Offset getStride () const
 Return the stride in a specific dimension.
 
Index getShape () const
 Return a Vector of the sizes of all dimensions.
 
Strides getStrides () const
 Return a Vector of the strides of all dimensions.
 
Size getNumElements () const
 Return the total number of elements in the array.
 
FullTranspose transpose () const
 Return a view of the array with the order of the dimensions reversed.
 
Transpose transpose (Index const &order) const
 Return a view of the array with the dimensions permuted.
 
Shallow const shallow () const
 Return a Array view to this.
 
Deep const deep () const
 Return an ArrayRef view to this.
 
template<typename Seq >
ResultOf< View< Seq > >::Type operator[] (View< Seq > const &def) const
 Return a general view into this array (see Tutorial).
 
- Public Member Functions inherited from ndarray::ExpressionBase< Derived >
Reference operator[] (Size n) const
 Return a single nested expression or element.
 
Reference front () const
 Return the first nested expression or element.
 
Reference back () const
 Return the last nested expression or element.
 
Iterator begin () const
 Return an Iterator to the beginning of the expression.
 
Iterator end () const
 Return an Iterator to one past the end of the expression.
 
template<int P>
Size getSize () const
 Return the size of a specific dimension.
 
Index getShape () const
 Return a Vector of the sizes of all dimensions.
 
Size getNumElements () const
 Return the total number of elements in the expression.
 
size_type size () const
 Return the size of the first dimension.
 
bool empty () const
 Return true if the first dimension has no elements.
 

Friends

template<typename T_ , int N_, int C_>
class Array
 
template<typename T_ , int N_, int C_>
struct ArrayTraits
 
template<typename Derived >
class ArrayBase
 
template<typename Array_ >
class detail::ArrayAccess
 

Additional Inherited Members

- Protected Types inherited from ndarray::ArrayBaseN< ArrayRef< T, N, C > >
typedef Super::Core Core
 
typedef Super::CorePtr CorePtr
 
- Protected Types inherited from ndarray::ArrayBase< Derived >
typedef ExpressionTraits< Derived > Traits
 
typedef Traits::Core Core
 
typedef Traits::CorePtr CorePtr
 
- Protected Member Functions inherited from ndarray::ArrayBase< Derived >
void operator= (ArrayBase const &other)
 
template<typename Other >
 ArrayBase (ArrayBase< Other > const &other)
 
 ArrayBase (Element *data, CorePtr const &core)
 
- Protected Member Functions inherited from ndarray::ExpressionBase< Derived >
SelfgetSelf ()
 
Self const & getSelf () const
 
- Protected Attributes inherited from ndarray::ArrayBase< Derived >
Element_data
 
CorePtr _core
 

Detailed Description

template<typename T, int N, int C>
class ndarray::ArrayRef< T, N, C >

A proxy class for Array with deep assignment operators.

Constructor & Destructor Documentation

◆ ArrayRef() [1/4]

template<typename T , int N, int C>
ndarray::ArrayRef< T, N, C >::ArrayRef ( Size  n1,
Size  n2 = 1,
Size  n3 = 1,
Size  n4 = 1,
Size  n5 = 1,
Size  n6 = 1,
Size  n7 = 1,
Size  n8 = 1 
)
explicit

Construct an array with the given dimensions and allocated but uninitialized memory.

Unspecified dimensions will have unit size, and if the number of argmuments is greater than the number of dimensions of the array, the extra arguments will be silently ignored.

This is implemented in initialization.h.

◆ ArrayRef() [2/4]

template<typename T , int N, int C>
template<typename U >
ndarray::ArrayRef< T, N, C >::ArrayRef ( Vector< U, N > const &  shape)
explicit

Construct an array with the given dimensions and allocated but uninitialized memory.

This is implemented in initialization.h.

◆ ArrayRef() [3/4]

template<typename T , int N, int C>
template<typename T_ , int C_>
ndarray::ArrayRef< T, N, C >::ArrayRef ( Array< T_, N, C_ > const &  other,
typename boost::enable_if< detail::Convertible< N, T_, C_, T, C >, void * >::type  = 0 
)
inlineexplicit

Converting copy constructor.

Implicit conversion is allowed for non-const to const and for more guaranteed RMC to less guaranteed RMC (see Tutorial).

◆ ArrayRef() [4/4]

template<typename T , int N, int C>
template<typename T_ , int C_>
ndarray::ArrayRef< T, N, C >::ArrayRef ( ArrayRef< T_, N, C_ > const &  other,
typename boost::enable_if< detail::Convertible< N, T_, C_, T, C >, void * >::type  = 0 
)
inline

Converting copy constructor.

Implicit conversion is allowed for non-const to const and for more guaranteed RMC to less guaranteed RMC (see Tutorial).


The documentation for this class was generated from the following files: