ndarray< ElemType, NDim > Class Template Reference
[Ndarray]

N-dimensional array class. More...

#include <ndarray.h>

Inheritance diagram for ndarray< ElemType, NDim >:

ndarray_details::nd_elem_access< ElemType, NDim > ndarray_details::nd_data< ElemType, NDim > List of all members.

Public Types

typedef ElemType element
typedef elementiterator
typedef std::reverse_iterator<
iterator
reverse_iterator
typedef size_t size_type
typedef unsigned shape_t
typedef int stride_t
typedef ndarray< typename
ndarray_details::unconst <
ElemType >::type, NDim > 
nonconst_ndarray

Public Member Functions

 ndarray ()
 Default constructor makes an empty array.
 ndarray (ElemType *data, const shape_t *shape, ndns::Order order=ndns::C)
 Constructor that takes pointer to data and shape.
 ndarray (const boost::shared_ptr< ElemType > &data, const shape_t *shape, ndns::Order order=ndns::C)
 Constructor that takes shared pointer to data and shape array.
 ndarray (const shape_t *shape, ndns::Order order=ndns::C)
 Constructor that takes shape array and allocates necessary space for data.
 ndarray (const ndarray_details::nd_elem_access_pxy< ElemType, NDim > &pxy)
 Constructor from nd_elem_access_pxy instance.
 ndarray (const nonconst_ndarray &other)
 Copy constructor from other ndarray.
ndarrayoperator= (const nonconst_ndarray &other)
 Assignment operator, data is never copied.
ndarrayoperator= (const ndarray_details::nd_elem_access_pxy< ElemType, NDim > &pxy)
 Assignment from nd_elem_access_pxy.
elementat (shape_t index[]) const
 Array element access.
elementdata () const
const shape_tshape () const
 Returns shape of the array.
const stride_tstrides () const
 Returns array strides.
void strides (const stride_t *strides)
 Changes strides.
void reshape (const shape_t *shape, ndns::Order order=ndns::C)
 Changes the shape of the array.
size_type size () const
 Returns total number of elements in array.
bool empty () const
 Returns true if array has no data.
iterator begin () const
 Returns iterator to the beginning of data, iteration is performed in memory order.
iterator end () const
 Returns iterator to the end of data.
reverse_iterator rbegin () const
 Returns reverse iterators.
reverse_iterator rend () const
void swap (ndarray &other)
 swap contents of two arrays
nonconst_ndarray copy () const

Protected Member Functions

void _setStrides (ndns::Order order)

Detailed Description

template<typename ElemType, unsigned NDim>
class ndarray< ElemType, NDim >

N-dimensional array class.

Ndarray (short for N-dimensional array) class provides high-level C++ interface for multi-dimensional array data. This is a class template with two parameters - element type and array rank. Array dimensionality (rank) is fixed at compile time and cannot change. Actual dimensions and size of array are dynamic and can change (for example in assignment).

The type of the array elements is determined by the first template argument and it can be any regular C++ type of fixed size. There is a distinction between const and non-const template arguments. If non-const type is used for template argument (such as ndarray<int,2>) then the resulting ndarray is a modifiable object, one could use its methods to get access to array elements and modify them (through non-const references or pointers). On the other hand if template argument is a const type (e.g. ndarray<const int,2>) then array is non-modifiable, it only returns const pointers and references to the data which cannot be used to modify the data.

There are two essential characteristics of every array - array shape and strides. Array shape defines the size of every dimension of the array; shape is itself a 1-dimensional array of size NDim (ndarray rank). Shape of the array is set in the constructor and can be queried with shape() method. Strides define memory layout of the array data. By default (if you do not provide strides in constructor) ndarray assumes C-type memory layout (last index changes fastest) and calculates appropriate strides itself. One can provide non-standard strides for different (even disjoint) memory layouts. ndarray uses strides to calculate element offset w.r.t. first element of the array. For example for 3-dimensional array it finds an element as:

    ndarr[i][j][k] = *(data + i*stride[0] + j*stride[1] * k*stride[2])

where data is a pointer to first array element. For C-type memory layout strides array is calculated from shape array as:

    strides[NDim-1] = 1;
    for (i = NDim-1 .. 1) strides[i-1] = strides[i]*shape[i];

