npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::ArrayND< Numeric, StackLen, StackDim > Class Template Reference

#include <ArrayND.hh>

Public Types

typedef Numeric value_type
 
typedef ProperDblFromCmpl< Numeric >::type proper_double
 

Public Member Functions

 ArrayND ()
 
 ArrayND (const ArrayShape &shape)
 
 ArrayND (const unsigned *shape, unsigned dim)
 
 ArrayND (const ArrayND &)
 
 ArrayND (ArrayND &&)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
 ArrayND (const ArrayND< Num2, Len2, Dim2 > &)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
 ArrayND (const ArrayND< Num2, Len2, Dim2 > &, Functor f)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
 ArrayND (const ArrayND< Num2, Len2, Dim2 > &from, const ArrayRange &fromRange)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
 ArrayND (const ArrayND< Num2, Len2, Dim2 > &from, const ArrayRange &fromRange, Functor f)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
 ArrayND (const ArrayND< Num2, Len2, Dim2 > &slicedArray, const unsigned *indices, unsigned nIndices)
 
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
 ArrayND (const ArrayND< Num1, Len1, Dim1 > &a1, const ArrayND< Num2, Len2, Dim2 > &a2)
 
 ArrayND (unsigned n0)
 
 ArrayND (unsigned n0, unsigned n1)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8)
 
 ArrayND (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8, unsigned n9)
 
 ~ArrayND ()
 
ArrayNDoperator= (const ArrayND &)
 
ArrayNDoperator= (ArrayND &&)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator= (const ArrayND< Num2, Len2, Dim2 > &)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
ArrayNDassign (const ArrayND< Num2, Len2, Dim2 > &, Functor f)
 
ArrayNDuninitialize ()
 
ArrayNDreshape (const ArrayShape &newShape)
 
ArrayNDreshape (const unsigned *newShape, unsigned dim)
 
ArrayNDreshape (unsigned n0)
 
ArrayNDreshape (unsigned n0, unsigned n1)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8)
 
ArrayNDreshape (unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8, unsigned n9)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDreshape (const ArrayND< Num2, Len2, Dim2 > &r)
 
Numeric & value (const unsigned *index, unsigned indexLen)
 
const Numeric & value (const unsigned *index, unsigned indexLen) const
 
Numeric & valueAt (const unsigned *index, unsigned indexLen)
 
const Numeric & valueAt (const unsigned *index, unsigned indexLen) const
 
Numeric & linearValue (unsigned long index)
 
const Numeric & linearValue (unsigned long index) const
 
Numeric & linearValueAt (unsigned long index)
 
const Numeric & linearValueAt (unsigned long index) const
 
void convertLinearIndex (unsigned long l, unsigned *index, unsigned indexLen) const
 
ArrayShape convertLinearIndex (unsigned long l) const
 
ArrayRange nonZeroRange () const
 
unsigned long linearIndex (const unsigned *idx, unsigned idxLen) const
 
unsigned long linearIndex (const ArrayShape &sh) const
 
unsigned long length () const
 
const Numeric * data () const
 
bool isShapeKnown () const
 
unsigned rank () const
 
ArrayShape shape () const
 
const unsigned * shapeData () const
 
ArrayRange fullRange () const
 
unsigned span (unsigned dim) const
 
unsigned maximumSpan () const
 
unsigned minimumSpan () const
 
const unsigned long * strides () const
 
bool isZero () const
 
bool isNonZero () const
 
template<typename Num2 >
ArrayNDsetData (const Num2 *data, unsigned long dataLength)
 
template<unsigned Len2, unsigned Dim2>
bool operator== (const ArrayND< Numeric, Len2, Dim2 > &) const
 
template<unsigned Len2, unsigned Dim2>
bool operator!= (const ArrayND< Numeric, Len2, Dim2 > &) const
 
template<unsigned Len2, unsigned Dim2>
double maxAbsDifference (const ArrayND< Numeric, Len2, Dim2 > &) const
 
ArrayND operator+ () const
 
template<typename Num2 >
ArrayND operator* (const Num2 &r) const
 
template<typename Num2 >
ArrayND operator/ (const Num2 &r) const
 
