LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Types | Private Member Functions | Friends | List of all members
ndarray::Array< T, N, C > Class Template Reference

A multidimensional strided array. More...

#include <Array.h>

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

Public Member Functions

 Array ()
 Default constructor. More...
 
 Array (Array const &other)
 Non-converting copy constructor. More...
 
template<typename T_ , int C_>
 Array (Array< T_, N, C_ > const &other)
 Converting copy constructor. More...
 
template<typename T_ , int C_>
 Array (ArrayRef< T_, N, C_ > const &other)
 Converting copy constructor. More...
 
Arrayoperator= (Array const &other)
 Non-converting shallow assignment. More...
 
template<typename T_ , int C_>
Arrayoperator= (Array< T_, N, C_ > const &other)
 Converting shallow assignment. More...
 
template<typename T_ , int C_>
Arrayoperator= (ArrayRef< T_, N, C_ > const &other)
 Converting shallow assignment. More...
 
template<typename T_ , int N_, int C_>
bool operator== (Array< T_, N_, C_ > const &other) const
 Shallow equality comparison: return true if the arrays share data and have the same shape and strides. More...
 
template<typename T_ , int N_, int C_>
bool operator!= (Array< T_, N_, C_ > const &other) const
 Shallow inequality comparison. More...
 
void swap (Array &other)
 Lightweight shallow swap. More...
 
bool isUnique () const
 Return true if the Array is definitely unique. More...
 
- Public Member Functions inherited from ndarray::ArrayBase< Array< T, N, C > >
Reference operator[] (int n) const
 Return a single subarray. More...
 
Elementoperator[] (Index const &i) const
 Return a single element from the array. More...
 
ResultOf< View< Seq > >::Type operator[] (View< Seq > const &def) const
 Return a general view into this array (see Tutorial). More...
 
Iterator begin () const
 Return an Iterator to the beginning of the array. More...
 
Iterator end () const
 Return an Iterator to one past the end of the array. More...
 
ElementgetData () const
 Return a raw pointer to the first element of the array. More...
 
bool isEmpty () const
 Return true if the array has a null data point. More...
 
Manager::Ptr getManager () const
 Return the opaque object responsible for memory management. More...
 
int getSize () const
 Return the size of a specific dimension. More...
 
int getStride () const
 Return the stride in a specific dimension. More...
 
Index getShape () const
 Return a Vector of the sizes of all dimensions. More...
 
Index getStrides () const
 Return a Vector of the strides of all dimensions. More...
 
int getNumElements () const
 Return the total number of elements in the array. More...
 
FullTranspose transpose () const
 Return a view of the array with the order of the dimensions reversed. More...
 
Transpose transpose (Index const &order) const
 Return a view of the array with the dimensions permuted. More...
 
Shallow const shallow () const
 Return a Array view to this. More...
 
Deep const deep () const
 Return an ArrayRef view to this. More...
 
EigenView< Element, ND::value,
RMC::value, XprKind, Rows,
Cols > 
asEigen () const
 
EigenView< Element, ND::value,
RMC::value, XprKind > 
asEigen () const
 
EigenView< Element, ND::value,
RMC::value, Eigen::MatrixXpr,
Rows, Cols > 
asEigen () const
 
EigenView< Element, ND::value,
RMC::value, Eigen::MatrixXpr > 
asEigen () const
 
- Public Member Functions inherited from ndarray::ExpressionBase< Derived >
Reference operator[] (int n) const
 Return a single nested expression or element. More...
 
Reference front () const
 Return the first nested expression or element. More...
 
Reference back () const
 Return the last nested expression or element. More...
 
Iterator begin () const
 Return an Iterator to the beginning of the expression. More...
 
Iterator end () const
 Return an Iterator to one past the end of the expression. More...
 
template<int P>
int getSize () const
 Return the size of a specific dimension. More...
 
Index getShape () const
 Return a Vector of the sizes of all dimensions. More...
 
int getNumElements () const
 Return the total number of elements in the expression. More...
 
size_type size () const
 Return the size of the first dimension. More...
 
bool empty () const
 Return true if the first dimension has no elements. More...
 

Private Types

typedef ArrayBaseN< ArraySuper
 
typedef Super::Core Core
 
typedef Super::CorePtr CorePtr
 

Private Member Functions

 Array (T *data, CorePtr const &core)
 

Friends

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

Additional Inherited Members

- Public Types inherited from ndarray::ArrayBaseN< Array< T, N, C > >
typedef Super::Element Element
 
- Public Types inherited from ndarray::ArrayBase< Array< T, N, C > >
typedef Traits::Element Element
 Data type of array elements. More...
 