One can query the strides array with the strides() method which returns a pointer to the 1-dimensional array of NDim size.

Ndarray can be used to either provide access to the already existing data (which are not in the form of the ndarray), or to create new objects with newly allocated memory for array data. Ndarray transparently supports memory management of the data area, in most cases one should not care about how memory is allocated or deallocated. There are few different ways to construct ndarray instances which determine how ndarray manages its corresponding data:

1. from raw pointers:

     int* ptr = new int[100*100];
     unsigned int shape[2] = {100, 100};
     ndarray<int,2> array(ptr, shape);
     //or
     ndarray<int,2> array = make_ndarray(ptr, 100, 100);

In this case ndarray does not do anything special with the pointer that is passed to it, it is responsibility of the client code to make sure that memory is correctly deallocated if necessary and deallocation happens only after the last copy of ndarray is destroyed. Because of the potential problems it is not recommended anymore to make ndarrays from raw pointers.

2. internal memory allocation:

     unsigned int shape[2] = {100, 100};
     ndarray<int,2> array(shape);
     // or
     ndarray<int,2> array = make_ndarray<int>(100, 100);

In this case constructor allocates necessary space to hold array data. This space is automatically deallocated when the last copy of the ndarray pointing to that array data is destroyed. This is a preferred way to make ndarrays if you need to allocate new memory for your data.

3. from shared pointer (for advanced users):

     boost::shared_ptr<int> data = ...;
     unsigned int shape[2] = {100, 100}
     ndarray<int,2> array(data, shape);
     // or
     ndarray<int,2> array = make_ndarray(data, 100, 100);

In this case shared pointer defines memory management policy for the data, ndarray copies this pointers and shares array data through this pointer with all other clients. The memory will be deallocated (if necessary) when last copy of shared pointer disappears (including all copies in ndarray instances). Note that creating shared pointer for array data needs special care. One cannot just say:

     // DO NOT DO THIS, BAD THINGS WILL HAPPEN!
     boost::shared_ptr<int> data(new int[100*100]);
as this will cause incorrect operator new be called when data is going to be deallocated. Special deleter object (or different way of constructing) is needed in this case, check boost.shared_ptr documentation.

The main method of accessing array elements is a traditional C-like square bracket syntax:

    ndarray<int, 3> ndarr(...);
    int elem = ndarr[i][j][k];

Alternatively if the array indices are located in an array one can use at() method:

    ndarray<int, 3> ndarr(...);
    unsigned idx[3] = {i, j, k};
    int elem = ndarr.at(idx);

One can modify elements of the array if array template type is non-const:

    ndarray<int, 3> ndarr(...);
    ndarr[i][j][k] = 1000;

Additionally ndarray class provides STL-compatible iterators and usual methods begin(), end(), rbegin(), rend(). The iterators can be used with many standard algorithm. Note that iterators always scan for elements in the memory order from first (data()) to last (data()+size()) array element (iterators do not use strides and do not work with disjoint array memory).

Method size() returns the total number of elements in array.

Regular ndarray constructor take shape array (and optionally strides array). It is not always convenient to pass array dimensions as array elements. Few additional functions are provided which construct ndarray from dimensions provided via regular arguments, here are few examples of their use:

    // Create 1-dim array of size 1048576
    int* data = ...;
    ndarray<int, 1> arr2d = make_ndarray(data, 1048576);

    // Create 2-dim array of dimensions 1024x1024, allocate space for it
    ndarray<int, 2> arr2d = make_ndarray<int>(1024, 1024);

    // Create 3-dim array of dimensions 4x512x512 from shared pointer
    boost::shared_ptr<int> shptr = ...;
    ndarray<int, 3> arr2d = make_ndarray(shptr, 4, 512, 512);

    // Create non-modifiable array from constant data
    const int* cdata = ...;
    ndarray<const int, 1> arr2d = make_ndarray(cdata, 1048576);

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
Id
ndarray.h 6652 2013-08-13 18:19:30Z salnikov@SLAC.STANFORD.EDU
Author:
Andy Salnikov

Definition at line 254 of file ndarray.h.


Member Typedef Documentation