template<typename Num2 >
ArrayNDoperator*= (const Num2 &r)
 
template<typename Num2 >
ArrayNDoperator/= (const Num2 &r)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator+= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator-= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator*= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator/= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<typename Num3 , typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDaddmul (const ArrayND< Num2, Len2, Dim2 > &r, const Num3 &c)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND outer (const ArrayND< Num2, Len2, Dim2 > &r) const
 
ArrayND contract (unsigned pos1, unsigned pos2) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND dot (const ArrayND< Num2, Len2, Dim2 > &r) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND marginalize (const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, unsigned mapLen) const
 
ArrayND transpose (unsigned pos1, unsigned pos2) const
 
ArrayND transpose () const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 sum () const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 sumsq () const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
ArrayND derivative (double scale=1.0) const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
ArrayND cdfArray (double scale=1.0) const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 cdfValue (const unsigned *index, unsigned indexLen) const
 
template<typename Num2 = typename PreciseType<Numeric>::type>
void convertToLastDimCdf (ArrayND *sumSlice, bool useTrapezoids)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void coarseSum (unsigned idim, unsigned n, ArrayND< Num2, Len2, Dim2 > *result) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void coarseAverage (unsigned idim, unsigned n, ArrayND< Num2, Len2, Dim2 > *result) const
 
Numeric & closest (const double *x, unsigned xDim)
 
const Numeric & closest (const double *x, unsigned xDim) const
 
Numeric interpolate1 (const double *x, unsigned xDim) const
 
Numeric interpolate3 (const double *x, unsigned xDim) const
 
template<class Functor >
ArrayNDapply (Functor f)
 
template<class Functor >
ArrayNDscanInPlace (Functor f)
 
ArrayNDconstFill (Numeric c)
 
ArrayNDclear ()
 
ArrayNDlinearFill (const double *coeff, unsigned coeffLen, double c)
 
template<class Functor >
ArrayNDfunctorFill (Functor f)
 
ArrayNDmakeUnit ()
 
ArrayNDmakeNonNegative ()
 