typedef Traits::Iterator Iterator
 Nested array or element iterator. More...
 
typedef Traits::Reference Reference
 Nested array or element reference. More...
 
typedef Traits::Value Value
 Nested array or element value type. More...
 
typedef Traits::ND ND
 Number of dimensions (boost::mpl::int_). More...
 
typedef Traits::RMC RMC
 Number of guaranteed row-major contiguous dimensions, counted from the end (boost::mpl::int_). More...
 
typedef Vector< int, ND::value > Index
 Vector type for N-dimensional indices. More...
 
typedef ArrayRef< Element,
ND::value,-RMC::value > 
FullTranspose
 ArrayRef to a reverse-ordered contiguous array; the result of a call to transpose(). More...
 
typedef ArrayRef< Element,
ND::value, 0 > 
Transpose
 ArrayRef to a noncontiguous array; the result of a call to transpose(...). More...
 
typedef Array< Element,
ND::value, RMC::value > 
Shallow
 The corresponding Array type. More...
 
typedef ArrayRef< Element,
ND::value, RMC::value > 
Deep
 The corresponding ArrayRef type. More...
 
- Public Types inherited from ndarray::ExpressionBase< Derived >
typedef ExpressionTraits
< Derived >::Element 
Element
 Data type of expression elements. More...
 
typedef ExpressionTraits
< Derived >::ND 
ND
 Number of dimensions (boost::mpl::int_). More...
 
typedef ExpressionTraits
< Derived >::Iterator 
Iterator
 Nested expression or element iterator. More...
 
typedef ExpressionTraits
< Derived >::Reference 
Reference
 Nested expression or element reference. More...
 
typedef ExpressionTraits
< Derived >::Value 
Value
 Nested expression or element value type. More...
 
typedef Vector< int, ND::value > Index
 Vector type for N-dimensional indices. More...
 
typedef Derived Self
 CRTP derived type. More...
 
typedef Value value_type
 
typedef Iterator iterator
 
typedef Iterator const_iterator
 
typedef Reference reference
 
typedef Reference const_reference
 
typedef Iterator pointer
 
typedef int difference_type
 
typedef int size_type
 
- Protected Types inherited from ndarray::ArrayBaseN< Array< T, N, C > >
typedef Super::Core Core
 
typedef Super::CorePtr CorePtr
 
- Protected Types inherited from ndarray::ArrayBase< Array< T, N, C > >
typedef ExpressionTraits
< Array< T, N, C > > 
Traits
 
typedef Traits::Core Core
 
typedef Traits::CorePtr CorePtr
 
- Protected Member Functions inherited from ndarray::ArrayBase< Array< T, N, C > >
 ArrayBase (Element *data, CorePtr const &core)
 
void operator= (ArrayBase const &other)
 
- Protected Member Functions inherited from ndarray::ExpressionBase< Derived >
SelfgetSelf ()
 
Self const & getSelf () const
 
- Protected Attributes inherited from ndarray::ArrayBase< Array< T, N, C > >
Element_data
 
CorePtr _core
 

Detailed Description

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

A multidimensional strided array.

Array is the workhorse class of the ndarray library.

Definition at line 47 of file Array.h.

Member Typedef Documentation

template<typename T, int N, int C>
typedef Super::Core ndarray::Array< T, N, C >::Core
private

Definition at line 49 of file Array.h.

template<typename T, int N, int C>
typedef Super::CorePtr ndarray::Array< T, N, C >::CorePtr
private

Definition at line 50 of file Array.h.

template<typename T, int N, int C>
typedef ArrayBaseN<Array> ndarray::Array< T, N, C >::Super
private

Definition at line 48 of file Array.h.

Constructor & Destructor Documentation

template<typename T, int N, int C>
ndarray::Array< T, N, C >::Array ( )
inline

Default constructor.

Creates an empty array with zero dimensions and null memory.

Definition at line 58 of file Array.h.

58 : Super(0, Core::create()) {}
ArrayBaseN< Array > Super
Definition: Array.h:48
template<typename T, int N, int C>
ndarray::Array< T, N, C >::Array ( Array< T, N, C > const &  other)
inline

Non-converting copy constructor.

Definition at line 63 of file Array.h.

63 : Super(other._data, other._core) {}
ArrayBaseN< Array > Super
Definition: Array.h:48
template<typename T, int N, int C>
template<typename T_ , int C_>
ndarray::Array< T, N, C >::Array ( Array< T_, N, C_ > const &  other)
inline

Converting copy constructor.

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

Definition at line 72 of file Array.h.