template<typename ElemType, unsigned NDim>
typedef ElemType ndarray< ElemType, NDim >::element

Definition at line 258 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef element* ndarray< ElemType, NDim >::iterator

Definition at line 259 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef ndarray<typename ndarray_details::unconst<ElemType>::type, NDim> ndarray< ElemType, NDim >::nonconst_ndarray

Definition at line 264 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef std::reverse_iterator<iterator> ndarray< ElemType, NDim >::reverse_iterator

Definition at line 260 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef unsigned ndarray< ElemType, NDim >::shape_t

Reimplemented from ndarray_details::nd_data< ElemType, NDim >.

Definition at line 262 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef size_t ndarray< ElemType, NDim >::size_type

Definition at line 261 of file ndarray.h.

template<typename ElemType, unsigned NDim>
typedef int ndarray< ElemType, NDim >::stride_t

Reimplemented from ndarray_details::nd_data< ElemType, NDim >.

Definition at line 263 of file ndarray.h.


Constructor & Destructor Documentation

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray (  )  [inline]

Default constructor makes an empty array.

Definition at line 267 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray ( ElemType *  data,
const shape_t shape,
ndns::Order  order = ndns::C 
) [inline]

Constructor that takes pointer to data and shape.

Optional third argument defines memory order of the elements, default is to assume C order (last index changes fastest). This argument determines how strides are calculated, strides can be changed later with strides() method.

Parameters:
[in] data Pointer to data array
[in] shape Pointer to dimensions array, size of array is NDim, array data will be copied.
[in] order Memory order of the elements.

Definition at line 280 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray ( const boost::shared_ptr< ElemType > &  data,
const shape_t shape,
ndns::Order  order = ndns::C 
) [inline]

Constructor that takes shared pointer to data and shape array.

Optional third argument defines memory order of the elements, default is to assume C order (last index changes fastest). This argument determines how strides are calculated, strides can be changed later with strides() method.

Parameters:
[in] data Pointer to data array
[in] shape Pointer to dimensions array, size of array is NDim, array data will be copied.
[in] order Memory order of the elements.

Definition at line 298 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray ( const shape_t shape,
ndns::Order  order = ndns::C 
) [inline]

Constructor that takes shape array and allocates necessary space for data.

After allocation the data in array is not initialized and will contain garbage. Optional second argument defines memory order of the elements, default is to assume C order (last index changes fastest). This argument determines how strides are calculated, strides can be changed later with strides() method.

Parameters:
[in] shape Pointer to dimensions array, size of array is NDim, array data will be copied.
[in] order Memory order of the elements.

Definition at line 316 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray ( const ndarray_details::nd_elem_access_pxy< ElemType, NDim > &  pxy  )  [inline]

Constructor from nd_elem_access_pxy instance.

This constructor is used for slicing of the original ndarray, proxy is returned from operator[] and you can make ndarray which is a slice of the original array from that proxy object. Both original array and this new instance will share the data.

Definition at line 331 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray< ElemType, NDim >::ndarray ( const nonconst_ndarray< ElemType, NDim > &  other  )  [inline]

Copy constructor from other ndarray.