unsigned makeCopulaSteps (double tolerance, unsigned maxIterations)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void jointScan (ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void jointSubrangeScan (ArrayND< Num2, Len2, Dim2 > &other, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, unsigned arrLen, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void dualCircularScan (ArrayND< Num2, Len2, Dim2 > &other, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, unsigned arrLen, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void flatCircularScan (ArrayND< Num2, Len2, Dim2 > &other, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, unsigned arrLen, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void circularFlatScan (ArrayND< Num2, Len2, Dim2 > &other, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, unsigned arrLen, Functor binaryFunct)
 
template<typename Num2 , typename Integer >
void processSubrange (AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void exportSubrange (const unsigned *fromCorner, unsigned lenCorner, ArrayND< Num2, Len2, Dim2 > *dest) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void importSubrange (const unsigned *fromCorner, unsigned lenCorner, const ArrayND< Num2, Len2, Dim2 > &from)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool isClose (const ArrayND< Num2, Len2, Dim2 > &r, double eps) const
 
bool isCompatible (const ArrayShape &shape) const
 
bool isCompatible (const unsigned *shape, unsigned dim) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool isShapeCompatible (const ArrayND< Num2, Len2, Dim2 > &r) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void jointSliceScan (ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
 
template<typename Num2 , class Functor >
void jointMemSliceScan (Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
 
ArrayShape sliceShape (const unsigned *fixedIndices, unsigned nFixedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void exportSlice (ArrayND< Num2, Len2, Dim2 > *slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
 
template<typename Num2 >
void exportMemSlice (Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void importSlice (const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices)
 
template<typename Num2 >
void importMemSlice (const Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void applySlice (ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDmultiplyBySlice (const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void project (ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void project (ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void addToProjection (ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void subtractFromProjection (ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void addToProjection (ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void subtractFromProjection (ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void rotate (const unsigned *shifts, unsigned lenShifts, ArrayND< Num2, Len2, Dim2 > *rotated) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void mirror (const unsigned *mirrorDims, unsigned mirrorLen, ArrayND< Num2, Len2, Dim2 > *out) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void multiMirror (ArrayND< Num2, Len2, Dim2 > *out) const
 
Numeric & operator() ()
 
const Numeric & operator() () const
 
Numeric & operator() (unsigned i0)
 
const Numeric & operator() (unsigned i0) const
 
Numeric & operator() (unsigned i0, unsigned i1)
 
const Numeric & operator() (unsigned i0, unsigned i1) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8) const
 
Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8, unsigned i9)
 
const Numeric & operator() (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8, unsigned i9) const
 
Numeric & at ()
 
const Numeric & at () const
 
Numeric & at (unsigned i0)
 
const Numeric & at (unsigned i0) const
 
Numeric & at (unsigned i0, unsigned i1)
 
const Numeric & at (unsigned i0, unsigned i1) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8) const
 
Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8, unsigned i9)
 
const Numeric & at (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8, unsigned i9) const
 
Numeric & cl ()
 
const Numeric & cl () const
 
Numeric & cl (double x0)
 
const Numeric & cl (double x0) const
 
Numeric & cl (double x0, double x1)
 
const Numeric & cl (double x0, double x1) const
 
Numeric & cl (double x0, double x1, double x2)
 
const Numeric & cl (double x0, double x1, double x2) const
 
Numeric & cl (double x0, double x1, double x2, double x3)
 
const Numeric & cl (double x0, double x1, double x2, double x3) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8) const
 
Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, double x9)
 
const Numeric & cl (double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, double x9) const
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 
static void restore (const gs::ClassId &id, std::istream &in, ArrayND *array)
 

Friends

template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, const unsigned *shape, unsigned dim)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, const ArrayShape &shape)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8)
 
template<typename Num2 >
ArrayND< Num2 > externalMemArrayND (Num2 *data, unsigned n0, unsigned n1, unsigned n2, unsigned n3, unsigned n4, unsigned n5, unsigned n6, unsigned n7, unsigned n8, unsigned n9)
 
template<typename Num2 >
CPP11_auto_ptr< ArrayND< Num2 > > allocExternalMemArrayND (Num2 *data, const unsigned *shape, unsigned dim)
 
template<typename Num2 >
CPP11_auto_ptr< ArrayND< Num2 > > allocExternalMemArrayND (Num2 *data, const ArrayShape &shape)
 

Detailed Description

template<typename Numeric, unsigned StackLen, unsigned StackDim>
class npstat::ArrayND< Numeric, StackLen, StackDim >

A class for multidimensional array manipulation. A number of methods of this class will work only if dimensionality is limited by CHAR_BIT*sizeof(unsigned long)-1 (which is 31 and 63 on 32- and 64-bit architectures, respectively).

Depending on how much space is provided with the "StackLen" template parameter, the array data will be placed either on the stack or on the heap. By default, array data leaves on the heap unless the array has rank 0.

Depending on how much space is provided with the "StackDim" template parameter, the array strides will be placed either on the stack or on the heap. By default, strides will be placed on the stack in case the array dimensionality is ten or less.

The "Numeric" type must have a default constructor (of course, pointers to arbitrary types can be used as well).

Both StackLen and StackDim parameters must be positive.

Constructor & Destructor Documentation

◆ ArrayND() [1/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( )

Default constructor creates an uninitialized array. The following things can be done safely with such an array:

1) Assigning it from another array (initialized or not).

2) Passing it as an argument to the class static method "restore".

3) Calling the "uninitialize" method.

4) Calling the "isShapeKnown" method.

5) Calling the "reshape" method.

Any other operation results in an undefined behavior (often, an exception is thrown). Note that initialized array can not be assigned from uninitialized one.

◆ ArrayND() [2/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayShape shape)
explicit

Constructor which creates arrays with the given shape. The array data remains undefined. Simple inilitalization of the data can be performed using methods clear() or constFill(SomeValue). More complicated initialization can be done by "linearFill", "functorFill", or by setting every array element to a desired value.

◆ ArrayND() [3/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Numeric, StackLen, StackDim > &  )

The copy constructor

◆ ArrayND() [4/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( ArrayND< Numeric, StackLen, StackDim > &&  )

The move constructor

◆ ArrayND() [5/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  )

Converting constructor. It looks more general than the copy constructor, but the actual copy constructor has to be created anyway – otherwise the compiler will generate an incorrect default copy constructor. Note that existence of this constructor essentially disables data type safety for copying arrays – but the code significantly gains in convenience.

◆ ArrayND() [6/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  ,
Functor  f 
)

Converting constructor where the array values are filled by a functor using values of another array as arguments

◆ ArrayND() [7/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  from,
const ArrayRange fromRange 
)

Constructor from a subrange of another array

◆ ArrayND() [8/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  from,
const ArrayRange fromRange,
Functor  f 
)

Similar constructor with a transforming functor

◆ ArrayND() [9/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  slicedArray,
const unsigned *  indices,
unsigned  nIndices 
)

Constructor from a slice of another array. The data of the constructed array remains undefined. The argument "indices" lists either the array indices whose numbers will be fixed when slicing is performed or the indices which will be iterated over during projections (for example, array values may be summed over these indices). These indices will be excluded from the constructed array. The created array can be subsequently used with methods "exportSlice", "importSlice", "project", etc. of the parent array "slicedArray".

◆ ArrayND() [10/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( const ArrayND< Num1, Len1, Dim1 > &  a1,
const ArrayND< Num2, Len2, Dim2 > &  a2 
)

Outer product constructor

◆ ArrayND() [11/11]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND ( unsigned  n0)
explicit

Constructor in which the spans are explicitly provided for each dimension. The array data remains undefined.

◆ ~ArrayND()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
npstat::ArrayND< Numeric, StackLen, StackDim >::~ArrayND ( )

Destructor

Member Function Documentation

◆ addmul()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num3 , typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::addmul ( const ArrayND< Num2, Len2, Dim2 > &  r,
const Num3 &  c 
)

This method is equivalent to (but faster than) += r*c

◆ addToProjection()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::addToProjection ( ArrayND< Num2, Len2, Dim2 > *  projection,
AbsArrayProjector< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

Similar method to "project", but projections are added to (or subtracted from) the existing projection data instead of replacing them

◆ apply()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<class Functor >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::apply ( Functor  f)

This method applies a single-argument functor to each element of the array (in-place). The result returned by the functor becomes the new value of the element. There must be a conversion (static cast) from the functor result to the "Numeric" type. The method returns *this which allows for chaining of such methods. Use the transforming constructor if you want a new array instead.

◆ applySlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice ( ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
unsigned  nFixedIndices,
Functor  binaryFunct 
)

This method applies the values in the slice to all other coresponding values in the array. This can be used, for example, to multiply/divide by some factor which varies across the slice. The slice values will be used as the right functor argument.

◆ assign()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::assign ( const ArrayND< Num2, Len2, Dim2 > &  ,
Functor  f 
)

Converting assignment method with a transforming functor

◆ at()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::at ( )

Fortran-style subscripting with bounds checking (of course, with indices starting at 0).

◆ cdfArray()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray ( double  scale = 1.0) const

The operation inverse to "derivative". Constructs multivariate cumulative density function.

◆ cdfValue()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 npstat::ArrayND< Numeric, StackLen, StackDim >::cdfValue ( const unsigned *  index,
unsigned  indexLen 
) const

Calculate just one multivariate cumulative density function value. Point with given index will be included in the sum.

◆ circularFlatScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatScan ( ArrayND< Num2, Len2, Dim2 > &  other,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
unsigned  arrLen,
Functor  binaryFunct 
)

Method similar to "jointSubrangeScan" in which the topology of this array is assumed to be hypertoroidal and the other array flat

◆ cl()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::cl ( )

Subscripting by continuous coordinate. Works similar to the "closest" method.

◆ classId()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
gs::ClassId npstat::ArrayND< Numeric, StackLen, StackDim >::classId ( ) const
inline

Method related to "geners" I/O

◆ clear()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::clear ( )

Zero the array out (every datum becomes Numeric())

◆ closest()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::closest ( const double *  x,
unsigned  xDim 
)

Closest value accessor (works as if the array allows access with non-integer indices). For example, the second point in some dimension will be accessed in case the coordinate in that dimension is between 0.5 and 1.5. This function can be used, for example, for implementing simple N-D histogramming or for closest value interpolation and extrapolation.

◆ coarseAverage()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::coarseAverage ( unsigned  idim,
unsigned  n,
ArrayND< Num2, Len2, Dim2 > *  result 
) const

Coarsen this array by averaging n nearby elements along the given dimension. The "result" array will have n times less elements along that dimension.

◆ coarseSum()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::coarseSum ( unsigned  idim,
unsigned  n,
ArrayND< Num2, Len2, Dim2 > *  result 
) const

Coarsen this array by summing n nearby elements along the given dimension. The "result" array will have n times less elements along that dimension.

◆ constFill()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::constFill ( Numeric  c)

This method fills the array data with a constant value

◆ contract()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::contract ( unsigned  pos1,
unsigned  pos2 
) const

Contraction of a pair of indices. Note that the array length must be the same in both dimensions.

◆ convertLinearIndex()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
void npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex ( unsigned long  l,
unsigned *  index,
unsigned  indexLen 
) const

Convert linear index into multidimensional index

◆ convertToLastDimCdf()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
void npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdf ( ArrayND< Numeric, StackLen, StackDim > *  sumSlice,
bool  useTrapezoids 
)

The next function turns the array data into the conditional cumulative density function for the last dimension. "Num2" is the type of accumulator class used. The cdf is stored in such a way that the cdf value of 0 is skipped (the first stored value is the sum which includes the 0th bin). The slice is filled with the sum of values. The "useTrapezoids" parameter specifies whether trapezoidal integration formula should be utilized (rectangular integration is used in case "useTrapezoids" value is "false").

◆ data()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
const Numeric* npstat::ArrayND< Numeric, StackLen, StackDim >::data ( ) const
inline

Linearized data

◆ derivative()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::derivative ( double  scale = 1.0) const

Mixed derivative over all directions. Useful for generating densities from distribution functions. The resulting array will have one less point in each dimension. Class Num2 is used as accumulator for calculations. static_cast from Num2 to Numeric must exist. The result is multiplied by the scale factor provided.

◆ dot()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::dot ( const ArrayND< Num2, Len2, Dim2 > &  r) const

Here, dot product corresponds to outer product followed by the contraction over two indices – the last index of this object and the first index of the argument.

◆ dualCircularScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::dualCircularScan ( ArrayND< Num2, Len2, Dim2 > &  other,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
unsigned  arrLen,
Functor  binaryFunct 
)

Method similar to "jointSubrangeScan" in which the topology of both arrays is assumed to be hypertoroidal (circular buffer in every dimension)

◆ exportMemSlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::exportMemSlice ( Num2 *  buffer,
unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
) const
inline

Convenience method for exporting a slice of this array into a memory buffer

◆ exportSlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::exportSlice ( ArrayND< Num2, Len2, Dim2 > *  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
) const
inline

Convenience method for exporting a slice of this array

◆ exportSubrange()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::exportSubrange ( const unsigned *  fromCorner,
unsigned  lenCorner,
ArrayND< Num2, Len2, Dim2 > *  dest 
) const

Copy a hyperrectangular subrange of this array potentially completely overwriting the destination array. The starting corner in this object where copying begins is provided by the first two arguments. The subrange size is defined by the shape of the destination array.

◆ flatCircularScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::flatCircularScan ( ArrayND< Num2, Len2, Dim2 > &  other,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
unsigned  arrLen,
Functor  binaryFunct 
)

Method similar to "jointSubrangeScan" in which the topology of this array is assumed to be flat and the other array hypertoroidal

◆ fullRange()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayRange npstat::ArrayND< Numeric, StackLen, StackDim >::fullRange ( ) const

Get the complete range

◆ functorFill()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<class Functor >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill ( Functor  f)

This method fills the array from a functor which takes (const unsigned* index, unsigned indexLen) arguments. There must be a conversion (static cast) from the functor result to the "Numeric" type.

◆ importMemSlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::importMemSlice ( const Num2 *  buffer,
unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
)
inline

Convenience method for importing a slice into this array from a memory buffer

◆ importSlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::importSlice ( const ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
)
inline

Convenience method for importing a slice into this array

◆ importSubrange()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange ( const unsigned *  fromCorner,
unsigned  lenCorner,
const ArrayND< Num2, Len2, Dim2 > &  from 
)

The inverse operation to "exportSubrange"

◆ interpolate1()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1 ( const double *  x,
unsigned  xDim 
) const

Multilinear interpolation. Closest value extrapolation is used in case some index is outside of the array bounds. Note that this function works only if the array dimensionality is less than CHAR_BIT*sizeof(unsigned long). x is the "coordinate" which coincides with array index for x equal to unsigned integers.

◆ interpolate3()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3 ( const double *  x,
unsigned  xDim 
) const

Multicubic interpolation. Closest value extrapolation is used in case some index is outside of the array bounds. This function is much slower than "interpolate1" (in the current implementation, a recursive algorithm is used).

◆ isClose()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isClose ( const ArrayND< Num2, Len2, Dim2 > &  r,
double  eps 
) const

Check that all elements of this array differ from the corresponding elements of another array by at most "eps". Equivalent to maxAbsDifference(r) <= eps (but usually faster).

◆ isCompatible()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible ( const ArrayShape shape) const

Check compatibility with another shape

◆ isNonZero()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isNonZero ( ) const

Check if all array elements are non-zero

◆ isShapeCompatible()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible ( const ArrayND< Num2, Len2, Dim2 > &  r) const

Check shape compatibility with another array. Equivalent to but faster than isCompatible(r.shape()).

◆ isShapeKnown()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeKnown ( ) const
inline

Check whether the array has been initialized

◆ isZero()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isZero ( ) const

Check if all array elements are zero

◆ jointMemSliceScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointMemSliceScan ( Num2 *  buffer,
unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
Functor  binaryFunct 
)

Joint cycle over a slice this array and some memory buffer. The length of the buffer must be equal to the length of the slice, as in "jointSliceScan". This method is to be used for import/export of slice data and in-place operations (addition, multiplication, etc) with memory managed not by ArrayND but in some other manner.

◆ jointScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan ( ArrayND< Num2, Len2, Dim2 > &  other,
Functor  binaryFunct 
)

Loop over all elements of two compatible arrays and apply a binary functor

◆ jointSliceScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan ( ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
Functor  binaryFunct 
)

Joint cycle over the data of this array and the slice. The array to which the "slice" argument refers should normally be created by the slicing constructor using this array as the argument. The "fixedIndices" argument should be the same as the "indices" argument in that constructor. This method is to be used for import/export of slice data and in-place operations (addition, multiplication, etc).

◆ jointSubrangeScan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSubrangeScan ( ArrayND< Num2, Len2, Dim2 > &  other,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
unsigned  arrLen,
Functor  binaryFunct 
)

Loop over subranges in two arrays in such a way that the functor is called only if the indices on both sides are valid. The topology of both arrays is assumed to be box-like (flat). The starting corner in this object (where cycling begins) is provided by the argument "thisCorner". The "range" argument specifies the width of the processed patch in each dimension. The corner of the "other" array where cycling begins is provided by the "otherCorner" argument. The "arrLen" argument specifies the number of elements in "thisCorner", "range", and "otherCorner" arrays. It should be equal to the rank of either of the two ArrayND arrays.

Note that there is no good way for this method to assume constness of this or "other" array: this becomes apparent only after the functor has been specified. Apply const_cast judiciously as needed, other solutions of this problem are not any better.

◆ length()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::length ( ) const
inline

Total number of data array elements

◆ linearFill()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::linearFill ( const double *  coeff,
unsigned  coeffLen,
double  c 
)

This method fills the array with a linear combination of the index values. For example, a 2-d array element with indices i, k will be set to (coeff[0]*i + coeff[1]*k + c). There must be a conversion (static cast) from double into "Numeric".

◆ linearIndex()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::linearIndex ( const unsigned *  idx,
unsigned  idxLen 
) const

Convert multidimensional index into linear index

◆ linearValue()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::linearValue ( unsigned long  index)

Element access using linear index (no bounds checking)

◆ linearValueAt()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::linearValueAt ( unsigned long  index)

Element access using linear index (with bounds checking)

◆ makeCopulaSteps()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps ( double  tolerance,
unsigned  maxIterations 
)

This method accumulates marginals and divides the array (treated as a distribution) by the product of the marginals. Several iterations like this turn the distribution into a copula. If the array contains negative elements, they are turned into zeros before the iterations are performed. The function returns the actual number of iteration performed when the given tolerance was reached for all marginals.

◆ makeNonNegative()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative ( )

This method turns all negative elements into zeros

◆ makeUnit()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit ( )

This method can be used for arrays with rank of at least 2 whose length is the same in all dimensions. It puts static_cast<Numeric>(1) on the main diagonal and Numeric() everywhere else.

◆ marginalize()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize ( const ArrayND< Num2, Len2, Dim2 > &  prior,
const unsigned *  indexMap,
unsigned  mapLen 
) const

The intent of this method is to marginalize over a set of indices with a prior. Essentially, we are calculating integrals akin to p(y) = Integral f(y|x) g(x) dx in which all functions are represented on an equidistant grid. If needed, multiplication of the result by the grid cell size should be performed after this function. "indexMap" specifies how the indices of the prior array (which is like g(x)) are mapped into the indices of this array (which is like f(y|x)). The number of elements in the map, "mapLen", must be equal to the rank of the prior. Dimension 0 of the prior corresponds to the dimension indexMap[0] of this array, dimension 1 corresponds to indexMap[1], etc.

◆ maxAbsDifference()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<unsigned Len2, unsigned Dim2>
double npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference ( const ArrayND< Numeric, Len2, Dim2 > &  ) const

Largest absolute difference with another bin-compatible array

◆ maximumSpan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::maximumSpan ( ) const

Maximum span among all dimensions

◆ minimumSpan()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::minimumSpan ( ) const

Minimum span among all dimensions

◆ mirror()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::mirror ( const unsigned *  mirrorDims,
unsigned  mirrorLen,
ArrayND< Num2, Len2, Dim2 > *  out 
) const

Mirror this array into another array w.r.t. the dimensions provided by the arguments. The other array must have the same spans as this one.

◆ multiMirror()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror ( ArrayND< Num2, Len2, Dim2 > *  out) const

Fill another array with all possible mirror images of this one. This other array must have twice the span in each dimension.

◆ multiplyBySlice()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::multiplyBySlice ( const ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
unsigned  nFixedIndices 
)
inline

Convenience method which multiplies the array by a scale factor which varies across the slice

◆ nonZeroRange()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayRange npstat::ArrayND< Numeric, StackLen, StackDim >::nonZeroRange ( ) const

The range which encloses all non-zero values of the array

◆ operator!=()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::operator!= ( const ArrayND< Numeric, Len2, Dim2 > &  ) const

Logical negation of operator==

◆ operator()()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::operator() ( )

Fortran-style subscripting without bounds checking (of course, with indices starting at 0).

◆ operator*()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator* ( const Num2 &  r) const

multiplication by a scalar

◆ operator*=()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator*= ( const Num2 &  r)

In-place operator. Note that it works faster than the binary version with assignment, i.e., A += B is faster than A = A + B.

◆ operator+()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator+ ( ) const

Unary operator+ returns a copy of this array

◆ operator/()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator/ ( const Num2 &  r) const

division by a scalar

◆ operator=() [1/3]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator= ( ArrayND< Numeric, StackLen, StackDim > &&  )

The move assignment operator

◆ operator=() [2/3]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator= ( const ArrayND< Numeric, StackLen, StackDim > &  )

Assignment operator. The shape of the array on the right must be compatible with the shape of the array on the left. The only exception is when the array on the left has no shape at all (i.e., it was created by the default constructor or its "uninitialize" method was called). In this case the array on the left will assume the shape of the array on the right.

◆ operator=() [3/3]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator= ( const ArrayND< Num2, Len2, Dim2 > &  )

Converting assignment operator

◆ operator==()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::operator== ( const ArrayND< Numeric, Len2, Dim2 > &  ) const

Compare two arrays for equality

◆ outer()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::outer ( const ArrayND< Num2, Len2, Dim2 > &  r) const

Outer product as a method (see also the outer product constructor)

◆ processSubrange()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , typename Integer >
void npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrange ( AbsArrayProjector< Numeric, Num2 > &  f,
const BoxND< Integer > &  subrange 
) const

This method runs over a subrange of the array and calls the argument functor on every point. This method will not call "clear" or "result" functions of the argument functor.

◆ project()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::project ( ArrayND< Num2, Len2, Dim2 > *  projection,
AbsArrayProjector< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

This method fills a projection. The array to which "projection" argument points should normally be created by the slicing constructor using this array as an argument. "projectedIndices" should be the same as "indices" specified during the slice creation.

◆ rank()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::rank ( ) const
inline

The number of array dimensions

◆ reshape() [1/2]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::reshape ( const ArrayND< Num2, Len2, Dim2 > &  r)

Change the shape of this array to be identical to the shape of the argument array. The shape of the argument array must be known. All data is lost in the process.

◆ reshape() [2/2]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::reshape ( const ArrayShape newShape)

Change the array shape. All data is lost in the process.

◆ rotate()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::rotate ( const unsigned *  shifts,
unsigned  lenShifts,
ArrayND< Num2, Len2, Dim2 > *  rotated 
) const

Rotation. Place the result into another array. The elements with indices 0 in the current array will become elements with indices "shifts" in the rotated array.

◆ scanInPlace()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<class Functor >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::scanInPlace ( Functor  f)

This method applies a single-argument functor to each element of the array. The result returned by the functor is ignored inside the scan. Depending on what the functor does, the array values may or may not be modified (they can be modified if the functor takes its argument via a non-const reference).

◆ setData()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::setData ( const Num2 *  data,
unsigned long  dataLength 
)

This method modifies all the data in one statement

◆ shape()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayShape npstat::ArrayND< Numeric, StackLen, StackDim >::shape ( ) const

Get the complete shape

◆ shapeData()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
const unsigned* npstat::ArrayND< Numeric, StackLen, StackDim >::shapeData ( ) const
inline

Shape data as a C-style array

◆ sliceShape()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayShape npstat::ArrayND< Numeric, StackLen, StackDim >::sliceShape ( const unsigned *  fixedIndices,
unsigned  nFixedIndices 
) const

Figure out the slice shape without actually making the slice

◆ span()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::span ( unsigned  dim) const

Get the number of elements in some particular dimension

◆ strides()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
const unsigned long* npstat::ArrayND< Numeric, StackLen, StackDim >::strides ( ) const
inline

Get the strides

◆ sum()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 npstat::ArrayND< Numeric, StackLen, StackDim >::sum ( ) const

Sum of all array elements which uses Num2 type as accumulator. Typically, the precision and dynamic range of Num2 should be suitably larger than the precision and dynamic range of Numeric. For example, if Numeric is float then Num2 should be double, etc.

◆ sumsq()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 = typename PreciseType<Numeric>::type>
Num2 npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq ( ) const

Sum of absolute values squared which uses Num2 as accumulator. Function std::abs(Numeric) must exist.

◆ transpose() [1/2]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::transpose ( ) const

Transpose without arguments can be invoked for 2-d arrays only

◆ transpose() [2/2]

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::transpose ( unsigned  pos1,
unsigned  pos2 
) const

Transposed array

◆ uninitialize()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize ( )

The function which can "uninitialize" the array to the same state as produced by the default constructor. Can be applied in order to force the assignment operators to work.

◆ value()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::value ( const unsigned *  index,
unsigned  indexLen 
)

Element access using multidimensional array index (no bounds checking). The length of the index array must be equal to the rank of this object.

◆ valueAt()

template<typename Numeric , unsigned StackLen, unsigned StackDim>
Numeric& npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt ( const unsigned *  index,
unsigned  indexLen 
)

Element access using multidimensional array index (with bounds checking)


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