77  : Super(other._data, other._core) {}
ArrayBaseN< Array > Super
Definition: Array.h:48
template<typename T, int N, int C>
template<typename T_ , int C_>
ndarray::Array< T, N, C >::Array ( ArrayRef< T_, N, C_ > const &  other)
inline

Converting copy constructor.

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

Definition at line 86 of file Array.h.

91  : Super(other._data, other._core) {}
ArrayBaseN< Array > Super
Definition: Array.h:48
template<typename T, int N, int C>
ndarray::Array< T, N, C >::Array ( T *  data,
CorePtr const &  core 
)
inlineprivate

Definition at line 182 of file Array.h.

182 : Super(data, core) {}
ArrayBaseN< Array > Super
Definition: Array.h:48

Member Function Documentation

template<typename T, int N, int C>
bool ndarray::Array< T, N, C >::isUnique ( ) const
inline

Return true if the Array is definitely unique.

This will only return true if the manager overrides Manager::isUnique(); this is true for the SimpleManager used by ndarray::allocate, but it is not true for ExternalManager.

Definition at line 172 of file Array.h.

172 { return this->_core->isUnique(); }
template<typename T, int N, int C>
template<typename T_ , int N_, int C_>
bool ndarray::Array< T, N, C >::operator!= ( Array< T_, N_, C_ > const &  other) const
inline

Shallow inequality comparison.

Definition at line 155 of file Array.h.

155  {
156  return !this->operator==(other);
157  }
bool operator==(Array< T_, N_, C_ > const &other) const
Shallow equality comparison: return true if the arrays share data and have the same shape and strides...
Definition: Array.h:145
template<typename T, int N, int C>
Array& ndarray::Array< T, N, C >::operator= ( Array< T, N, C > const &  other)
inline

Non-converting shallow assignment.

Definition at line 96 of file Array.h.

96  {
97  if (&other != this) {
98  this->_data = other._data;
99  this->_core = other._core;
100  }
101  return *this;
102  }
template<typename T, int N, int C>
template<typename T_ , int C_>
Array& ndarray::Array< T, N, C >::operator= ( Array< T_, N, C_ > const &  other)
inline

Converting shallow assignment.

Implicit conversion is allowed for non-const -> const and for more guaranteed RMC -> less guaranteed RMC (see LSST Documentation).

Definition at line 116 of file Array.h.

116  {
117  this->_data = other._data;
118  this->_core = other._core;
119  return *this;
120  }
template<typename T, int N, int C>
template<typename T_ , int C_>
Array& ndarray::Array< T, N, C >::operator= ( ArrayRef< T_, N, C_ > const &  other)
inline

Converting shallow assignment.

Implicit conversion is allowed for non-const -> const and for more guaranteed RMC -> less guaranteed RMC (see LSST Documentation).

Definition at line 134 of file Array.h.

134  {
135  this->_data = other._data;
136  this->_core = other._core;
137  return *this;
138  }
template<typename T, int N, int C>
template<typename T_ , int N_, int C_>
bool ndarray::Array< T, N, C >::operator== ( Array< T_, N_, C_ > const &  other) const
inline

Shallow equality comparison: return true if the arrays share data and have the same shape and strides.

Definition at line 145 of file Array.h.

145  {
146  return this->getData() == other.getData()
147  && this->getShape() == other.getShape()
148  && this->getStrides() == other.getStrides();
149  }
Index getStrides() const
Return a Vector of the strides of all dimensions.
Definition: ArrayBase.h:139
Index getShape() const
Return a Vector of the sizes of all dimensions.
Definition: ArrayBase.h:136
Element * getData() const
Return a raw pointer to the first element of the array.
Definition: ArrayBase.h:117
template<typename T, int N, int C>
void ndarray::Array< T, N, C >::swap ( Array< T, N, C > &  other)
inline

Lightweight shallow swap.

Definition at line 160 of file Array.h.

160  {
161  std::swap(this->_data, other._data);
162  this->_core.swap(other._core);
163  }
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291

Friends And Related Function Documentation

template<typename T, int N, int C>
template<typename T_ , int N_, int C_>
friend class Array
friend

Definition at line 175 of file Array.h.

template<typename T, int N, int C>
template<typename Derived >
friend class ArrayBase
friend

Definition at line 178 of file Array.h.

template<typename T, int N, int C>
template<typename T_ , int N_, int C_>
friend class ArrayRef
friend

Definition at line 176 of file Array.h.

template<typename T, int N, int C>
template<typename T_ , int N_, int C_>
friend struct ArrayTraits
friend

Definition at line 177 of file Array.h.

template<typename T, int N, int C>
template<typename Array_ >
friend class detail::ArrayAccess
friend

Definition at line 179 of file Array.h.


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