If the template argument (ElemType) is a const type (like const int then this constructor makes const ndarray from non-const, so for example one can write code which converts non-const array to const:

  ndarray<int,3> arr1 = ...;
  ndarray<const int,3> arr2(arr1);

If template argument (ElemType) is non-const type then this is a regular copy constructor. It does not actually copy array data, in both cases data is shared between original array and new instance.

Definition at line 354 of file ndarray.h.


Member Function Documentation

template<typename ElemType, unsigned NDim>
void ndarray< ElemType, NDim >::_setStrides ( ndns::Order  order  )  [inline, protected]

Definition at line 479 of file ndarray.h.

Referenced by ndarray< uint32_t, 3 >::ndarray(), and ndarray< uint32_t, 3 >::reshape().

template<typename ElemType, unsigned NDim>
element& ndarray< ElemType, NDim >::at ( shape_t  index[]  )  const [inline]

Array element access.

This method accepts the array of indices, size of the array is the number of dimensions. Alternative way to access elements in the array is to use regular operator[] inherited from nd_elem_access base class.

Definition at line 383 of file ndarray.h.

template<typename ElemType, unsigned NDim>
iterator ndarray< ElemType, NDim >::begin (  )  const [inline]

Returns iterator to the beginning of data, iteration is performed in memory order.

Definition at line 448 of file ndarray.h.

Referenced by pypsalg::AreaDetHist::AreaDetHist(), H5DataTypes::BldDataSpectrometerV0::BldDataSpectrometerV0(), psddl_pds2psana::Epics::ConfigV1::ConfigV1(), psddl_pds2psana::TimeTool::ConfigV1::ConfigV1(), psddl_pds2psana::Quartz::ConfigV1::ConfigV1(), psddl_pds2psana::Partition::ConfigV1::ConfigV1(), psddl_pds2psana::Opal1k::ConfigV1::ConfigV1(), psddl_pds2psana::GenericPgp::ConfigV1::ConfigV1(), psddl_pds2psana::EvrData::ConfigV1::ConfigV1(), psddl_pds2psana::ControlData::ConfigV1::ConfigV1(), psddl_pds2psana::Alias::ConfigV1::ConfigV1(), psddl_pds2psana::Acqiris::ConfigV1::ConfigV1(), psddl_pds2psana::TimeTool::ConfigV2::ConfigV2(), psddl_pds2psana::Quartz::ConfigV2::ConfigV2(), psddl_pds2psana::Partition::ConfigV2::ConfigV2(), psddl_pds2psana::EvrData::ConfigV2::ConfigV2(), psddl_pds2psana::ControlData::ConfigV2::ConfigV2(), psddl_pds2psana::EvrData::ConfigV3::ConfigV3(), psddl_pds2psana::CsPad::ConfigV3::ConfigV3(), psddl_pds2psana::ControlData::ConfigV3::ConfigV3(), psddl_pds2psana::EvrData::ConfigV4::ConfigV4(), psddl_pds2psana::CsPad::ConfigV4::ConfigV4(), psddl_pds2psana::EvrData::ConfigV5::ConfigV5(), psddl_pds2psana::CsPad::ConfigV5::ConfigV5(), psddl_pds2psana::EvrData::ConfigV6::ConfigV6(), psddl_pds2psana::EvrData::ConfigV7::ConfigV7(), ndarray< uint32_t, 3 >::copy(), H5DataTypes::CsPad2x2DigitalPotsCfg::CsPad2x2DigitalPotsCfg(), H5DataTypes::CsPad2x2ElementV1::CsPad2x2ElementV1(), H5DataTypes::CsPad2x2GainMapCfg::CsPad2x2GainMapCfg(), H5DataTypes::CsPadConfigV1QuadReg::CsPadConfigV1QuadReg(), H5DataTypes::CsPadConfigV2QuadReg::CsPadConfigV2QuadReg(), H5DataTypes::CsPadConfigV3::CsPadConfigV3(), H5DataTypes::CsPadConfigV3QuadReg::CsPadConfigV3QuadReg(), H5DataTypes::CsPadConfigV4::CsPadConfigV4(), H5DataTypes::CsPadConfigV5::CsPadConfigV5(), H5DataTypes::CsPadDigitalPotsCfg::CsPadDigitalPotsCfg(), H5DataTypes::CsPadElementV1::CsPadElementV1(), H5DataTypes::CsPadElementV2::CsPadElementV2(), H5DataTypes::CsPadGainMapCfg::CsPadGainMapCfg(), CSPadImageProducer::cspadImgActivePixelMask(), psddl_pds2psana::Acqiris::DataDescV1Elem< Config >::DataDescV1Elem(), psddl_pds2psana::EvrData::DataV3::DataV3(), psddl_pds2psana::EvrData::DataV4::DataV4(), psddl_hdf2psana::Lusi::IpmFexConfigV2_v0::diode(), psddl_hdf2psana::Lusi::IpmFexConfigV1_v0::diode(), psddl_pds2psana::Imp::ElementV1< Config >::ElementV1(), psddl_hdf2psana::EvrData::SequencerConfigV1_v0::entries(), TimeTool::Analyze::event(), psddl_hdf2psana::EvrData::DataV4_v0::fifoEvents(), psddl_hdf2psana::EvrData::DataV3_v0::fifoEvents(), pdscalibdata::CsPadFilterV1::filter(), psddl_pds2psana::Camera::FrameFexConfigV1::FrameFexConfigV1(), ImgAlgos::ImgRadialCorrection::getAndProcImage(), PSQt::getUint32NormalizedImage(), H5DataTypes::Gsc16aiDataV1::Gsc16aiDataV1(), H5DataTypes::ImpSample::ImpSample(), psddl_pds2psana::EvrData::IOConfigV1::IOConfigV1(), psddl_pds2psana::EvrData::IOConfigV2::IOConfigV2(), psddl_pds2psana::Lusi::IpmFexConfigV1::IpmFexConfigV1(), psddl_pds2psana::Lusi::IpmFexConfigV2::IpmFexConfigV2(), H5DataTypes::LusiDiodeFexConfigV1::LusiDiodeFexConfigV1(), H5DataTypes::LusiDiodeFexConfigV2::LusiDiodeFexConfigV2(), H5DataTypes::LusiIpmFexV1::LusiIpmFexV1(), ImgAlgos::medianEpix100V1(), H5DataTypes::OceanOpticsConfigV1::OceanOpticsConfigV1(), H5DataTypes::OceanOpticsConfigV2::OceanOpticsConfigV2(), psddl_hdf2psana::CsPad::ConfigV5_v0::protectionThresholds(), psddl_hdf2psana::CsPad::ConfigV4_v0::protectionThresholds(), psddl_hdf2psana::CsPad::ConfigV3_v0::protectionThresholds(), psddl_hdf2psana::CsPad::ConfigV5_v0::quads(), psddl_hdf2psana::CsPad::ConfigV4_v0::quads(), psddl_hdf2psana::CsPad::ConfigV3_v0::quads(), psddl_hdf2psana::CsPad::ConfigV2_v0::quads(), psddl_hdf2psana::CsPad::ConfigV1_v0::quads(), ndarray< uint32_t, 3 >::rend(), ImgAlgos::ImgSpectra::retrieveSpectra(), ImgAlgos::NDArrImageProducer::save2DArrayInEventForType(), CSPadPixCoords::CSPad2x2ImageProducer::save2DArrayInEventForType(), psddl_hdf2psana::CsPad::DataV2_v0_Element::sb_temp(), psddl_hdf2psana::CsPad::DataV1_v0_Element::sb_temp(), psddl_pds2psana::EvrData::SequencerConfigV1::SequencerConfigV1(), psddl_pds2psana::EvrData::SrcConfigV1::SrcConfigV1(), psddl_pds2psana::Acqiris::TdcConfigV1::TdcConfigV1(), psddl_pds2psana::Acqiris::TdcDataV1::TdcDataV1(), test04(), H5DataTypes::TimepixConfigV2::TimepixConfigV2(), H5DataTypes::TimepixConfigV3::TimepixConfigV3(), H5DataTypes::UsdUsbConfigV1::UsdUsbConfigV1(), and H5DataTypes::UsdUsbDataV1::UsdUsbDataV1().

template<typename ElemType, unsigned NDim>
nonconst_ndarray ndarray< ElemType, NDim >::copy (  )  const [inline]

Make a deep copy of the array data, returns modifiable array.

Note that this does not work with disjoint arrays, use on your own risk.

Definition at line 469 of file ndarray.h.

Referenced by rolling_average_double(), and rolling_average_int32_t().

template<typename ElemType, unsigned NDim>
element* ndarray< ElemType, NDim >::data (  )  const [inline]

Returns pointer to the beginning of the data array.

Definition at line 394 of file ndarray.h.

Referenced by ndarray< uint32_t, 3 >::at(), PSCalib::GenericCalibPars< TBASE >::common_mode(), H5DataTypes::CsPad2x2PixelStatusV1::CsPad2x2PixelStatusV1(), psddl_pds2psana::TimepixDataV1ToV2::data(), ImgAlgos::AlgSmearing::evaluateWeights(), CSPadPixCoords::PixCoordsTest::event(), pypsalg::Hist1D::Hist1D(), pypsalg::Hist2D::Hist2D(), ImgAlgos::NDArrImageProducer::image_fill_and_add_in_event(), ImgAlgos::load2DArrayFromFile(), PSCalib::GenericCalibPars< TBASE >::pedestals(), PSCalib::GenericCalibPars< TBASE >::pixel_bkgd(), PSCalib::GenericCalibPars< TBASE >::pixel_gain(), PSCalib::GenericCalibPars< TBASE >::pixel_mask(), PSCalib::GenericCalibPars< TBASE >::pixel_rms(), PSCalib::GenericCalibPars< TBASE >::pixel_status(), ImgAlgos::ImgSpectra::retrieveSpectra(), ImgAlgos::save2DArrayInFile(), CSPadPixCoords::save2DArrayInFile(), ImgAlgos::AlgSmearing::smearing(), H5DataTypes::CameraFrameFexConfigV1::store(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_ndarray_info(), test_cspad2x2(), and PSCalib::two2x1ToData2x2().

template<typename ElemType, unsigned NDim>
bool ndarray< ElemType, NDim >::empty (  )  const [inline]

Returns true if array has no data.

Definition at line 445 of file ndarray.h.

Referenced by psddl_hdf2psana::CsPad2x2::ElementV1_v0::common_mode(), psddl_hdf2psana::PNCCD::FullFrameV1_v0::data(), Detector::NDArrProducerCSPAD2X2::data_nda_int16_3(), Detector::NDArrProducerPrinceton::data_nda_uint16_2(), Detector::NDArrProducerEpix::data_nda_uint16_2(), psana_examples::DumpCamera::event(), psana_examples::DumpBld::event(), ImgPixSpectra::CameraPixSpectra::event(), psddl_hdf2psana::PNCCD::FullFrameV1_v0::frameNumber(), ImgAlgos::ImgRadialCorrection::getAndProcImage(), getChannelTypeList(), local_rolling_average(), ImgAlgos::ImgSpectra::retrieveSpectra(), psddl_hdf2psana::PNCCD::FullFrameV1_v0::specialWord(), psddl_hdf2psana::PNCCD::FullFrameV1_v0::timeStampHi(), and psddl_hdf2psana::PNCCD::FullFrameV1_v0::timeStampLo().

template<typename ElemType, unsigned NDim>
iterator ndarray< ElemType, NDim >::end (  )  const [inline]

Returns iterator to the end of data.

Definition at line 451 of file ndarray.h.

Referenced by pypsalg::AreaDetHist::AreaDetHist(), H5DataTypes::BldDataSpectrometerV0::BldDataSpectrometerV0(), ndarray< uint32_t, 3 >::copy(), H5DataTypes::CsPad2x2DigitalPotsCfg::CsPad2x2DigitalPotsCfg(), H5DataTypes::CsPad2x2ElementV1::CsPad2x2ElementV1(), H5DataTypes::CsPad2x2GainMapCfg::CsPad2x2GainMapCfg(), H5DataTypes::CsPadConfigV1QuadReg::CsPadConfigV1QuadReg(), H5DataTypes::CsPadConfigV2QuadReg::CsPadConfigV2QuadReg(), H5DataTypes::CsPadConfigV3::CsPadConfigV3(), H5DataTypes::CsPadConfigV3QuadReg::CsPadConfigV3QuadReg(), H5DataTypes::CsPadConfigV4::CsPadConfigV4(), H5DataTypes::CsPadConfigV5::CsPadConfigV5(), H5DataTypes::CsPadDigitalPotsCfg::CsPadDigitalPotsCfg(), H5DataTypes::CsPadElementV1::CsPadElementV1(), H5DataTypes::CsPadElementV2::CsPadElementV2(), H5DataTypes::CsPadGainMapCfg::CsPadGainMapCfg(), CSPadImageProducer::cspadImgActivePixelMask(), TimeTool::Analyze::event(), pdscalibdata::CsPadFilterV1::filter(), ImgAlgos::ImgRadialCorrection::getAndProcImage(), PSQt::getUint32NormalizedImage(), H5DataTypes::Gsc16aiDataV1::Gsc16aiDataV1(), H5DataTypes::ImpSample::ImpSample(), H5DataTypes::LusiDiodeFexConfigV1::LusiDiodeFexConfigV1(), H5DataTypes::LusiDiodeFexConfigV2::LusiDiodeFexConfigV2(), H5DataTypes::LusiIpmFexV1::LusiIpmFexV1(), ImgAlgos::medianEpix100V1(), H5DataTypes::OceanOpticsConfigV1::OceanOpticsConfigV1(), H5DataTypes::OceanOpticsConfigV2::OceanOpticsConfigV2(), ndarray< uint32_t, 3 >::rbegin(), ImgAlgos::NDArrImageProducer::save2DArrayInEventForType(), CSPadPixCoords::CSPad2x2ImageProducer::save2DArrayInEventForType(), test04(), H5DataTypes::TimepixConfigV2::TimepixConfigV2(), H5DataTypes::TimepixConfigV3::TimepixConfigV3(), H5DataTypes::UsdUsbConfigV1::UsdUsbConfigV1(), and H5DataTypes::UsdUsbDataV1::UsdUsbDataV1().

template<typename ElemType, unsigned NDim>
ndarray& ndarray< ElemType, NDim >::operator= ( const ndarray_details::nd_elem_access_pxy< ElemType, NDim > &  pxy  )  [inline]

Assignment from nd_elem_access_pxy.

Definition at line 367 of file ndarray.h.

template<typename ElemType, unsigned NDim>
ndarray& ndarray< ElemType, NDim >::operator= ( const nonconst_ndarray< ElemType, NDim > &  other  )  [inline]

Assignment operator, data is never copied.

Definition at line 360 of file ndarray.h.

template<typename ElemType, unsigned NDim>
reverse_iterator ndarray< ElemType, NDim >::rbegin (  )  const [inline]

Returns reverse iterators.

Definition at line 454 of file ndarray.h.

template<typename ElemType, unsigned NDim>
reverse_iterator ndarray< ElemType, NDim >::rend (  )  const [inline]

Definition at line 455 of file ndarray.h.

template<typename ElemType, unsigned NDim>
void ndarray< ElemType, NDim >::reshape ( const shape_t shape,
ndns::Order  order = ndns::C 
) [inline]

Changes the shape of the array.

No checks are done on the size of the new array. Optional second argument defines memory order of the elements, default is to assume C order (last index changes fastest). This argument determines how strides are calculated, strides can be changed later with strides() method.

Parameters:
[in] shape Pointer to dimensions array, size of array is NDim, array data will be copied.
[in] order Memory order of the elements.

Definition at line 433 of file ndarray.h.

template<typename ElemType, unsigned NDim>
const shape_t* ndarray< ElemType, NDim >::shape (  )  const [inline]

Returns shape of the array.

Returns an array (or pointer to its first element) of the ndarray dimensions.

Definition at line 401 of file ndarray.h.

Referenced by psana_examples::DumpCamera::beginCalibCycle(), ImgAlgos::CameraImageProducer::beginCalibCycle(), ndarray< uint32_t, 3 >::copy(), H5DataTypes::CsPad2x2PedestalsV1::CsPad2x2PedestalsV1(), H5DataTypes::CsPad2x2PixelStatusV1::CsPad2x2PixelStatusV1(), H5DataTypes::CsPadPedestalsV1::CsPadPedestalsV1(), H5DataTypes::CsPadPixelStatusV1::CsPadPixelStatusV1(), psddl_hdf2psana::EvrData::ns_IOChannel_v0::dataset_data::dataset_data(), psddl_hdf2psana::EvrData::ns_DataV4_v0::dataset_data::dataset_data(), psddl_hdf2psana::EvrData::ns_DataV3_v0::dataset_data::dataset_data(), TimeTool::Setup::event(), TimeTool::Analyze::event(), ImgPixSpectra::CSPad2x2PixSpectra::event(), pypsalg::Hist2D::fill(), pypsalg::Hist1D::fill(), PSXtcInput::XtcInputModuleBase::fillEnv(), PSHdf5Input::Hdf5InputModule::fillEventEnv(), psana_test::flatten(), ImgAlgos::ImgRadialCorrection::getAndProcImage(), CSPadPixCoords::CSPadConfigPars::getCSPadPixNDArrFromNDArrShapedAsData(), CSPadPixCoords::CSPadConfigPars::getCSPadPixNDArrShapedAsData(), PSQt::getUint32NormalizedImage(), local_rolling_average(), psddl_hdf2psana::Camera::make_datasets_FrameV1_v0(), ImgAlgos::mapOfLocalMaximumsRank1Cross(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::NDArrIOV1(), psddl_python::detail::ndToList(), Detector::NDArrProducerCamera::print_config(), ImgAlgos::ImgSpectra::retrieveSpectra(), ImgAlgos::NDArrImageProducer::save2DArrayInEventForType(), ImgAlgos::save2DArrayInFile(), CSPadPixCoords::save2DArrayInFile(), PSQt::WdgImage::setCameraImage(), ImgAlgos::AlgArrProc::setWindows(), PSCalib::GenericCalibPars< TBASE >::shape_of_ndarray(), and psddl_hdf2psana::EvrData::store_IOConfigV1_v0().

template<typename ElemType, unsigned NDim>
size_type ndarray< ElemType, NDim >::size (  )  const [inline]

Returns total number of elements in array.

Definition at line 440 of file ndarray.h.

Referenced by TimeTool::Analyze::Analyze(), psana_examples::DumpQuartz::beginCalibCycle(), psana_examples::DumpOpal1k::beginCalibCycle(), psana_examples::DumpLusi::beginCalibCycle(), psana_examples::DumpControl::beginCalibCycle(), psana_examples::DumpAlias::beginCalibCycle(), psddl_pds2psana::TimepixDataV1ToV2::data(), psddl_hdf2psana::Lusi::IpmFexConfigV2_v0::diode(), psddl_hdf2psana::Lusi::IpmFexConfigV1_v0::diode(), ndarray< uint32_t, 3 >::end(), TimeTool::Analyze::endJob(), psddl_hdf2psana::EvrData::SequencerConfigV1_v0::entries(), ImgAlgos::AlgSmearing::evaluateWeights(), TimeTool::Setup::event(), TimeTool::Analyze::event(), pdscalibdata::CsPadFilterV1::filter(), Detector::NDArrProducerCSPAD::getNDArr(), pypsalg::Hist1D::Hist1D(), pypsalg::Hist2D::Hist2D(), ImgAlgos::NDArrImageProducer::image_fill_and_add_in_event(), ImgAlgos::load2DArrayFromFile(), ndarray< uint32_t, 3 >::ndarray(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::NDArrIOV1(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::print_ndarray(), psddl_hdf2psana::CsPad::ConfigV5_v0::protectionThresholds(), psddl_hdf2psana::CsPad::ConfigV4_v0::protectionThresholds(), psddl_hdf2psana::CsPad::ConfigV3_v0::protectionThresholds(), ImgAlgos::ImgSpectra::retrieveSpectra(), TimeTool::Analyze::setBeamAndLaserStatusForEvent(), TimeTool::Setup::Setup(), PSCalib::GenericCalibPars< TBASE >::size_of_ndarray(), ImgAlgos::AlgSmearing::smearing(), H5DataTypes::PartitionConfigV1::store(), H5DataTypes::CameraFrameFexConfigV1::store(), H5DataTypes::AliasConfigV1::store(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_ndarray_info(), and PSCalib::two2x1ToData2x2().

template<typename ElemType, unsigned NDim>
void ndarray< ElemType, NDim >::strides ( const stride_t strides  )  [inline]

Changes strides.

If array has a non-conventional memory layout it is possible to change the strides.

Parameters:
[in] strides Pointer to new strides array, size of array is NDim, array data will be copied.

Definition at line 418 of file ndarray.h.

template<typename ElemType, unsigned NDim>
const stride_t* ndarray< ElemType, NDim >::strides (  )  const [inline]

Returns array strides.

Returns an array (or pointer to its first element) of the ndarray strides.

Definition at line 408 of file ndarray.h.

Referenced by psana_python::NumpyToNDArray< T, Rank >::construct(), and ndarray< uint32_t, 3 >::copy().

template<typename ElemType, unsigned NDim>
void ndarray< ElemType, NDim >::swap ( ndarray< ElemType, NDim > &  other  )  [inline]

swap contents of two arrays

Definition at line 458 of file ndarray.h.


The documentation for this class was generated from the following file:
Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7