LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ndarray::detail::Core< N > Class Template Reference

#include <Core.h>

Public Types

typedef boost::mpl::int_< N > ND
 number of dimensions More...
 
typedef Core< N-1 > Super
 base class More...
 
typedef boost::intrusive_ptr
< Core
Ptr
 intrusive_ptr to Core More...
 
typedef boost::intrusive_ptr
< Core const > 
ConstPtr
 const intrusive_ptr to Core More...
 

Public Member Functions

Ptr copy () const
 
int getSize () const
 Return the size of the Nth dimension. More...
 
int getStride () const
 Return the stride of the Nth dimension. More...
 
void setSize (int size)
 Set the size of the Nth dimension. More...
 
void setStride (int stride)
 Set the stride of the Nth dimension. More...
 
template<int M>
int computeOffset (Vector< int, M > const &index) const
 Recursively compute the offset to an element. More...
 
template<int M>
void fillShape (Vector< int, M > &shape) const
 Recursively fill a shape vector. More...
 
template<int M>
void fillStrides (Vector< int, M > &strides) const
 Recursively fill a strides vector. More...
 
int getNumElements () const
 Recursively determine the total number of elements. More...
 

Static Public Member Functions

template<int M>
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. More...
 
template<int M>
static Ptr create (Vector< int, M > const &shape, DataOrderEnum order, Manager::Ptr const &manager=Manager::Ptr())
 Create a Core::Ptr with the given shape and manager with contiguous strides. More...
 
static Ptr create (Manager::Ptr const &manager=Manager::Ptr())
 Create a Core::Ptr with the given manager and zero shape and strides. More...
 

Protected Member Functions

template<int M>
 Core (Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager)
 
template<int M>
 Core (Vector< int, M > const &shape, Manager::Ptr const &manager)
 
template<int M>
 Core (Vector< int, M > const &shape, int stride, Manager::Ptr const &manager)
 
 Core (Manager::Ptr const &manager)
 
 Core (Core const &other)
 

Private Attributes

int _size
 
int _stride
 

Detailed Description

template<int N>
class ndarray::detail::Core< N >

Definition at line 59 of file Core.h.

Member Typedef Documentation

template<int N>
typedef boost::intrusive_ptr<Core const> ndarray::detail::Core< N >::ConstPtr

const intrusive_ptr to Core

Definition at line 64 of file Core.h.

template<int N>
typedef boost::mpl::int_<N> ndarray::detail::Core< N >::ND

number of dimensions

Definition at line 61 of file Core.h.

template<int N>
typedef boost::intrusive_ptr<Core> ndarray::detail::Core< N >::Ptr

intrusive_ptr to Core

Definition at line 63 of file Core.h.

template<int N>
typedef Core<N-1> ndarray::detail::Core< N >::Super

base class

Definition at line 62 of file Core.h.

Constructor & Destructor Documentation

template<int N>
template<int M>
ndarray::detail::Core< N >::Core ( Vector< int, M > const &  shape,
Vector< int, M > const &  strides,
Manager::Ptr const &  manager 
)
inlineprotected

Definition at line 140 of file Core.h.

144  : Super(shape, strides, manager), _size(shape[M-N]), _stride(strides[M-N]) {}
Core< N-1 > Super
base class
Definition: Core.h:62
template<int N>
template<int M>
ndarray::detail::Core< N >::Core ( Vector< int, M > const &  shape,
Manager::Ptr const &  manager 
)
inlineprotected

Definition at line 148 of file Core.h.

151  : Super(shape, manager), _size(shape[M-N]), _stride(Super::getStride() * Super::getSize()) {}
int getStride() const
Return the stride of the Nth dimension.
Definition: Core.h:103
int getSize() const
Return the size of the Nth dimension.
Definition: Core.h:100
Core< N-1 > Super
base class
Definition: Core.h:62
template<int N>
template<int M>
ndarray::detail::Core< N >::Core ( Vector< int, M > const &  shape,
int  stride,
Manager::Ptr const &  manager 
)
inlineprotected

Definition at line 155 of file Core.h.

159  : Super(shape, stride * shape[M-N], manager), _size(shape[M-N]), _stride(stride) {}
Core< N-1 > Super
base class
Definition: Core.h:62
template<int N>
ndarray::detail::Core< N >::Core ( Manager::Ptr const &  manager)
inlineprotected

Definition at line 162 of file Core.h.

164  : Super(manager), _size(0), _stride(0) {}
Core< N-1 > Super
base class
Definition: Core.h:62
template<int N>
ndarray::detail::Core< N >::Core ( Core< N > const &  other)
inlineprotected

Definition at line 166 of file Core.h.

166 : Super(other), _size(other._size), _stride(other._stride) {}
Core< N-1 > Super
base class
Definition: Core.h:62

Member Function Documentation

template<int N>
template<int M>
int ndarray::detail::Core< N >::computeOffset ( Vector< int, M > const &  index) const
inline

Recursively compute the offset to an element.

Definition at line 113 of file Core.h.

113  {
114  return index[M-N] * this->getStride() + Super::computeOffset(index);
115  }
int getStride() const
Return the stride of the Nth dimension.
Definition: Core.h:103
int computeOffset(Vector< int, M > const &index) const
Recursively compute the offset to an element.
Definition: Core.h:113
template<int N>
Ptr ndarray::detail::Core< N >::copy ( ) const
inline

Definition at line 97 of file Core.h.

97 { return Ptr(new Core(*this)); }
boost::intrusive_ptr< Core > Ptr
intrusive_ptr to Core
Definition: Core.h:63
Core(Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager)
Definition: Core.h:140
template<int N>
template<int M>
static Ptr ndarray::detail::Core< N >::create ( Vector< int, M > const &  shape,
Vector< int, M > const &  strides,
Manager::Ptr const &  manager = Manager::Ptr() 
)
inlinestatic

Create a Core::Ptr with the given shape, strides, and manager.

Definition at line 68 of file Core.h.

72  {
73  return Ptr(new Core(shape, strides, manager), false);
74  }
boost::intrusive_ptr< Core > Ptr
intrusive_ptr to Core
Definition: Core.h:63
Core(Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager)
Definition: Core.h:140
template<int N>
template<int M>
static Ptr ndarray::detail::Core< N >::create ( Vector< int, M > const &  shape,
DataOrderEnum  order,
Manager::Ptr const &  manager = Manager::Ptr() 
)
inlinestatic

Create a Core::Ptr with the given shape and manager with contiguous strides.

Definition at line 78 of file Core.h.

82  {
83  if (order == ROW_MAJOR) {
84  return Ptr(new Core(shape, manager), false);
85  } else {
86  return Ptr(new Core(shape, 1, manager), false);
87  }
88  }
boost::intrusive_ptr< Core > Ptr
intrusive_ptr to Core
Definition: Core.h:63
Core(Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager)
Definition: Core.h:140
template<int N>
static Ptr ndarray::detail::Core< N >::create ( Manager::Ptr const &  manager = Manager::Ptr())
inlinestatic

Create a Core::Ptr with the given manager and zero shape and strides.

Definition at line 91 of file Core.h.

93  {
94  return Ptr(new Core(manager), false);
95  }
boost::intrusive_ptr< Core > Ptr
intrusive_ptr to Core
Definition: Core.h:63
Core(Vector< int, M > const &shape, Vector< int, M > const &strides, Manager::Ptr const &manager)
Definition: Core.h:140
template<int N>
template<int M>
void ndarray::detail::Core< N >::fillShape ( Vector< int, M > &  shape) const
inline

Recursively fill a shape vector.

Definition at line 119 of file Core.h.

119  {
120  shape[M-N] = this->getSize();
121  Super::fillShape(shape);
122  }
int getSize() const
Return the size of the Nth dimension.
Definition: Core.h:100
void fillShape(Vector< int, M > &shape) const
Recursively fill a shape vector.
Definition: Core.h:119
template<int N>
template<int M>
void ndarray::detail::Core< N >::fillStrides ( Vector< int, M > &  strides) const
inline

Recursively fill a strides vector.

Definition at line 126 of file Core.h.

126  {
127  strides[M-N] = this->getStride();
128  Super::fillStrides(strides);
129  }
int getStride() const
Return the stride of the Nth dimension.
Definition: Core.h:103
void fillStrides(Vector< int, M > &strides) const
Recursively fill a strides vector.
Definition: Core.h:126
template<int N>
int ndarray::detail::Core< N >::getNumElements ( ) const
inline

Recursively determine the total number of elements.

Definition at line 132 of file Core.h.

132  {
133  return getSize() * Super::getNumElements();
134  }
int getNumElements() const
Recursively determine the total number of elements.
Definition: Core.h:132
int getSize() const
Return the size of the Nth dimension.
Definition: Core.h:100
template<int N>
int ndarray::detail::Core< N >::getSize ( ) const
inline

Return the size of the Nth dimension.

Definition at line 100 of file Core.h.

100 { return _size; }
template<int N>
int ndarray::detail::Core< N >::getStride ( ) const
inline

Return the stride of the Nth dimension.

Definition at line 103 of file Core.h.

103 { return _stride; }
template<int N>
void ndarray::detail::Core< N >::setSize ( int  size)
inline

Set the size of the Nth dimension.

Definition at line 106 of file Core.h.

106 { _size = size; }
template<int N>
void ndarray::detail::Core< N >::setStride ( int  stride)
inline

Set the stride of the Nth dimension.

Definition at line 109 of file Core.h.

109 { _stride = stride; }

Member Data Documentation

template<int N>
int ndarray::detail::Core< N >::_size
private

Definition at line 169 of file Core.h.

template<int N>
int ndarray::detail::Core< N >::_stride
private

Definition at line 170 of file Core.h.


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