CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
npstat::ArrayND< Numeric, StackLen, StackDim > Class Template Reference

#include <ArrayND.h>

Public Types

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

Public Member Functions

template<typename Num3 , typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDaddmul (const ArrayND< Num2, Len2, Dim2 > &r, const Num3 &c)
 
template<typename Num3 , typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > & addmul (const ArrayND< Num2, Len2, Dim2 > &r, const Num3 &c)
 
template<class Functor >
ArrayNDapply (Functor f)
 
template<class Functor >
ArrayND< Numeric, Len, Dim > & apply (Functor f)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void applySlice (ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
 
 ArrayND ()
 
 ArrayND (const 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)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
ArrayNDassign (const ArrayND< Num2, Len2, Dim2 > &, Functor f)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
ArrayND< Numeric, Len, Dim > & assign (const ArrayND< Num2, Len2, Dim2 > &r, Functor f)
 
template<typename Num2 >
ArrayND cdfArray (double scale=1.0) const
 
template<typename Accumulator >
ArrayND< Numeric, Len, Dim > cdfArray (const double inscale) const
 
template<typename Num2 >
Num2 cdfValue (const unsigned *index, unsigned indexLen) const
 
template<typename Accumulator >
Accumulator cdfValue (const unsigned *index, const unsigned indexLen) const
 
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)
 
ArrayNDclear ()
 
ArrayNDconstFill (Numeric c)
 
ArrayND contract (unsigned pos1, unsigned pos2) const
 
void convertLinearIndex (unsigned long l, unsigned *index, unsigned indexLen) const
 
template<typename Num2 >
void convertToLastDimCdf (ArrayND *sumSlice, bool useTrapezoids)
 
const Numeric * data () const
 
template<typename Num2 >
ArrayND derivative (double scale=1.0) const
 
template<typename Accumulator >
ArrayND< Numeric, Len, Dim > derivative (const double inscale) 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< Numeric, Len, Dim > dot (const ArrayND< Num2, Len2, Dim2 > &r) const
 
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>
void exportSlice (ArrayND< Num2, Len2, Dim2 > *slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) 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, class Functor >
void flatCircularScan (ArrayND< Num2, Len2, Dim2 > &other, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, unsigned arrLen, Functor binaryFunct)
 
ArrayRange fullRange () const
 
template<class Functor >
ArrayNDfunctorFill (Functor f)
 
template<class Functor >
ArrayND< Numeric, Len, Dim > & functorFill (Functor f)
 
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 , unsigned Len2, unsigned Dim2>
void importSubrange (const unsigned *fromCorner, unsigned lenCorner, const ArrayND< Num2, Len2, Dim2 > &from)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDinPlaceMul (const ArrayND< Num2, Len2, Dim2 > &r)
 
Numeric interpolate1 (const double *x, unsigned xDim) const
 
Numeric interpolate3 (const double *x, unsigned xDim) const
 
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 isDensity () const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool isShapeCompatible (const ArrayND< Num2, Len2, Dim2 > &r) const
 
bool isShapeKnown () const
 
bool isZero () const
 
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 Op >
void jointSliceLoop (const unsigned level, const unsigned long idx0, const unsigned level1, const unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, const unsigned nFixedIndices, Op fcn)
 
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 , 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)
 
unsigned long length () const
 
ArrayNDlinearFill (const double *coeff, unsigned coeffLen, double c)
 
unsigned long linearIndex (const unsigned *idx, unsigned idxLen) const
 
unsigned makeCopulaSteps (double tolerance, unsigned maxIterations)
 
ArrayNDmakeNonNegative ()
 
ArrayNDmakeUnit ()
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND marginalize (const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, unsigned mapLen) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, StackLen,
StackDim > 
marginalize (const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, const unsigned mapLen) const
 
Numeric max () const
 
Numeric max (unsigned *index, unsigned indexLen) const
 
template<unsigned Len2, unsigned Dim2>
double maxAbsDifference (const ArrayND< Numeric, Len2, Dim2 > &) const
 
unsigned maximumSpan () const
 
Numeric min () const
 
Numeric min (unsigned *index, unsigned indexLen) const
 
unsigned minimumSpan () const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void multiMirror (ArrayND< Num2, Len2, Dim2 > *out) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDmultiplyBySlice (const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices)
 
template<unsigned Len2, unsigned Dim2>
bool operator!= (const ArrayND< Numeric, Len2, Dim2 > &) const
 
template<typename Num2 >
ArrayND operator* (const Num2 &r) const
 
template<typename Num2 >
ArrayND< Numeric, Len, Dim > operator* (const Num2 &r) const
 
template<typename Num2 >
ArrayND< Numeric, Len, Dim > & operator*= (const Num2 &r)
 
ArrayND operator+ () const
 
template<unsigned Len2, unsigned Dim2>
ArrayND operator+ (const ArrayND< Numeric, Len2, Dim2 > &r) const
 
template<unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > operator+ (const ArrayND< Numeric, Len2, Dim2 > &r) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > & operator+= (const ArrayND< Num2, Len2, Dim2 > &r)
 
ArrayND operator- () const
 
template<unsigned Len2, unsigned Dim2>
ArrayND operator- (const ArrayND< Numeric, Len2, Dim2 > &r) const
 
template<unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > operator- (const ArrayND< Numeric, Len2, Dim2 > &r) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > & operator-= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<typename Num2 >
ArrayND operator/ (const Num2 &r) const
 
template<typename Num2 >
ArrayND< Numeric, Len, Dim > operator/ (const Num2 &r) const
 
template<typename Num2 >
ArrayND< Numeric, Len, Dim > & operator/= (const Num2 &r)
 
ArrayNDoperator= (const ArrayND &)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayNDoperator= (const ArrayND< Num2, Len2, Dim2 > &)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > & operator= (const ArrayND< Num2, Len2, Dim2 > &r)
 
template<unsigned Len2, unsigned Dim2>
bool operator== (const ArrayND< Numeric, Len2, Dim2 > &) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND outer (const ArrayND< Num2, Len2, Dim2 > &r) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND< Numeric, Len, Dim > outer (const ArrayND< Num2, Len2, Dim2 > &r) const
 
template<typename Num2 , typename Integer >
void processSubrange (AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
 
unsigned rank () const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void rotate (const unsigned *shifts, unsigned lenShifts, ArrayND< Num2, Len2, Dim2 > *rotated) const
 
template<class Functor >
ArrayNDscanInPlace (Functor f)
 
template<class Functor >
ArrayND< Numeric, Len, Dim > & scanInPlace (Functor f)
 
template<typename Num2 >
ArrayNDsetData (const Num2 *data, unsigned long dataLength)
 
template<typename Num2 >
ArrayND< Numeric, Len, Dim > & setData (const Num2 *data, const unsigned long dataLength)
 
ArrayShape shape () const
 
const unsigned * shapeData () const
 
unsigned span (unsigned dim) const
 
const unsigned long * strides () const
 
template<typename Num2 >
Num2 sum () const
 
template<typename Num2 >
Num2 sumsq () const
 
ArrayND transpose (unsigned pos1, unsigned pos2) const
 
ArrayND transpose () const
 
ArrayNDuninitialize ()
 
 ~ArrayND ()
 
 ArrayND (const ArrayShape &shape)
 
 ArrayND (const unsigned *shape, unsigned dim)
 
 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)
 
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
 
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)
 
Numeric & closest (const double *x, unsigned xDim)
 
const Numeric & closest (const double *x, unsigned xDim) const
 
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
 
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 void restore (const gs::ClassId &id, std::istream &in, ArrayND *array)
 
static unsigned version ()
 

Private Member Functions

void buildFromShapePtr (const unsigned *, unsigned)
 
void buildStrides ()
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void circularFlatLoop (unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void commonSubrangeLoop (unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
void contractLoop (unsigned thisLevel, unsigned resLevel, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
 
template<typename Accumulator >
void convertToLastDimCdfLoop (ArrayND *sumSlice, unsigned level, unsigned long idx0, unsigned long idxSlice, bool useTrapezoids)
 
unsigned coordToIndex (double coord, unsigned idim) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void copyRangeLoopFunct (unsigned level, unsigned long idx0, unsigned long idx1, const ArrayND< Num2, Len2, Dim2 > &r, const ArrayRange &range, Functor f)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void dotProductLoop (unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num2, Len2, Dim2 > &r, ArrayND &result) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void dualCircularLoop (unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void flatCircularLoop (unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
template<class Functor >
void functorFillLoop (unsigned level, unsigned long idx, Functor f, unsigned *farg)
 
Numeric interpolateLoop (unsigned level, const double *x, const Numeric *base) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void jointSliceLoop (unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
 
void linearFillLoop (unsigned level, double s0, unsigned long idx, double shift, const double *coeffs)
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
Numeric marginalizeInnerLoop (unsigned long idx, unsigned levelPr, unsigned long idxPr, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void marginalizeLoop (unsigned level, unsigned long idx, unsigned levelRes, unsigned long idxRes, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, ArrayND &res) const
 
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
void outerProductLoop (unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num1, Len1, Dim1 > &a1, const ArrayND< Num2, Len2, Dim2 > &a2)
 
template<typename Num2 , typename Integer >
void processSubrangeLoop (unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
 
template<typename Num2 >
void projectInnerLoop (unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 >
void projectInnerLoop2 (unsigned level, unsigned long idx0, AbsVisitor< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 , class Op >
void projectLoop (unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, unsigned *currentIndex, ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 , class Op >
void projectLoop2 (unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
 
template<typename Num2 , class Functor >
void scaleBySliceInnerLoop (unsigned level, unsigned long idx0, Num2 &scale, const unsigned *projectedIndices, unsigned nProjectedIndices, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void scaleBySliceLoop (unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
 
template<typename Accumulator >
Accumulator sumBelowLoop (unsigned level, unsigned long idx0, const unsigned *limit) const
 
void transposeLoop (unsigned level, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void verifyProjectionCompatibility (const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
unsigned long verifySliceCompatibility (const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
 

Private Attributes

Numeric * data_
 
unsigned dim_
 
unsigned long len_
 
Numeric localData_ [StackLen]
 
unsigned localShape_ [StackDim]
 
unsigned long localStrides_ [StackDim]
 
unsigned * shape_
 
bool shapeIsKnown_
 
unsigned long * strides_
 

Friends

template<typename Num2 , unsigned Len2, unsigned Dim2>
class ArrayND
 

Detailed Description

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

Definition at line 48 of file ArrayND.h.

Member Typedef Documentation

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
typedef ProperDblFromCmpl<Numeric>::type npstat::ArrayND< Numeric, StackLen, StackDim >::proper_double

Definition at line 55 of file ArrayND.h.

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
typedef Numeric npstat::ArrayND< Numeric, StackLen, StackDim >::value_type

Definition at line 54 of file ArrayND.h.

Constructor & Destructor Documentation

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

Default constructor creates an uninitialized array. Only three 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.

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

Definition at line 2388 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND().

2389  : data_(0), strides_(0), shape_(0),
2390  len_(0UL), dim_(0U), shapeIsKnown_(false)
2391  {
2392  localData_[0] = Numeric();
2393  data_ = localData_;
2394  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 2602 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr().

2603  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2604  {
2605  const unsigned sz = sh.size();
2606  buildFromShapePtr(sz ? &sh[0] : 0, sz);
2607  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const unsigned *  shape,
unsigned  dim 
)

Definition at line 2610 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr().

2612  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2613  {
2614  buildFromShapePtr(sizes, dim);
2615  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Numeric, StackLen, StackDim > &  r)

The copy constructor

Definition at line 2397 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::ArrayND< Numeric, StackLen, StackDim >::localStrides_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

2398  : data_(0), strides_(0), shape_(0),
2399  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2400  {
2401  if (dim_)
2402  {
2403  // Copy the shape
2404  shape_ = makeBuffer(dim_, localShape_, Dim);
2405  copyBuffer(shape_, r.shape_, dim_);
2406 
2407  // Copy the strides
2409  copyBuffer(strides_, r.strides_, dim_);
2410 
2411  // Copy the data
2412  data_ = makeBuffer(len_, localData_, Len);
2413  copyBuffer(data_, r.data_, len_);
2414  }
2415  else
2416  {
2417  assert(len_ == 1UL);
2418  localData_[0] = r.localData_[0];
2419  data_ = localData_;
2420  }
2421  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  r)

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.

Definition at line 2425 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::ArrayND< Numeric, StackLen, StackDim >::localStrides_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

2426  : data_(0), strides_(0), shape_(0),
2427  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2428  {
2429  if (dim_)
2430  {
2431  // Copy the shape
2432  shape_ = makeBuffer(dim_, localShape_, Dim);
2433  copyBuffer(shape_, r.shape_, dim_);
2434 
2435  // Copy the strides
2437  copyBuffer(strides_, r.strides_, dim_);
2438 
2439  // Copy the data
2440  data_ = makeBuffer(len_, localData_, Len);
2441  copyBuffer(data_, r.data_, len_);
2442  }
2443  else
2444  {
2445  assert(len_ == 1UL);
2446  localData_[0] = static_cast<Numeric>(r.localData_[0]);
2447  data_ = localData_;
2448  }
2449  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  r,
Functor  f 
)

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

Definition at line 2453 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::ArrayND< Numeric, StackLen, StackDim >::localStrides_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

2455  : data_(0), strides_(0), shape_(0),
2456  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2457  {
2458  if (dim_)
2459  {
2460  // Copy the shape
2461  shape_ = makeBuffer(dim_, localShape_, Dim);
2462  copyBuffer(shape_, r.shape_, dim_);
2463 
2464  // Copy the strides
2466  copyBuffer(strides_, r.strides_, dim_);
2467 
2468  // Copy the data
2469  data_ = makeBuffer(len_, localData_, Len);
2470  for (unsigned long i=0; i<len_; ++i)
2471  data_[i] = static_cast<Numeric>(f(r.data_[i]));
2472  }
2473  else
2474  {
2475  assert(len_ == 1UL);
2476  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
2477  data_ = localData_;
2478  }
2479  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
int i
Definition: DBlmapReader.cc:9
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  from,
const ArrayRange fromRange 
)

Constructor from a subrange of another array

Definition at line 2513 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::clearBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayRange::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::ArrayRange::lowerLimits(), npstat::makeBuffer(), alignCSCRings::r, npstat::ArrayRange::rangeLength(), npstat::ArrayRange::rangeSize(), and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

2515  : data_(0), strides_(0), shape_(0),
2516  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2517  {
2518  if (!range.isCompatible(r.shape_, r.dim_))
2520  "In npstat::ArrayND subrange constructor: invalid subrange");
2521  if (dim_)
2522  {
2523  len_ = range.rangeSize();
2524  if (!len_)
2526  "In npstat::ArrayND subrange constructor: empty subrange");
2527 
2528  // Figure out the shape
2529  shape_ = makeBuffer(dim_, localShape_, Dim);
2530  range.rangeLength(shape_, dim_);
2531 
2532  // Figure out the strides
2533  buildStrides();
2534 
2535  // Allocate the data array
2536  data_ = makeBuffer(len_, localData_, Len);
2537 
2538  // Copy the data
2539  if (dim_ > CHAR_BIT*sizeof(unsigned long))
2541  "In npstat::ArrayND subrange constructor: "
2542  "input array rank is too large");
2543  unsigned lolim[CHAR_BIT*sizeof(unsigned long)];
2544  range.lowerLimits(lolim, dim_);
2545  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
2546  clearBuffer(toBuf, dim_);
2547  (const_cast<ArrayND<Num2, Len2, Dim2>&>(r)).commonSubrangeLoop(
2548  0U, 0UL, 0UL, lolim, shape_, toBuf, *this,
2549  scast_assign_right<Num2,Numeric>());
2550  }
2551  else
2552  {
2553  assert(len_ == 1UL);
2554  localData_[0] = static_cast<Numeric>(r.localData_[0]);
2555  data_ = localData_;
2556  }
2557  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
void buildStrides()
Definition: ArrayND.h:2377
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:57
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Num2, Len2, Dim2 > &  from,
const ArrayRange fromRange,
Functor  f 
)

Similar constructor with a transforming functor

Definition at line 2561 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::copyRangeLoopFunct(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, i, npstat::ArrayRange::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::length(), npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::makeBuffer(), npstat::ArrayRange::rangeSize(), and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

2564  : data_(0), strides_(0), shape_(0),
2565  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2566  {
2567  if (!range.isCompatible(r.shape_, r.dim_))
2569  "In npstat::ArrayND transforming subrange constructor: "
2570  "incompatible subrange");
2571  if (dim_)
2572  {
2573  len_ = range.rangeSize();
2574  if (!len_)
2576  "In npstat::ArrayND transforming subrange constructor: "
2577  "empty subrange");
2578 
2579  // Figure out the shape
2580  shape_ = makeBuffer(dim_, localShape_, Dim);
2581  for (unsigned i=0; i<dim_; ++i)
2582  shape_[i] = range[i].length();
2583 
2584  // Figure out the strides
2585  buildStrides();
2586 
2587  // Allocate the data array
2588  data_ = makeBuffer(len_, localData_, Len);
2589 
2590  // Transform the data
2591  copyRangeLoopFunct(0U, 0UL, 0UL, r, range, f);
2592  }
2593  else
2594  {
2595  assert(len_ == 1UL);
2596  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
2597  data_ = localData_;
2598  }
2599  }
int i
Definition: DBlmapReader.cc:9
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
void buildStrides()
Definition: ArrayND.h:2377
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long length() const
Definition: ArrayND.h:231
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
void copyRangeLoopFunct(unsigned level, unsigned long idx0, unsigned long idx1, const ArrayND< Num2, Len2, Dim2 > &r, const ArrayRange &range, Functor f)
Definition: ArrayND.h:2483
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
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".

Definition at line 1630 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

1633  : data_(0), strides_(0), shape_(0),
1634  len_(1UL), dim_(slicedArray.dim_ - nFixedIndices),
1635  shapeIsKnown_(true)
1636  {
1637  if (nFixedIndices)
1638  {
1639  assert(fixedIndices);
1640  if (nFixedIndices > slicedArray.dim_) throw npstat::NpstatInvalidArgument(
1641  "In npstat::ArrayND slicing constructor: too many fixed indices");
1642  if (!slicedArray.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
1643  "In npstat::ArrayND slicing constructor: "
1644  "uninitialized argument array");
1645 
1646  // Check that the fixed indices are within range
1647  for (unsigned j=0; j<nFixedIndices; ++j)
1648  if (fixedIndices[j] >= slicedArray.dim_)
1649  throw npstat::NpstatOutOfRange("In npstat::ArrayND slicing "
1650  "constructor: fixed index out of range");
1651 
1652  // Build the shape for the slice
1653  shape_ = makeBuffer(dim_, localShape_, StackDim);
1654  unsigned idim = 0;
1655  for (unsigned i=0; i<slicedArray.dim_; ++i)
1656  {
1657  bool fixed = false;
1658  for (unsigned j=0; j<nFixedIndices; ++j)
1659  if (fixedIndices[j] == i)
1660  {
1661  fixed = true;
1662  break;
1663  }
1664  if (!fixed)
1665  {
1666  assert(idim < dim_);
1667  shape_[idim++] = slicedArray.shape_[i];
1668  }
1669  }
1670  assert(idim == dim_);
1671 
1672  if (dim_)
1673  {
1674  // Copy the array shape and figure out the array length
1675  for (unsigned i=0; i<dim_; ++i)
1676  len_ *= shape_[i];
1677 
1678  // Figure out the array strides
1679  buildStrides();
1680 
1681  // Allocate the data array
1682  data_ = makeBuffer(len_, localData_, StackLen);
1683  }
1684  else
1685  {
1686  localData_[0] = Numeric();
1687  data_ = localData_;
1688  }
1689  }
1690  else
1691  {
1692  new (this) ArrayND(slicedArray);
1693  }
1694  }
int i
Definition: DBlmapReader.cc:9
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
void buildStrides()
Definition: ArrayND.h:2377
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const ArrayND< Num1, Len1, Dim1 > &  a1,
const ArrayND< Num2, Len2, Dim2 > &  a2 
)

Outer product constructor

Definition at line 2839 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::outerProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

2841  : data_(0), strides_(0), shape_(0),
2842  len_(1UL), dim_(a1.dim_ + a2.dim_), shapeIsKnown_(true)
2843  {
2844  if (!(a1.shapeIsKnown_ && a2.shapeIsKnown_))
2846  "In npstat::ArrayND outer product constructor: "
2847  "uninitialized argument array");
2848  if (dim_)
2849  {
2850  shape_ = makeBuffer(dim_, localShape_, Dim);
2851  copyBuffer(shape_, a1.shape_, a1.dim_);
2852  copyBuffer(shape_+a1.dim_, a2.shape_, a2.dim_);
2853 
2854  for (unsigned i=0; i<dim_; ++i)
2855  {
2856  assert(shape_[i]);
2857  len_ *= shape_[i];
2858  }
2859 
2860  // Figure out the array strides
2861  buildStrides();
2862 
2863  // Allocate the data array
2864  data_ = makeBuffer(len_, localData_, Len);
2865 
2866  // Fill the data array
2867  if (a1.dim_ == 0)
2868  {
2869  for (unsigned long i=0; i<len_; ++i)
2870  data_[i] = a1.localData_[0] * a2.data_[i];
2871  }
2872  else if (a2.dim_ == 0)
2873  {
2874  for (unsigned long i=0; i<len_; ++i)
2875  data_[i] = a1.data_[i] * a2.localData_[0];
2876  }
2877  else
2878  outerProductLoop(0U, 0UL, 0UL, 0UL, a1, a2);
2879  }
2880  else
2881  {
2882  localData_[0] = a1.localData_[0] * a2.localData_[0];
2883  data_ = localData_;
2884  }
2885  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
int i
Definition: DBlmapReader.cc:9
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
void buildStrides()
Definition: ArrayND.h:2377
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
void outerProductLoop(unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num1, Len1, Dim1 > &a1, const ArrayND< Num2, Len2, Dim2 > &a2)
Definition: ArrayND.h:2810
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0)
explicit

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

Definition at line 2618 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2619  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2620  {
2621  const unsigned dim = 1U;
2622  unsigned sizes[dim];
2623  sizes[0] = n0;
2624  buildFromShapePtr(sizes, dim);
2625  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1 
)

Definition at line 2628 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2630  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2631  {
2632  const unsigned dim = 2U;
2633  unsigned sizes[dim];
2634  sizes[0] = n0;
2635  sizes[1] = n1;
2636  buildFromShapePtr(sizes, dim);
2637  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2 
)

Definition at line 2640 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2643  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2644  {
2645  const unsigned dim = 3U;
2646  unsigned sizes[dim];
2647  sizes[0] = n0;
2648  sizes[1] = n1;
2649  sizes[2] = n2;
2650  buildFromShapePtr(sizes, dim);
2651  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3 
)

Definition at line 2654 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2658  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2659  {
2660  const unsigned dim = 4U;
2661  unsigned sizes[dim];
2662  sizes[0] = n0;
2663  sizes[1] = n1;
2664  sizes[2] = n2;
2665  sizes[3] = n3;
2666  buildFromShapePtr(sizes, dim);
2667  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4 
)

Definition at line 2670 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2675  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2676  {
2677  const unsigned dim = 5U;
2678  unsigned sizes[dim];
2679  sizes[0] = n0;
2680  sizes[1] = n1;
2681  sizes[2] = n2;
2682  sizes[3] = n3;
2683  sizes[4] = n4;
2684  buildFromShapePtr(sizes, dim);
2685  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4,
unsigned  n5 
)

Definition at line 2688 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2694  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2695  {
2696  const unsigned dim = 6U;
2697  unsigned sizes[dim];
2698  sizes[0] = n0;
2699  sizes[1] = n1;
2700  sizes[2] = n2;
2701  sizes[3] = n3;
2702  sizes[4] = n4;
2703  sizes[5] = n5;
2704  buildFromShapePtr(sizes, dim);
2705  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4,
unsigned  n5,
unsigned  n6 
)

Definition at line 2708 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2715  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2716  {
2717  const unsigned dim = 7U;
2718  unsigned sizes[dim];
2719  sizes[0] = n0;
2720  sizes[1] = n1;
2721  sizes[2] = n2;
2722  sizes[3] = n3;
2723  sizes[4] = n4;
2724  sizes[5] = n5;
2725  sizes[6] = n6;
2726  buildFromShapePtr(sizes, dim);
2727  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4,
unsigned  n5,
unsigned  n6,
unsigned  n7 
)

Definition at line 2730 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2738  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2739  {
2740  const unsigned dim = 8U;
2741  unsigned sizes[dim];
2742  sizes[0] = n0;
2743  sizes[1] = n1;
2744  sizes[2] = n2;
2745  sizes[3] = n3;
2746  sizes[4] = n4;
2747  sizes[5] = n5;
2748  sizes[6] = n6;
2749  sizes[7] = n7;
2750  buildFromShapePtr(sizes, dim);
2751  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4,
unsigned  n5,
unsigned  n6,
unsigned  n7,
unsigned  n8 
)

Definition at line 2754 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2763  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2764  {
2765  const unsigned dim = 9U;
2766  unsigned sizes[dim];
2767  sizes[0] = n0;
2768  sizes[1] = n1;
2769  sizes[2] = n2;
2770  sizes[3] = n3;
2771  sizes[4] = n4;
2772  sizes[5] = n5;
2773  sizes[6] = n6;
2774  sizes[7] = n7;
2775  sizes[8] = n8;
2776  buildFromShapePtr(sizes, dim);
2777  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3,
unsigned  n4,
unsigned  n5,
unsigned  n6,
unsigned  n7,
unsigned  n8,
unsigned  n9 
)

Definition at line 2780 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), and n0.

2790  : data_(0), strides_(0), shape_(0), len_(1UL), shapeIsKnown_(true)
2791  {
2792  const unsigned dim = 10U;
2793  unsigned sizes[dim];
2794  sizes[0] = n0;
2795  sizes[1] = n1;
2796  sizes[2] = n2;
2797  sizes[3] = n3;
2798  sizes[4] = n4;
2799  sizes[5] = n5;
2800  sizes[6] = n6;
2801  sizes[7] = n7;
2802  sizes[8] = n8;
2803  sizes[9] = n9;
2804  buildFromShapePtr(sizes, dim);
2805  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1594
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::~ArrayND ( )
inline

Destructor

Definition at line 2888 of file ArrayND.h.

References npstat::destroyBuffer().

2889  {
2893  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
Numeric * data_
Definition: ArrayND.h:1001
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33

Member Function Documentation

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num3 , typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::addmul ( const ArrayND< Num2, Len2, Dim2 > &  r,
const Num3 &  c 
)

Definition at line 4403 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, and i.

4405  {
4407  "In npstat::ArrayND::addmul: "
4408  "incompatible argument array shape");
4409  for (unsigned long i=0; i<len_; ++i)
4410  data_[i] += r.data_[i]*c;
4411  return *this;
4412  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
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

Definition at line 1987 of file ArrayND.h.

References npstat::destroyBuffer(), i, and npstat::makeBuffer().

1992  {
1993  assert(projection);
1994  verifyProjectionCompatibility(*projection, projectedIndices,
1995  nProjectedIndices);
1996  unsigned ibuf[StackDim];
1997  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
1998  for (unsigned i=0; i<dim_; ++i)
1999  buf[i] = 0U;
2000  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
2001  projector, projectedIndices, nProjectedIndices,
2002  scast_pluseq_left<Num2,Num3>());
2003  destroyBuffer(buf, ibuf);
2004  }
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
void projectLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, unsigned *currentIndex, ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:1851
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
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,
AbsVisitor< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

Definition at line 2119 of file ArrayND.h.

2124  {
2125  assert(projection);
2126  verifyProjectionCompatibility(*projection, projectedIndices,
2127  nProjectedIndices);
2128  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2129  projector, projectedIndices, nProjectedIndices,
2130  scast_pluseq_left<Num2,Num3>());
2131  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void projectLoop2(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:2053
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), jetTools.AddJetCollection::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SetTagInfos::__call__(), and metUncertaintyTools.RunMEtUncertainties::__call__().

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<class Functor >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::apply ( Functor  f)

Definition at line 4562 of file ArrayND.h.

References f, and i.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), jetTools.AddJetCollection::__call__(), HiCoreTools.RemoveMCMatching::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SetTagInfos::__call__(), and metUncertaintyTools.RunMEtUncertainties::__call__().

4563  {
4565  "Initialize npstat::ArrayND before calling method \"apply\"");
4566  for (unsigned long i=0; i<len_; ++i)
4567  data_[i] = static_cast<Numeric>(f(data_[i]));
4568  return *this;
4569  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
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.

Definition at line 2235 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

Referenced by npstat::ArrayND< Num1, Len1, Dim1 >::multiplyBySlice().

2239  {
2240  if (nFixedIndices)
2241  {
2242  verifyProjectionCompatibility(slice, fixedIndices, nFixedIndices);
2243  if (slice.dim_ == 0U)
2244  for (unsigned long i=0; i<len_; ++i)
2245  binaryFunct(data_[i], slice.localData_[0]);
2246  else
2247  scaleBySliceLoop(0U, 0UL, 0U, 0UL, slice,
2248  fixedIndices, nFixedIndices, binaryFunct);
2249  }
2250  else
2251  jointScan(slice, binaryFunct);
2252  }
int i
Definition: DBlmapReader.cc:9
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void jointScan(ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:2221
void scaleBySliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:2175
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::assign ( const ArrayND< Num2, Len2, Dim2 > &  r,
Functor  f 
)

Definition at line 2957 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, f, i, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

2959  {
2960  if (shapeIsKnown_)
2961  {
2962  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
2963  "In npstat::ArrayND::assign: uninitialized argument array");
2965  "In npstat::ArrayND::assign: incompatible argument array shape");
2966  if (dim_)
2967  for (unsigned long i=0; i<len_; ++i)
2968  data_[i] = static_cast<Numeric>(f(r.data_[i]));
2969  else
2970  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
2971  }
2972  else
2973  {
2974  // This object is uninitialized. If the object on the
2975  // right is itself initialized, build new array in place.
2976  if (r.shapeIsKnown_)
2977  new (this) ArrayND(r, f);
2978  }
2979  return *this;
2980  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( )

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

Definition at line 3321 of file ArrayND.h.

3322  {
3324  "Initialize npstat::ArrayND before calling method \"at\"");
3326  "In npstat::ArrayND::at: wrong # of args (not rank 0 array)");
3327  return localData_[0];
3328  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( ) const

Definition at line 3311 of file ArrayND.h.

3312  {
3314  "Initialize npstat::ArrayND before calling method \"at\"");
3316  "In npstat::ArrayND::at: wrong # of args (not rank 0 array)");
3317  return localData_[0];
3318  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0)

Definition at line 3342 of file ArrayND.h.

3344  {
3345  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3346  "In npstat::ArrayND::at: wrong # of args (not rank 1 array)");
3347  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3348  "In npstat::ArrayND::at: index 0 out of range (rank 1)");
3349  return data_[i0];
3350  }
unsigned * shape_
Definition: ArrayND.h:1007
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0) const

Definition at line 3331 of file ArrayND.h.

3333  {
3334  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3335  "In npstat::ArrayND::at: wrong # of args (not rank 1 array)");
3336  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3337  "In npstat::ArrayND::at: index 0 out of range (rank 1)");
3338  return data_[i0];
3339  }
unsigned * shape_
Definition: ArrayND.h:1007
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1 
)

Definition at line 3387 of file ArrayND.h.

3390  {
3391  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3392  "In npstat::ArrayND::at: wrong # of args (not rank 2 array)");
3393  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3394  "In npstat::ArrayND::at: index 0 out of range (rank 2)");
3395  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3396  "In npstat::ArrayND::at: index 1 out of range (rank 2)");
3397  return data_[i0*strides_[0] + i1];
3398  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1 
) const

Definition at line 3373 of file ArrayND.h.

3376  {
3377  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3378  "In npstat::ArrayND::at: wrong # of args (not rank 2 array)");
3379  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3380  "In npstat::ArrayND::at: index 0 out of range (rank 2)");
3381  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3382  "In npstat::ArrayND::at: index 1 out of range (rank 2)");
3383  return data_[i0*strides_[0] + i1];
3384  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2 
)

Definition at line 3880 of file ArrayND.h.

3884  {
3885  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3886  "In npstat::ArrayND::at: wrong # of args (not rank 3 array)");
3887  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3888  "In npstat::ArrayND::at: index 0 out of range (rank 3)");
3889  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3890  "In npstat::ArrayND::at: index 1 out of range (rank 3)");
3891  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3892  "In npstat::ArrayND::at: index 2 out of range (rank 3)");
3893  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3894  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2 
) const

Definition at line 3651 of file ArrayND.h.

3655  {
3656  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3657  "In npstat::ArrayND::at: wrong # of args (not rank 3 array)");
3658  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3659  "In npstat::ArrayND::at: index 0 out of range (rank 3)");
3660  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3661  "In npstat::ArrayND::at: index 1 out of range (rank 3)");
3662  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3663  "In npstat::ArrayND::at: index 2 out of range (rank 3)");
3664  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3665  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3 
)

Definition at line 3897 of file ArrayND.h.

3902  {
3903  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3904  "In npstat::ArrayND::at: wrong # of args (not rank 4 array)");
3905  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3906  "In npstat::ArrayND::at: index 0 out of range (rank 4)");
3907  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3908  "In npstat::ArrayND::at: index 1 out of range (rank 4)");
3909  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3910  "In npstat::ArrayND::at: index 2 out of range (rank 4)");
3911  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3912  "In npstat::ArrayND::at: index 3 out of range (rank 4)");
3913  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3914  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3 
) const

Definition at line 3668 of file ArrayND.h.

3673  {
3674  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3675  "In npstat::ArrayND::at: wrong # of args (not rank 4 array)");
3676  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3677  "In npstat::ArrayND::at: index 0 out of range (rank 4)");
3678  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3679  "In npstat::ArrayND::at: index 1 out of range (rank 4)");
3680  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3681  "In npstat::ArrayND::at: index 2 out of range (rank 4)");
3682  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3683  "In npstat::ArrayND::at: index 3 out of range (rank 4)");
3684  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3685  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4 
)

Definition at line 3917 of file ArrayND.h.

3923  {
3924  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3925  "In npstat::ArrayND::at: wrong # of args (not rank 5 array)");
3926  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3927  "In npstat::ArrayND::at: index 0 out of range (rank 5)");
3928  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3929  "In npstat::ArrayND::at: index 1 out of range (rank 5)");
3930  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3931  "In npstat::ArrayND::at: index 2 out of range (rank 5)");
3932  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3933  "In npstat::ArrayND::at: index 3 out of range (rank 5)");
3934  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3935  "In npstat::ArrayND::at: index 4 out of range (rank 5)");
3936  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3937  i3*strides_[3] + i4];
3938  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4 
) const

Definition at line 3688 of file ArrayND.h.

3694  {
3695  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3696  "In npstat::ArrayND::at: wrong # of args (not rank 5 array)");
3697  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3698  "In npstat::ArrayND::at: index 0 out of range (rank 5)");
3699  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3700  "In npstat::ArrayND::at: index 1 out of range (rank 5)");
3701  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3702  "In npstat::ArrayND::at: index 2 out of range (rank 5)");
3703  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3704  "In npstat::ArrayND::at: index 3 out of range (rank 5)");
3705  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3706  "In npstat::ArrayND::at: index 4 out of range (rank 5)");
3707  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3708  i3*strides_[3] + i4];
3709  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5 
)

Definition at line 3941 of file ArrayND.h.

3948  {
3949  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3950  "In npstat::ArrayND::at: wrong # of args (not rank 6 array)");
3951  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3952  "In npstat::ArrayND::at: index 0 out of range (rank 6)");
3953  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3954  "In npstat::ArrayND::at: index 1 out of range (rank 6)");
3955  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3956  "In npstat::ArrayND::at: index 2 out of range (rank 6)");
3957  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3958  "In npstat::ArrayND::at: index 3 out of range (rank 6)");
3959  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3960  "In npstat::ArrayND::at: index 4 out of range (rank 6)");
3961  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3962  "In npstat::ArrayND::at: index 5 out of range (rank 6)");
3963  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3964  i3*strides_[3] + i4*strides_[4] + i5];
3965  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5 
) const

Definition at line 3712 of file ArrayND.h.

3719  {
3720  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3721  "In npstat::ArrayND::at: wrong # of args (not rank 6 array)");
3722  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3723  "In npstat::ArrayND::at: index 0 out of range (rank 6)");
3724  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3725  "In npstat::ArrayND::at: index 1 out of range (rank 6)");
3726  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3727  "In npstat::ArrayND::at: index 2 out of range (rank 6)");
3728  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3729  "In npstat::ArrayND::at: index 3 out of range (rank 6)");
3730  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3731  "In npstat::ArrayND::at: index 4 out of range (rank 6)");
3732  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3733  "In npstat::ArrayND::at: index 5 out of range (rank 6)");
3734  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3735  i3*strides_[3] + i4*strides_[4] + i5];
3736  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6 
)

Definition at line 3968 of file ArrayND.h.

3976  {
3977  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3978  "In npstat::ArrayND::at: wrong # of args (not rank 7 array)");
3979  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3980  "In npstat::ArrayND::at: index 0 out of range (rank 7)");
3981  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3982  "In npstat::ArrayND::at: index 1 out of range (rank 7)");
3983  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3984  "In npstat::ArrayND::at: index 2 out of range (rank 7)");
3985  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3986  "In npstat::ArrayND::at: index 3 out of range (rank 7)");
3987  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3988  "In npstat::ArrayND::at: index 4 out of range (rank 7)");
3989  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3990  "In npstat::ArrayND::at: index 5 out of range (rank 7)");
3991  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3992  "In npstat::ArrayND::at: index 6 out of range (rank 7)");
3993  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3994  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3995  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6 
) const

Definition at line 3739 of file ArrayND.h.

3747  {
3748  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3749  "In npstat::ArrayND::at: wrong # of args (not rank 7 array)");
3750  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3751  "In npstat::ArrayND::at: index 0 out of range (rank 7)");
3752  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3753  "In npstat::ArrayND::at: index 1 out of range (rank 7)");
3754  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3755  "In npstat::ArrayND::at: index 2 out of range (rank 7)");
3756  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3757  "In npstat::ArrayND::at: index 3 out of range (rank 7)");
3758  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3759  "In npstat::ArrayND::at: index 4 out of range (rank 7)");
3760  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3761  "In npstat::ArrayND::at: index 5 out of range (rank 7)");
3762  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3763  "In npstat::ArrayND::at: index 6 out of range (rank 7)");
3764  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3765  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3766  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7 
)

Definition at line 3998 of file ArrayND.h.

4007  {
4008  if (8U != dim_) throw npstat::NpstatInvalidArgument(
4009  "In npstat::ArrayND::at: wrong # of args (not rank 8 array)");
4010  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4011  "In npstat::ArrayND::at: index 0 out of range (rank 8)");
4012  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4013  "In npstat::ArrayND::at: index 1 out of range (rank 8)");
4014  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4015  "In npstat::ArrayND::at: index 2 out of range (rank 8)");
4016  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4017  "In npstat::ArrayND::at: index 3 out of range (rank 8)");
4018  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4019  "In npstat::ArrayND::at: index 4 out of range (rank 8)");
4020  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4021  "In npstat::ArrayND::at: index 5 out of range (rank 8)");
4022  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4023  "In npstat::ArrayND::at: index 6 out of range (rank 8)");
4024  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4025  "In npstat::ArrayND::at: index 7 out of range (rank 8)");
4026  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4027  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4028  i6*strides_[6] + i7];
4029  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7 
) const

Definition at line 3769 of file ArrayND.h.

3778  {
3779  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3780  "In npstat::ArrayND::at: wrong # of args (not rank 8 array)");
3781  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3782  "In npstat::ArrayND::at: index 0 out of range (rank 8)");
3783  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3784  "In npstat::ArrayND::at: index 1 out of range (rank 8)");
3785  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3786  "In npstat::ArrayND::at: index 2 out of range (rank 8)");
3787  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3788  "In npstat::ArrayND::at: index 3 out of range (rank 8)");
3789  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3790  "In npstat::ArrayND::at: index 4 out of range (rank 8)");
3791  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3792  "In npstat::ArrayND::at: index 5 out of range (rank 8)");
3793  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3794  "In npstat::ArrayND::at: index 6 out of range (rank 8)");
3795  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
3796  "In npstat::ArrayND::at: index 7 out of range (rank 8)");
3797  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3798  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3799  i6*strides_[6] + i7];
3800  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8 
)

Definition at line 4032 of file ArrayND.h.

4042  {
4043  if (9U != dim_) throw npstat::NpstatInvalidArgument(
4044  "In npstat::ArrayND::at: wrong # of args (not rank 9 array)");
4045  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4046  "In npstat::ArrayND::at: index 0 out of range (rank 9)");
4047  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4048  "In npstat::ArrayND::at: index 1 out of range (rank 9)");
4049  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4050  "In npstat::ArrayND::at: index 2 out of range (rank 9)");
4051  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4052  "In npstat::ArrayND::at: index 3 out of range (rank 9)");
4053  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4054  "In npstat::ArrayND::at: index 4 out of range (rank 9)");
4055  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4056  "In npstat::ArrayND::at: index 5 out of range (rank 9)");
4057  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4058  "In npstat::ArrayND::at: index 6 out of range (rank 9)");
4059  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4060  "In npstat::ArrayND::at: index 7 out of range (rank 9)");
4061  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4062  "In npstat::ArrayND::at: index 8 out of range (rank 9)");
4063  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4064  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4065  i6*strides_[6] + i7*strides_[7] + i8];
4066  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8 
) const

Definition at line 3803 of file ArrayND.h.

3813  {
3814  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3815  "In npstat::ArrayND::at: wrong # of args (not rank 9 array)");
3816  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3817  "In npstat::ArrayND::at: index 0 out of range (rank 9)");
3818  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3819  "In npstat::ArrayND::at: index 1 out of range (rank 9)");
3820  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3821  "In npstat::ArrayND::at: index 2 out of range (rank 9)");
3822  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3823  "In npstat::ArrayND::at: index 3 out of range (rank 9)");
3824  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3825  "In npstat::ArrayND::at: index 4 out of range (rank 9)");
3826  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3827  "In npstat::ArrayND::at: index 5 out of range (rank 9)");
3828  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3829  "In npstat::ArrayND::at: index 6 out of range (rank 9)");
3830  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
3831  "In npstat::ArrayND::at: index 7 out of range (rank 9)");
3832  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
3833  "In npstat::ArrayND::at: index 8 out of range (rank 9)");
3834  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3835  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3836  i6*strides_[6] + i7*strides_[7] + i8];
3837  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8,
unsigned  i9 
)

Definition at line 4069 of file ArrayND.h.

4080  {
4081  if (10U != dim_) throw npstat::NpstatInvalidArgument(
4082  "In npstat::ArrayND::at: wrong # of args (not rank 10 array)");
4083  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4084  "In npstat::ArrayND::at: index 0 out of range (rank 10)");
4085  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4086  "In npstat::ArrayND::at: index 1 out of range (rank 10)");
4087  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4088  "In npstat::ArrayND::at: index 2 out of range (rank 10)");
4089  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4090  "In npstat::ArrayND::at: index 3 out of range (rank 10)");
4091  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4092  "In npstat::ArrayND::at: index 4 out of range (rank 10)");
4093  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4094  "In npstat::ArrayND::at: index 5 out of range (rank 10)");
4095  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4096  "In npstat::ArrayND::at: index 6 out of range (rank 10)");
4097  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4098  "In npstat::ArrayND::at: index 7 out of range (rank 10)");
4099  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4100  "In npstat::ArrayND::at: index 8 out of range (rank 10)");
4101  if (i9 >= shape_[9]) throw npstat::NpstatOutOfRange(
4102  "In npstat::ArrayND::at: index 9 out of range (rank 10)");
4103  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4104  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4105  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
4106  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8,
unsigned  i9 
) const

Definition at line 3840 of file ArrayND.h.

3851  {
3852  if (10U != dim_) throw npstat::NpstatInvalidArgument(
3853  "In npstat::ArrayND::at: wrong # of args (not rank 10 array)");
3854  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3855  "In npstat::ArrayND::at: index 0 out of range (rank 10)");
3856  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3857  "In npstat::ArrayND::at: index 1 out of range (rank 10)");
3858  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3859  "In npstat::ArrayND::at: index 2 out of range (rank 10)");
3860  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3861  "In npstat::ArrayND::at: index 3 out of range (rank 10)");
3862  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3863  "In npstat::ArrayND::at: index 4 out of range (rank 10)");
3864  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3865  "In npstat::ArrayND::at: index 5 out of range (rank 10)");
3866  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3867  "In npstat::ArrayND::at: index 6 out of range (rank 10)");
3868  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
3869  "In npstat::ArrayND::at: index 7 out of range (rank 10)");
3870  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
3871  "In npstat::ArrayND::at: index 8 out of range (rank 10)");
3872  if (i9 >= shape_[9]) throw npstat::NpstatOutOfRange(
3873  "In npstat::ArrayND::at: index 9 out of range (rank 10)");
3874  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3875  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3876  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
3877  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::buildFromShapePtr ( const unsigned *  sizes,
unsigned  dim 
)
private

Definition at line 1594 of file ArrayND.h.

References i, and npstat::makeBuffer().

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND().

1596  {
1597  dim_ = dim;
1598  if (dim_)
1599  {
1600  assert(sizes);
1601  for (unsigned i=0; i<dim_; ++i)
1602  if (sizes[i] == 0)
1604  "In npstat::ArrayND::buildFromShapePtr: "
1605  "detected span of zero");
1606 
1607  // Copy the array shape and figure out the array length
1608  shape_ = makeBuffer(dim_, localShape_, Dim);
1609  for (unsigned i=0; i<dim_; ++i)
1610  {
1611  shape_[i] = sizes[i];
1612  len_ *= shape_[i];
1613  }
1614 
1615  // Figure out the array strides
1616  buildStrides();
1617 
1618  // Allocate the data array
1619  data_ = makeBuffer(len_, localData_, Len);
1620  }
1621  else
1622  {
1623  localData_[0] = Numeric();
1624  data_ = localData_;
1625  }
1626  }
int i
Definition: DBlmapReader.cc:9
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
void buildStrides()
Definition: ArrayND.h:2377
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::buildStrides ( )
private

Definition at line 2377 of file ArrayND.h.

References j, and npstat::makeBuffer().

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), and npstat::ArrayND< Numeric, StackLen, StackDim >::restore().

2378  {
2379  assert(dim_);
2380  if (strides_ == 0)
2382  strides_[dim_ - 1] = 1UL;
2383  for (unsigned j=dim_ - 1; j>0; --j)
2384  strides_[j - 1] = strides_[j]*shape_[j];
2385  }
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray ( double  scale = 1.0) const

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

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Accumulator >
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray ( const double  inscale) const

Definition at line 5173 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, npstat::ArrayND< Numeric, StackLen, StackDim >::length(), query::result, pileupReCalc_HLTpaths::scale, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and relativeConstraints::value.

5175  {
5177  "Initialize npstat::ArrayND before calling method \"cdfArray\"");
5178  if (!dim_) throw npstat::NpstatInvalidArgument(
5179  "npstat::ArrayND::cdfArray method "
5180  "can not be used with array of 0 rank");
5181 
5182  const proper_double scale = inscale;
5183  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
5184  if (dim_ >= maxdim)
5186  "In npstat::ArrayND::cdfArray: array rank is too large");
5187  const unsigned long maxcycle = 1UL << dim_;
5188 
5189  ArrayShape sh;
5190  sh.reserve(dim_);
5191  for (unsigned i=0; i<dim_; ++i)
5192  sh.push_back(shape_[i] + 1U);
5193 
5194  ArrayND<Accumulator> result(sh);
5195 
5196  unsigned* psh = &sh[0];
5197  const unsigned long len = result.length();
5198  for (unsigned long ipre=0; ipre<len; ++ipre)
5199  {
5200  result.convertLinearIndex(ipre, psh, dim_);
5201  Accumulator deriv = Accumulator();
5202  bool has0 = false;
5203  for (unsigned i=0; i<dim_; ++i)
5204  if (psh[i]-- == 0U)
5205  {
5206  has0 = true;
5207  break;
5208  }
5209  if (!has0)
5210  {
5211  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5212  {
5213  unsigned long icell = 0UL;
5214  unsigned n1 = 0U;
5215  for (unsigned i=0; i<dim_; ++i)
5216  {
5217  if (icycle & (1UL << i))
5218  {
5219  ++n1;
5220  icell += result.strides_[i]*(psh[i] + 1);
5221  }
5222  else
5223  icell += result.strides_[i]*psh[i];
5224  }
5225  if (n1 < dim_)
5226  {
5227  if ((dim_ - n1) % 2U)
5228  deriv += result.data_[icell];
5229  else
5230  deriv -= result.data_[icell];
5231  }
5232  }
5233  deriv += static_cast<Accumulator>(value(psh, dim_)*scale);
5234  }
5235  result.data_[ipre] = deriv;
5236  }
5237 
5238  // The "return" will convert Accumulator type into Numeric
5239  return result;
5240  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
Numeric & value(const unsigned *index, unsigned indexLen)
Definition: ArrayND.h:3099
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
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.

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Accumulator >
Accumulator npstat::ArrayND< Numeric, StackLen, StackDim >::cdfValue ( const unsigned *  index,
const unsigned  indexLen 
) const

Definition at line 5154 of file ArrayND.h.

References i, and getHLTprescales::index.

5156  {
5158  "Initialize npstat::ArrayND before calling method \"cdfValue\"");
5159  if (!dim_) throw npstat::NpstatInvalidArgument(
5160  "npstat::ArrayND::cdfValue method "
5161  "can not be used with array of 0 rank");
5162  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
5163  "In npstat::ArrayND::cdfValue: incompatible index length");
5164  for (unsigned i=0; i<indexLen; ++i)
5165  if (index[i] >= shape_[i])
5167  "In npstat::ArrayND::cdfValue: index out of range");
5168  return sumBelowLoop<Accumulator>(0, 0U, index);
5169  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::circularFlatLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
ArrayND< Num2, Len2, Dim2 > &  other,
Functor  binaryFunct 
)
private

Definition at line 1402 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1410  {
1411  const unsigned imax = range[level];
1412  const unsigned leftShift = thisCorner[level];
1413  const unsigned leftPeriod = shape_[level];
1414 
1415  if (level == dim_ - 1)
1416  {
1417  Numeric* left = data_ + idx0;
1418  Num2* right = r.data_ + (idx1 + otherCorner[level]);
1419  Num2* const rMax = r.data_ + (idx1 + r.shape_[level]);
1420 
1421  for (unsigned i=0; i<imax && right<rMax; ++i)
1422  binaryFunct(left[(i+leftShift)%leftPeriod], *right++);
1423  }
1424  else
1425  {
1426  const unsigned long leftStride = strides_[level];
1427  const unsigned long rightStride = r.strides_[level];
1428  const unsigned long rightMax = idx1 + r.shape_[level]*rightStride;
1429  idx1 += otherCorner[level]*rightStride;
1430 
1431  for (unsigned i=0; i<imax && idx1<rightMax; ++i, idx1+=rightStride)
1433  level+1, idx0+((i+leftShift)%leftPeriod)*leftStride,
1434  idx1, thisCorner, range, otherCorner, r, binaryFunct);
1435  }
1436  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void circularFlatLoop(unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:1402
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( )
inline

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

Definition at line 5661 of file ArrayND.h.

5662  {
5664  "Initialize npstat::ArrayND before calling method \"cl\"");
5666  "In npstat::ArrayND::cl: wrong # of args (not rank 0 array)");
5667  return localData_[0];
5668  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( ) const
inline

Definition at line 5471 of file ArrayND.h.

5472  {
5474  "Initialize npstat::ArrayND before calling method \"cl\"");
5476  "In npstat::ArrayND::cl: wrong # of args (not rank 0 array)");
5477  return localData_[0];
5478  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0)
inline

Definition at line 5671 of file ArrayND.h.

5673  {
5674  if (1U != dim_) throw npstat::NpstatInvalidArgument(
5675  "In npstat::ArrayND::cl: wrong # of args (not rank 1 array)");
5676  return data_[coordToIndex(i0, 0)];
5677  }
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0) const
inline

Definition at line 5481 of file ArrayND.h.

5483  {
5484  if (1U != dim_) throw npstat::NpstatInvalidArgument(
5485  "In npstat::ArrayND::cl: wrong # of args (not rank 1 array)");
5486  return data_[coordToIndex(i0, 0)];
5487  }
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1 
)
inline

Definition at line 5680 of file ArrayND.h.

5683  {
5684  if (2U != dim_) throw npstat::NpstatInvalidArgument(
5685  "In npstat::ArrayND::cl: wrong # of args (not rank 2 array)");
5686  return data_[coordToIndex(i0, 0)*strides_[0] +
5687  coordToIndex(i1, 1)];
5688  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1 
) const
inline

Definition at line 5490 of file ArrayND.h.

5493  {
5494  if (2U != dim_) throw npstat::NpstatInvalidArgument(
5495  "In npstat::ArrayND::cl: wrong # of args (not rank 2 array)");
5496  return data_[coordToIndex(i0, 0)*strides_[0] +
5497  coordToIndex(i1, 1)];
5498  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2 
)
inline

Definition at line 5691 of file ArrayND.h.

5695  {
5696  if (3U != dim_) throw npstat::NpstatInvalidArgument(
5697  "In npstat::ArrayND::cl: wrong # of args (not rank 3 array)");
5698  return data_[coordToIndex(i0, 0)*strides_[0] +
5699  coordToIndex(i1, 1)*strides_[1] +
5700  coordToIndex(i2, 2)];
5701  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2 
) const
inline

Definition at line 5501 of file ArrayND.h.

5505  {
5506  if (3U != dim_) throw npstat::NpstatInvalidArgument(
5507  "In npstat::ArrayND::cl: wrong # of args (not rank 3 array)");
5508  return data_[coordToIndex(i0, 0)*strides_[0] +
5509  coordToIndex(i1, 1)*strides_[1] +
5510  coordToIndex(i2, 2)];
5511  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3 
)
inline

Definition at line 5704 of file ArrayND.h.

5709  {
5710  if (4U != dim_) throw npstat::NpstatInvalidArgument(
5711  "In npstat::ArrayND::cl: wrong # of args (not rank 4 array)");
5712  return data_[coordToIndex(i0, 0)*strides_[0] +
5713  coordToIndex(i1, 1)*strides_[1] +
5714  coordToIndex(i2, 2)*strides_[2] +
5715  coordToIndex(i3, 3)];
5716  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3 
) const
inline

Definition at line 5514 of file ArrayND.h.

5519  {
5520  if (4U != dim_) throw npstat::NpstatInvalidArgument(
5521  "In npstat::ArrayND::cl: wrong # of args (not rank 4 array)");
5522  return data_[coordToIndex(i0, 0)*strides_[0] +
5523  coordToIndex(i1, 1)*strides_[1] +
5524  coordToIndex(i2, 2)*strides_[2] +
5525  coordToIndex(i3, 3)];
5526  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4 
)
inline

Definition at line 5719 of file ArrayND.h.

5725  {
5726  if (5U != dim_) throw npstat::NpstatInvalidArgument(
5727  "In npstat::ArrayND::cl: wrong # of args (not rank 5 array)");
5728  return data_[coordToIndex(i0, 0)*strides_[0] +
5729  coordToIndex(i1, 1)*strides_[1] +
5730  coordToIndex(i2, 2)*strides_[2] +
5731  coordToIndex(i3, 3)*strides_[3] +
5732  coordToIndex(i4, 4)];
5733  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4 
) const
inline

Definition at line 5529 of file ArrayND.h.

5535  {
5536  if (5U != dim_) throw npstat::NpstatInvalidArgument(
5537  "In npstat::ArrayND::cl: wrong # of args (not rank 5 array)");
5538  return data_[coordToIndex(i0, 0)*strides_[0] +
5539  coordToIndex(i1, 1)*strides_[1] +
5540  coordToIndex(i2, 2)*strides_[2] +
5541  coordToIndex(i3, 3)*strides_[3] +
5542  coordToIndex(i4, 4)];
5543  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5 
)
inline

Definition at line 5736 of file ArrayND.h.

5743  {
5744  if (6U != dim_) throw npstat::NpstatInvalidArgument(
5745  "In npstat::ArrayND::cl: wrong # of args (not rank 6 array)");
5746  return data_[coordToIndex(i0, 0)*strides_[0] +
5747  coordToIndex(i1, 1)*strides_[1] +
5748  coordToIndex(i2, 2)*strides_[2] +
5749  coordToIndex(i3, 3)*strides_[3] +
5750  coordToIndex(i4, 4)*strides_[4] +
5751  coordToIndex(i5, 5)];
5752  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5 
) const
inline

Definition at line 5546 of file ArrayND.h.

5553  {
5554  if (6U != dim_) throw npstat::NpstatInvalidArgument(
5555  "In npstat::ArrayND::cl: wrong # of args (not rank 6 array)");
5556  return data_[coordToIndex(i0, 0)*strides_[0] +
5557  coordToIndex(i1, 1)*strides_[1] +
5558  coordToIndex(i2, 2)*strides_[2] +
5559  coordToIndex(i3, 3)*strides_[3] +
5560  coordToIndex(i4, 4)*strides_[4] +
5561  coordToIndex(i5, 5)];
5562  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6 
)
inline

Definition at line 5755 of file ArrayND.h.

5763  {
5764  if (7U != dim_) throw npstat::NpstatInvalidArgument(
5765  "In npstat::ArrayND::cl: wrong # of args (not rank 7 array)");
5766  return data_[coordToIndex(i0, 0)*strides_[0] +
5767  coordToIndex(i1, 1)*strides_[1] +
5768  coordToIndex(i2, 2)*strides_[2] +
5769  coordToIndex(i3, 3)*strides_[3] +
5770  coordToIndex(i4, 4)*strides_[4] +
5771  coordToIndex(i5, 5)*strides_[5] +
5772  coordToIndex(i6, 6)];
5773  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6 
) const
inline

Definition at line 5565 of file ArrayND.h.

5573  {
5574  if (7U != dim_) throw npstat::NpstatInvalidArgument(
5575  "In npstat::ArrayND::cl: wrong # of args (not rank 7 array)");
5576  return data_[coordToIndex(i0, 0)*strides_[0] +
5577  coordToIndex(i1, 1)*strides_[1] +
5578  coordToIndex(i2, 2)*strides_[2] +
5579  coordToIndex(i3, 3)*strides_[3] +
5580  coordToIndex(i4, 4)*strides_[4] +
5581  coordToIndex(i5, 5)*strides_[5] +
5582  coordToIndex(i6, 6)];
5583  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7 
)
inline

Definition at line 5776 of file ArrayND.h.

5785  {
5786  if (8U != dim_) throw npstat::NpstatInvalidArgument(
5787  "In npstat::ArrayND::cl: wrong # of args (not rank 8 array)");
5788  return data_[coordToIndex(i0, 0)*strides_[0] +
5789  coordToIndex(i1, 1)*strides_[1] +
5790  coordToIndex(i2, 2)*strides_[2] +
5791  coordToIndex(i3, 3)*strides_[3] +
5792  coordToIndex(i4, 4)*strides_[4] +
5793  coordToIndex(i5, 5)*strides_[5] +
5794  coordToIndex(i6, 6)*strides_[6] +
5795  coordToIndex(i7, 7)];
5796  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7 
) const
inline

Definition at line 5586 of file ArrayND.h.

5595  {
5596  if (8U != dim_) throw npstat::NpstatInvalidArgument(
5597  "In npstat::ArrayND::cl: wrong # of args (not rank 8 array)");
5598  return data_[coordToIndex(i0, 0)*strides_[0] +
5599  coordToIndex(i1, 1)*strides_[1] +
5600  coordToIndex(i2, 2)*strides_[2] +
5601  coordToIndex(i3, 3)*strides_[3] +
5602  coordToIndex(i4, 4)*strides_[4] +
5603  coordToIndex(i5, 5)*strides_[5] +
5604  coordToIndex(i6, 6)*strides_[6] +
5605  coordToIndex(i7, 7)];
5606  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8 
)
inline

Definition at line 5799 of file ArrayND.h.

5809  {
5810  if (9U != dim_) throw npstat::NpstatInvalidArgument(
5811  "In npstat::ArrayND::cl: wrong # of args (not rank 9 array)");
5812  return data_[coordToIndex(i0, 0)*strides_[0] +
5813  coordToIndex(i1, 1)*strides_[1] +
5814  coordToIndex(i2, 2)*strides_[2] +
5815  coordToIndex(i3, 3)*strides_[3] +
5816  coordToIndex(i4, 4)*strides_[4] +
5817  coordToIndex(i5, 5)*strides_[5] +
5818  coordToIndex(i6, 6)*strides_[6] +
5819  coordToIndex(i7, 7)*strides_[7] +
5820  coordToIndex(i8, 8)];
5821  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8 
) const
inline

Definition at line 5609 of file ArrayND.h.

5619  {
5620  if (9U != dim_) throw npstat::NpstatInvalidArgument(
5621  "In npstat::ArrayND::cl: wrong # of args (not rank 9 array)");
5622  return data_[coordToIndex(i0, 0)*strides_[0] +
5623  coordToIndex(i1, 1)*strides_[1] +
5624  coordToIndex(i2, 2)*strides_[2] +
5625  coordToIndex(i3, 3)*strides_[3] +
5626  coordToIndex(i4, 4)*strides_[4] +
5627  coordToIndex(i5, 5)*strides_[5] +
5628  coordToIndex(i6, 6)*strides_[6] +
5629  coordToIndex(i7, 7)*strides_[7] +
5630  coordToIndex(i8, 8)];
5631  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8,
double  x9 
)
inline

Definition at line 5824 of file ArrayND.h.

5835  {
5836  if (10U != dim_) throw npstat::NpstatInvalidArgument(
5837  "In npstat::ArrayND::cl: wrong # of args (not rank 10 array)");
5838  return data_[coordToIndex(i0, 0)*strides_[0] +
5839  coordToIndex(i1, 1)*strides_[1] +
5840  coordToIndex(i2, 2)*strides_[2] +
5841  coordToIndex(i3, 3)*strides_[3] +
5842  coordToIndex(i4, 4)*strides_[4] +
5843  coordToIndex(i5, 5)*strides_[5] +
5844  coordToIndex(i6, 6)*strides_[6] +
5845  coordToIndex(i7, 7)*strides_[7] +
5846  coordToIndex(i8, 8)*strides_[8] +
5847  coordToIndex(i9, 9)];
5848  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8,
double  x9 
) const
inline

Definition at line 5634 of file ArrayND.h.

5645  {
5646  if (10U != dim_) throw npstat::NpstatInvalidArgument(
5647  "In npstat::ArrayND::cl: wrong # of args (not rank 10 array)");
5648  return data_[coordToIndex(i0, 0)*strides_[0] +
5649  coordToIndex(i1, 1)*strides_[1] +
5650  coordToIndex(i2, 2)*strides_[2] +
5651  coordToIndex(i3, 3)*strides_[3] +
5652  coordToIndex(i4, 4)*strides_[4] +
5653  coordToIndex(i5, 5)*strides_[5] +
5654  coordToIndex(i6, 6)*strides_[6] +
5655  coordToIndex(i7, 7)*strides_[7] +
5656  coordToIndex(i8, 8)*strides_[8] +
5657  coordToIndex(i9, 9)];
5658  }
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
gs::ClassId npstat::ArrayND< Numeric, StackLen, StackDim >::classId ( ) const
inline

Methods related to "geners" I/O

Definition at line 991 of file ArrayND.h.

991 {return gs::ClassId(*this);}
template<typename Numeric , unsigned StackLen, unsigned StackDim>
const char * npstat::ArrayND< Numeric, StackLen, StackDim >::classname ( )
static

Definition at line 5851 of file ArrayND.h.

References mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

5852  {
5853  static const std::string name(
5854  gs::template_class_name<Numeric>("npstat::ArrayND"));
5855  return name.c_str();
5856  }
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::clear ( void  )
inline

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

Definition at line 4595 of file ArrayND.h.

4596  {
4597  return constFill(Numeric());
4598  }
ArrayND & constFill(Numeric c)
Definition: ArrayND.h:4584
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::closest ( const double *  x,
unsigned  xDim 
)
inline

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.

Definition at line 3205 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

Referenced by npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::operator()().

3207  {
3209  "Initialize npstat::ArrayND before calling method \"closest\"");
3210  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3211  "In npstat::ArrayND::closest: incompatible data length");
3212  if (dim)
3213  {
3214  assert(x);
3215  unsigned long idx = 0UL;
3216  for (unsigned i=0; i<dim_; ++i)
3217  idx += coordToIndex(x[i], i)*strides_[i];
3218  return data_[idx];
3219  }
3220  else
3221  return localData_[0];
3222  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Definition: DDAxes.h:10
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::closest ( const double *  x,
unsigned  xDim 
) const
inline

Definition at line 3185 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

3187  {
3189  "Initialize npstat::ArrayND before calling method \"closest\"");
3190  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3191  "In npstat::ArrayND::closest: incompatible data length");
3192  if (dim)
3193  {
3194  assert(x);
3195  unsigned long idx = 0UL;
3196  for (unsigned i=0; i<dim_; ++i)
3197  idx += coordToIndex(x[i], i)*strides_[i];
3198  return data_[idx];
3199  }
3200  else
3201  return localData_[0];
3202  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3173
Definition: DDAxes.h:10
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::commonSubrangeLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
ArrayND< Num2, Len2, Dim2 > &  other,
Functor  binaryFunct 
)
private

Definition at line 1287 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1295  {
1296  const unsigned imax = range[level];
1297 
1298  if (level == dim_ - 1)
1299  {
1300  Numeric* left = data_ + (idx0 + thisCorner[level]);
1301  Numeric* const lMax = data_ + (idx0 + shape_[level]);
1302  Num2* right = r.data_ + (idx1 + otherCorner[level]);
1303  Num2* const rMax = r.data_ + (idx1 + r.shape_[level]);
1304 
1305  for (unsigned i=0; i<imax && left<lMax && right<rMax; ++i)
1306  binaryFunct(*left++, *right++);
1307  }
1308  else
1309  {
1310  const unsigned long leftStride = strides_[level];
1311  const unsigned long leftMax = idx0 + shape_[level]*leftStride;
1312  idx0 += thisCorner[level]*leftStride;
1313  const unsigned long rightStride = r.strides_[level];
1314  const unsigned long rightMax = idx1 + r.shape_[level]*rightStride;
1315  idx1 += otherCorner[level]*rightStride;
1316 
1317  for (unsigned i=0; i<imax && idx0 < leftMax && idx1 < rightMax;
1318  ++i, idx0 += leftStride, idx1 += rightStride)
1319  commonSubrangeLoop(level+1, idx0, idx1, thisCorner, range,
1320  otherCorner, r, binaryFunct);
1321  }
1322  }
int i
Definition: DBlmapReader.cc:9
void commonSubrangeLoop(unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:1287
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::constFill ( Numeric  c)

This method fills the array data with a constant value

Definition at line 4584 of file ArrayND.h.

References i.

Referenced by npstat::HistoND< Numeric, Axis >::setBinsToConst(), and npstat::HistoND< Numeric, Axis >::setOverflowsToConst().

4586  {
4588  "Initialize npstat::ArrayND before calling method \"constFill\"");
4589  for (unsigned long i=0; i<len_; ++i)
4590  data_[i] = c;
4591  return *this;
4592  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > npstat::ArrayND< Numeric, Len, Dim >::contract ( unsigned  pos1,
unsigned  pos2 
) const

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

Definition at line 4877 of file ArrayND.h.

References npstat::destroyBuffer(), i, npstat::makeBuffer(), and query::result.

4879  {
4881  "Initialize npstat::ArrayND before calling method \"contract\"");
4882  if (!(pos1 < dim_ && pos2 < dim_ && pos1 != pos2))
4883  throw npstat::NpstatInvalidArgument("In npstat::ArrayND::contract: "
4884  "incompatible contraction indices");
4885  if (shape_[pos1] != shape_[pos2])
4887  "In npstat::ArrayND::contract: incompatible "
4888  "length of contracted dimensions");
4889 
4890  // Construct the new shape
4891  unsigned newshapeBuf[Dim];
4892  unsigned* newshape = makeBuffer(dim_ - 2, newshapeBuf, Dim);
4893  unsigned ishap = 0;
4894  for (unsigned i=0; i<dim_; ++i)
4895  if (i != pos1 && i != pos2)
4896  newshape[ishap++] = shape_[i];
4897 
4898  // Form the result array
4899  ArrayND<Numeric,Len,Dim> result(newshape, ishap);
4900  if (ishap)
4901  contractLoop(0, 0, pos1, pos2, 0UL, 0UL, result);
4902  else
4903  {
4904  // We are just calculating the trace
4905  Numeric sum = Numeric();
4906  const unsigned imax = shape_[0];
4907  const unsigned long stride = strides_[0] + strides_[1];
4908  for (unsigned i=0; i<imax; ++i)
4909  sum += data_[i*stride];
4910  result() = sum;
4911  }
4912 
4913  destroyBuffer(newshape, newshapeBuf);
4914  return result;
4915  }
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
void contractLoop(unsigned thisLevel, unsigned resLevel, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:4839
tuple result
Definition: query.py:137
unsigned long * strides_
Definition: ArrayND.h:1004
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::contractLoop ( unsigned  thisLevel,
unsigned  resLevel,
unsigned  pos1,
unsigned  pos2,
unsigned long  idxThis,
unsigned long  idxRes,
ArrayND< Numeric, StackLen, StackDim > &  result 
) const
private

Definition at line 4839 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and tmp.

4843  {
4844  while (thisLevel == pos1 || thisLevel == pos2)
4845  ++thisLevel;
4846  assert(thisLevel < dim_);
4847 
4848  if (resLevel == result.dim_ - 1)
4849  {
4850  const unsigned ncontract = shape_[pos1];
4851  const unsigned imax = result.shape_[resLevel];
4852  const unsigned long stride = strides_[pos1] + strides_[pos2];
4853  for (unsigned i=0; i<imax; ++i)
4854  {
4855  const Numeric* tmp = data_ + (idxThis + i*strides_[thisLevel]);
4856  Numeric sum = Numeric();
4857  for (unsigned j=0; j<ncontract; ++j)
4858  sum += tmp[j*stride];
4859  result.data_[idxRes + i] = sum;
4860  }
4861  }
4862  else
4863  {
4864  const unsigned imax = result.shape_[resLevel];
4865  assert(imax == shape_[thisLevel]);
4866  for (unsigned i=0; i<imax; ++i)
4867  {
4868  contractLoop(thisLevel+1, resLevel+1, pos1, pos2,
4869  idxThis, idxRes, result);
4870  idxThis += strides_[thisLevel];
4871  idxRes += result.strides_[resLevel];
4872  }
4873  }
4874  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void contractLoop(unsigned thisLevel, unsigned resLevel, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:4839
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::convertLinearIndex ( unsigned long  l,
unsigned *  index,
unsigned  indexLen 
) const

Convert linear index into multidimensional index

Definition at line 3052 of file ArrayND.h.

References i.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), and npstat::ArrayND< Numeric, StackLen, StackDim >::derivative().

3054  {
3056  "Initialize npstat::ArrayND before calling "
3057  "method \"convertLinearIndex\"");
3058  if (!dim_) throw npstat::NpstatInvalidArgument(
3059  "npstat::ArrayND::convertLinearIndex method "
3060  "can not be used with array of 0 rank");
3061  if (idxLen != dim_) throw npstat::NpstatInvalidArgument(
3062  "In npstat::ArrayND::convertLinearIndex: incompatible index length");
3063  if (l >= len_) throw npstat::NpstatOutOfRange(
3064  "In npstat::ArrayND::convertLinearIndex: linear index out of range");
3065  assert(idx);
3066 
3067  for (unsigned i=0; i<dim_; ++i)
3068  {
3069  idx[i] = l / strides_[i];
3070  l -= (idx[i] * strides_[i]);
3071  }
3072  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Accumulator >
void npstat::ArrayND< Numeric, Len, Dim >::convertToLastDimCdf ( ArrayND< Numeric, StackLen, StackDim > *  sumSlice,
bool  useTrapezoids 
)
inline

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").

Definition at line 4767 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

4769  {
4771  "Initialize npstat::ArrayND before calling "
4772  "method \"convertToLastDimCdf\"");
4773  if (!dim_) throw npstat::NpstatInvalidArgument(
4774  "npstat::ArrayND::convertToLastDimCdf method "
4775  "can not be used with array of 0 rank");
4776  assert(sumSlice);
4777  if (!sumSlice->shapeIsKnown_) throw npstat::NpstatInvalidArgument(
4778  "In npstat::ArrayND::convertToLastDimCdf: "
4779  "uninitialized argument array");
4780  convertToLastDimCdfLoop<Accumulator>(sumSlice, 0U, 0UL, 0UL,
4781  useTrapezoids);
4782  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Accumulator >
void npstat::ArrayND< Numeric, Len, Dim >::convertToLastDimCdfLoop ( ArrayND< Numeric, StackLen, StackDim > *  sumSlice,
unsigned  level,
unsigned long  idx0,
unsigned long  idxSlice,
bool  useTrapezoids 
)
private

Definition at line 4717 of file ArrayND.h.

References data, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

4720  {
4721  static const proper_double half = 0.5;
4722  const unsigned imax = shape_[level];
4723  if (level == dim_ - 1)
4724  {
4725  Accumulator acc = Accumulator();
4726  Numeric* data = data_ + idx0;
4727  if (useTrapezoids)
4728  {
4729  Numeric oldval = Numeric();
4730  for (unsigned i = 0; i<imax; ++i)
4731  {
4732  acc += (data[i] + oldval)*half;
4733  oldval = data[i];
4734  data[i] = static_cast<Numeric>(acc);
4735  }
4736  acc += oldval*half;
4737  }
4738  else
4739  for (unsigned i = 0; i<imax; ++i)
4740  {
4741  acc += data[i];
4742  data[i] = static_cast<Numeric>(acc);
4743  }
4744  if (sumSlice->dim_)
4745  sumSlice->data_[idxSlice] = static_cast<Numeric>(acc);
4746  else
4747  sumSlice->localData_[0] = static_cast<Numeric>(acc);
4748  }
4749  else
4750  {
4751  const unsigned long stride = strides_[level];
4752  unsigned long sumStride = 0UL;
4753  if (sumSlice->dim_)
4754  sumStride = sumSlice->strides_[level];
4755  for (unsigned i = 0; i<imax; ++i)
4756  {
4757  convertToLastDimCdfLoop<Accumulator>(
4758  sumSlice, level+1, idx0, idxSlice, useTrapezoids);
4759  idx0 += stride;
4760  idxSlice += sumStride;
4761  }
4762  }
4763  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long * strides_
Definition: ArrayND.h:1004
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::coordToIndex ( double  coord,
unsigned  idim 
) const
inlineprivate

Definition at line 3173 of file ArrayND.h.

3175  {
3176  if (x <= 0.0)
3177  return 0;
3178  else if (x >= static_cast<double>(shape_[idim] - 1))
3179  return shape_[idim] - 1;
3180  else
3181  return static_cast<unsigned>(std::floor(x + 0.5));
3182  }
unsigned * shape_
Definition: ArrayND.h:1007
Definition: DDAxes.h:10
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::copyRangeLoopFunct ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
const ArrayND< Num2, Len2, Dim2 > &  r,
const ArrayRange range,
Functor  f 
)
private

Definition at line 2483 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, f, i, testEve_cfg::level, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND().

2488  {
2489  const unsigned imax = shape_[level];
2490  if (level == dim_ - 1)
2491  {
2492  Numeric* to = data_ + idx0;
2493  const Num2* from = r.data_ + (idx1 + range[level].min());
2494  for (unsigned i=0; i<imax; ++i)
2495  *to++ = static_cast<Numeric>(f(*from++));
2496  }
2497  else
2498  {
2499  const unsigned long fromstride = r.strides_[level];
2500  const unsigned long tostride = strides_[level];
2501  idx1 += range[level].min()*fromstride;
2502  for (unsigned i=0; i<imax; ++i)
2503  {
2504  copyRangeLoopFunct(level+1, idx0, idx1, r, range, f);
2505  idx0 += tostride;
2506  idx1 += fromstride;
2507  }
2508  }
2509  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1004
void copyRangeLoopFunct(unsigned level, unsigned long idx0, unsigned long idx1, const ArrayND< Num2, Len2, Dim2 > &r, const ArrayRange &range, Functor f)
Definition: ArrayND.h:2483
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
const Numeric* npstat::ArrayND< Numeric, StackLen, StackDim >::data ( ) const
inline
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
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.

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Accumulator >
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::derivative ( const double  inscale) const

Definition at line 5071 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, npstat::ArrayND< Numeric, StackLen, StackDim >::length(), query::result, and pileupReCalc_HLTpaths::scale.

5073  {
5075  "Initialize npstat::ArrayND before calling method \"derivative\"");
5076  if (!dim_) throw npstat::NpstatInvalidArgument(
5077  "npstat::ArrayND::derivative method "
5078  "can not be used with array of 0 rank");
5079 
5080  const typename ProperDblFromCmpl<Accumulator>::type scale = inscale;
5081  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
5082  if (dim_ >= maxdim) throw npstat::NpstatInvalidArgument(
5083  "In npstat::ArrayND::derivative: array rank is too large");
5084  const unsigned long maxcycle = 1UL << dim_;
5085 
5086  ArrayShape sh;
5087  sh.reserve(dim_);
5088  for (unsigned i=0; i<dim_; ++i)
5089  {
5090  if (shape_[i] <= 1U)
5092  "In npstat::ArrayND::derivative: in some dimendions "
5093  "array size is too small");
5094  sh.push_back(shape_[i] - 1U);
5095  }
5096 
5097  ArrayND result(sh);
5098  const unsigned long rLen = result.length();
5099  for (unsigned long ilin=0; ilin<rLen; ++ilin)
5100  {
5101  result.convertLinearIndex(ilin, &sh[0], dim_);
5102 
5103  Accumulator deriv = Accumulator();
5104  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5105  {
5106  unsigned long icell = 0UL;
5107  unsigned n1 = 0U;
5108  for (unsigned i=0; i<dim_; ++i)
5109  {
5110  if (icycle & (1UL << i))
5111  {
5112  ++n1;
5113  icell += strides_[i]*(sh[i] + 1);
5114  }
5115  else
5116  icell += strides_[i]*sh[i];
5117  }
5118  if ((dim_ - n1) % 2U)
5119  deriv -= data_[icell];
5120  else
5121  deriv += data_[icell];
5122  }
5123  result.data_[ilin] = static_cast<Numeric>(deriv*scale);
5124  }
5125 
5126  return result;
5127  }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::dot ( const ArrayND< Num2, Len2, Dim2 > &  r) const

Definition at line 5401 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, npstat::makeBuffer(), query::result, and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

5403  {
5404  if (!dim_) throw npstat::NpstatInvalidArgument(
5405  "npstat::ArrayND::dot method "
5406  "can not be used with array of 0 rank");
5407  if (!r.dim_) throw npstat::NpstatInvalidArgument(
5408  "npstat::ArrayND::dot method "
5409  "can not be used with argument array of 0 rank");
5410  if (shape_[dim_ - 1] != r.shape_[0]) throw npstat::NpstatInvalidArgument(
5411  "In npstat::ArrayND::dot: incompatible argument array shape");
5412 
5413  if (dim_ == 1 && r.dim_ == 1)
5414  {
5415  // Special case: the result is of 0 rank
5416  ArrayND<Numeric,Len,Dim> result(static_cast<unsigned*>(0), 0U);
5417  Numeric sum = Numeric();
5418  const unsigned imax = shape_[0];
5419  for (unsigned i=0; i<imax; ++i)
5420  sum += data_[i]*r.data_[i];
5421  result() = sum;
5422  return result;
5423  }
5424  else
5425  {
5426  unsigned newshapeBuf[2*Dim];
5427  unsigned *newshape = makeBuffer(dim_+r.dim_-2, newshapeBuf, 2*Dim);
5428  copyBuffer(newshape, shape_, dim_-1);
5429  copyBuffer(newshape+(dim_-1), r.shape_+1, r.dim_-1);
5430  ArrayND<Numeric,Len,Dim> result(newshape, dim_+r.dim_-2);
5431 
5432  dotProductLoop(0U, 0UL, 0UL, 0UL, r, result);
5433 
5434  destroyBuffer(newshape, newshapeBuf);
5435  return result;
5436  }
5437  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
void dotProductLoop(unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num2, Len2, Dim2 > &r, ArrayND &result) const
Definition: ArrayND.h:5364
tuple result
Definition: query.py:137
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, Dim >::dotProductLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
unsigned long  idx2,
const ArrayND< Num2, Len2, Dim2 > &  r,
ArrayND< Numeric, StackLen, StackDim > &  result 
) const
private

Definition at line 5364 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, ConfigFiles::l, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

5369  {
5370  // idx0 -- this object
5371  // idx1 -- dot product argument
5372  // idx2 -- result
5373  if (level == result.dim_)
5374  {
5375  Numeric sum = Numeric();
5376  const unsigned imax = r.shape_[0];
5377  const unsigned rstride = r.strides_[0];
5378  const Numeric* l = data_ + idx0;
5379  const Num2* ri = r.data_ + idx1;
5380  for (unsigned i=0; i<imax; ++i)
5381  sum += l[i]*ri[i*rstride];
5382  result.data_[idx2] = sum;
5383  }
5384  else
5385  {
5386  const unsigned imax = result.shape_[level];
5387  for (unsigned i=0; i<imax; ++i)
5388  {
5389  dotProductLoop(level+1, idx0, idx1, idx2, r, result);
5390  idx2 += result.strides_[level];
5391  if (level < dim_ - 1)
5392  idx0 += strides_[level];
5393  else
5394  idx1 += r.strides_[level + 2 - dim_];
5395  }
5396  }
5397  }
int i
Definition: DBlmapReader.cc:9
void dotProductLoop(unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num2, Len2, Dim2 > &r, ArrayND &result) const
Definition: ArrayND.h:5364
tuple result
Definition: query.py:137
unsigned long * strides_
Definition: ArrayND.h:1004
Num2 sum() const
Definition: ArrayND.h:4941
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::dualCircularLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
ArrayND< Num2, Len2, Dim2 > &  other,
Functor  binaryFunct 
)
private

Definition at line 1326 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1334  {
1335  const unsigned imax = range[level];
1336  const unsigned leftShift = thisCorner[level];
1337  const unsigned leftPeriod = shape_[level];
1338  const unsigned rightShift = otherCorner[level];
1339  const unsigned rightPeriod = r.shape_[level];
1340 
1341  if (level == dim_ - 1)
1342  {
1343  Numeric* left = data_ + idx0;
1344  Num2* right = r.data_ + idx1;
1345  for (unsigned i=0; i<imax; ++i)
1346  binaryFunct(left[(i+leftShift)%leftPeriod],
1347  right[(i+rightShift)%rightPeriod]);
1348  }
1349  else
1350  {
1351  const unsigned long leftStride = strides_[level];
1352  const unsigned long rightStride = r.strides_[level];
1353  for (unsigned i=0; i<imax; ++i)
1355  level+1, idx0+((i+leftShift)%leftPeriod)*leftStride,
1356  idx1+((i+rightShift)%rightPeriod)*rightStride,
1357  thisCorner, range, otherCorner, r, binaryFunct);
1358  }
1359  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void dualCircularLoop(unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:1326
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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)

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

Definition at line 681 of file ArrayND.h.

685  {
686  assert(slice);
687  (const_cast<ArrayND*>(this))->jointSliceScan(
688  *slice, fixedIndices, fixedIndexValues, nFixedIndices,
689  scast_assign_right<Numeric,Num2>());
690  }
template<typename Numeric , unsigned Len, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, 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.

Definition at line 5907 of file ArrayND.h.

References npstat::clearBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

5910  {
5912  "Initialize npstat::ArrayND before calling method \"exportSubrange\"");
5913  if (dim_ != lenCorner) throw npstat::NpstatInvalidArgument(
5914  "In npstat::ArrayND::exportSubrange: incompatible corner index length");
5915  assert(out);
5916  if (!out->shapeIsKnown_) throw npstat::NpstatInvalidArgument(
5917  "In npstat::ArrayND::exportSubrange: uninitialized argument array");
5918  if (out->dim_ != dim_) throw npstat::NpstatInvalidArgument(
5919  "In npstat::ArrayND::exportSubrange: incompatible argument array rank");
5920 
5921  if (dim_)
5922  {
5923  assert(corner);
5924  if (dim_ > CHAR_BIT*sizeof(unsigned long))
5926  "In npstat::ArrayND::exportSubrange: "
5927  "array rank is too large");
5928  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
5929  clearBuffer(toBuf, dim_);
5930  (const_cast<ArrayND*>(this))->commonSubrangeLoop(
5931  0U, 0UL, 0UL, corner, out->shape_, toBuf, *out,
5932  scast_assign_right<Numeric,Num2>());
5933  }
5934  else
5935  out->localData_[0] = static_cast<Num2>(localData_[0]);
5936  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:57
tuple out
Definition: dbtoconf.py:99
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::flatCircularLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
const unsigned *  thisCorner,
const unsigned *  range,
const unsigned *  otherCorner,
ArrayND< Num2, Len2, Dim2 > &  other,
Functor  binaryFunct 
)
private

Definition at line 1363 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1371  {
1372  const unsigned imax = range[level];
1373  const unsigned rightShift = otherCorner[level];
1374  const unsigned rightPeriod = r.shape_[level];
1375 
1376  if (level == dim_ - 1)
1377  {
1378  Numeric* left = data_ + (idx0 + thisCorner[level]);
1379  Numeric* const lMax = data_ + (idx0 + shape_[level]);
1380  Num2* right = r.data_ + idx1;
1381 
1382  for (unsigned i=0; i<imax && left<lMax; ++i)
1383  binaryFunct(*left++, right[(i+rightShift)%rightPeriod]);
1384  }
1385  else
1386  {
1387  const unsigned long leftStride = strides_[level];
1388  const unsigned long leftMax = idx0 + shape_[level]*leftStride;
1389  idx0 += thisCorner[level]*leftStride;
1390  const unsigned long rightStride = r.strides_[level];
1391 
1392  for (unsigned i=0; i<imax && idx0 < leftMax; ++i, idx0+=leftStride)
1394  level+1, idx0,
1395  idx1+((i+rightShift)%rightPeriod)*rightStride,
1396  thisCorner, range, otherCorner, r, binaryFunct);
1397  }
1398  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void flatCircularLoop(unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:1363
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

template<typename Numeric , unsigned Len, unsigned Dim>
ArrayRange npstat::ArrayND< Numeric, Len, Dim >::fullRange ( ) const
inline

Get the complete range

Definition at line 2991 of file ArrayND.h.

References i.

2992  {
2994  "Initialize npstat::ArrayND before calling method \"fullRange\"");
2995  ArrayRange range;
2996  if (dim_)
2997  {
2998  range.reserve(dim_);
2999  for (unsigned i=0; i<dim_; ++i)
3000  range.push_back(Interval<unsigned>(0U, shape_[i]));
3001  }
3002  return range;
3003  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

Referenced by npstat::rescanArray().

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<class Functor >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill ( Functor  f)

Definition at line 4786 of file ArrayND.h.

References npstat::destroyBuffer(), f, getHLTprescales::index, and npstat::makeBuffer().

4787  {
4789  "Initialize npstat::ArrayND before calling method \"functorFill\"");
4790  if (dim_)
4791  {
4792  unsigned localIndex[Dim];
4793  unsigned* index = makeBuffer(dim_, localIndex, Dim);
4794  functorFillLoop(0U, 0UL, f, index);
4795  destroyBuffer(index, localIndex);
4796  }
4797  else
4798  localData_[0] = static_cast<Numeric>(
4799  f(static_cast<unsigned*>(0), 0U));
4800  return *this;
4801  }
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
void functorFillLoop(unsigned level, unsigned long idx, Functor f, unsigned *farg)
Definition: ArrayND.h:4689
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::functorFillLoop ( unsigned  level,
unsigned long  idx,
Functor  f,
unsigned *  farg 
)
private

Definition at line 4689 of file ArrayND.h.

References f, i, customizeTrackingMonitorSeedNumber::idx, and testEve_cfg::level.

4692  {
4693  const unsigned imax = shape_[level];
4694  if (level == dim_ - 1)
4695  {
4696  Numeric* d = &data_[idx];
4697  const unsigned* myarg = farg;
4698  for (unsigned i = 0; i<imax; ++i)
4699  {
4700  farg[level] = i;
4701  d[i] = static_cast<Numeric>(f(myarg, dim_));
4702  }
4703  }
4704  else
4705  {
4706  const unsigned long stride = strides_[level];
4707  for (unsigned i = 0; i<imax; ++i)
4708  {
4709  farg[level] = i;
4710  functorFillLoop(level+1, idx + i*stride, f, farg);
4711  }
4712  }
4713  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void functorFillLoop(unsigned level, unsigned long idx, Functor f, unsigned *farg)
Definition: ArrayND.h:4689
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

Definition at line 694 of file ArrayND.h.

698  {
699  jointSliceScan(const_cast<ArrayND<Num2,Len2,Dim2>&>(slice),
700  fixedIndices, fixedIndexValues, nFixedIndices,
701  scast_assign_left<Numeric,Num2>());
702  }
void jointSliceScan(ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:1805
template<typename Numeric , unsigned Len, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, StackDim >::importSubrange ( const unsigned *  fromCorner,
unsigned  lenCorner,
const ArrayND< Num2, Len2, Dim2 > &  from 
)

The inverse operation to "exportSubrange"

Definition at line 5940 of file ArrayND.h.

References npstat::clearBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

5943  {
5945  "Initialize npstat::ArrayND before calling method \"importSubrange\"");
5946  if (dim_ != lenCorner) throw npstat::NpstatInvalidArgument(
5947  "In npstat::ArrayND::importSubrange: incompatible corner index length");
5948  if (!from.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
5949  "In npstat::ArrayND::importSubrange: uninitialized argument array");
5950  if (from.dim_ != dim_) throw npstat::NpstatInvalidArgument(
5951  "In npstat::ArrayND::importSubrange: incompatible argument array rank");
5952 
5953  if (dim_)
5954  {
5955  assert(corner);
5956  if (dim_ > CHAR_BIT*sizeof(unsigned long))
5958  "In npstat::ArrayND::importSubrange: "
5959  "array rank is too large");
5960  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
5961  clearBuffer(toBuf, dim_);
5962  commonSubrangeLoop(0U, 0UL, 0UL, corner, from.shape_, toBuf,
5963  const_cast<ArrayND<Num2, Len2, Dim2>&>(from),
5964  scast_assign_left<Numeric,Num2>());
5965  }
5966  else
5967  localData_[0] = static_cast<Numeric>(from.localData_[0]);
5968  }
void commonSubrangeLoop(unsigned level, unsigned long idx0, unsigned long idx1, const unsigned *thisCorner, const unsigned *range, const unsigned *otherCorner, ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:1287
bool shapeIsKnown_
Definition: ArrayND.h:1012
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:57
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::inPlaceMul ( const ArrayND< Num2, Len2, Dim2 > &  r)
inline

Convenience method for element-by-element in-place multiplication

Definition at line 550 of file ArrayND.h.

551  {
552  jointScan(const_cast<ArrayND<Num2,Len2,Dim2>&>(r),
553  multeq_left<Numeric,Num2>());
554  return *this;
555  }
void jointScan(ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:2221
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 4428 of file ArrayND.h.

References i, w(), and x.

Referenced by npstat::interpolateHistoND(), and npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::operator()().

4430  {
4432  "Initialize npstat::ArrayND before calling method \"interpolate1\"");
4433  if (dim != dim_) throw npstat::NpstatInvalidArgument(
4434  "In npstat::ArrayND::interpolate1: incompatible coordinate length");
4435  if (dim)
4436  {
4437  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
4438  if (dim_ >= maxdim)
4440  "In npstat::ArrayND::interpolate1: array rank is too large");
4441 
4442  double dx[maxdim];
4443  unsigned ix[maxdim];
4444  for (unsigned i=0; i<dim; ++i)
4445  {
4446  const double x = coords[i];
4447  if (x <= 0.0)
4448  {
4449  ix[i] = 0;
4450  dx[i] = 0.0;
4451  }
4452  else if (x >= static_cast<double>(shape_[i] - 1))
4453  {
4454  ix[i] = shape_[i] - 1;
4455  dx[i] = 0.0;
4456  }
4457  else
4458  {
4459  ix[i] = static_cast<unsigned>(std::floor(x));
4460  dx[i] = x - ix[i];
4461  }
4462  }
4463 
4464  Numeric sum = Numeric();
4465  const unsigned long maxcycle = 1UL << dim;
4466  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
4467  {
4468  double w = 1.0;
4469  unsigned long icell = 0UL;
4470  for (unsigned i=0; i<dim; ++i)
4471  {
4472  if (icycle & (1UL << i))
4473  {
4474  w *= dx[i];
4475  icell += strides_[i]*(ix[i] + 1U);
4476  }
4477  else
4478  {
4479  w *= (1.0 - dx[i]);
4480  icell += strides_[i]*ix[i];
4481  }
4482  }
4483  if (w > 0.0)
4484  sum += data_[icell]*static_cast<proper_double>(w);
4485  }
4486  return sum;
4487  }
4488  else
4489  return localData_[0];
4490  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
Num2 sum() const
Definition: ArrayND.h:4941
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
T w() const
Definition: DDAxes.h:10
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::interpolate3 ( const double *  x,
unsigned  xDim 
) const
inline

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).

Definition at line 4544 of file ArrayND.h.

Referenced by npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::operator()().

4546  {
4548  "Initialize npstat::ArrayND before calling method \"interpolate3\"");
4549  if (dim != dim_) throw npstat::NpstatInvalidArgument(
4550  "In npstat::ArrayND::interpolate3: incompatible coordinate length");
4551  if (dim)
4552  {
4553  assert(coords);
4554  return interpolateLoop(0, coords, data_);
4555  }
4556  else
4557  return localData_[0];
4558  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric interpolateLoop(unsigned level, const double *x, const Numeric *base) const
Definition: ArrayND.h:4493
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::interpolateLoop ( unsigned  level,
const double *  x,
const Numeric *  base 
) const
private

Definition at line 4493 of file ArrayND.h.

References npstat::interpolate_cubic(), npstat::interpolate_linear(), npstat::interpolate_quadratic(), testEve_cfg::level, findQualityFiles::v, and x.

4495  {
4496  const unsigned npoints = shape_[level];
4497  const double x = coords[level];
4498 
4499  unsigned ix, npt = 1;
4500  double dx = 0.0;
4501  if (x < 0.0)
4502  ix = 0;
4503  else if (x > static_cast<double>(npoints - 1))
4504  ix = npoints - 1;
4505  else
4506  {
4507  ix = static_cast<unsigned>(std::floor(x));
4508  if (ix) --ix;
4509  unsigned imax = ix + 3;
4510  while (imax >= npoints)
4511  {
4512  if (ix) --ix;
4513  --imax;
4514  }
4515  dx = x - ix;
4516  npt = imax + 1 - ix;
4517  }
4518  assert(npt >= 1 && npt <= 4);
4519 
4520  Numeric fit[4];
4521  if (level < dim_ - 1)
4522  for (unsigned ipt=0; ipt<npt; ++ipt)
4523  fit[ipt] = interpolateLoop(level + 1, coords,
4524  base + (ix + ipt)*strides_[level]);
4525 
4526  const Numeric* const v = (level == dim_ - 1 ? base + ix : fit);
4527  switch (npt)
4528  {
4529  case 1:
4530  return v[0];
4531  case 2:
4532  return interpolate_linear(dx, v[0], v[1]);
4533  case 3:
4534  return interpolate_quadratic(dx, v[0], v[1], v[2]);
4535  case 4:
4536  return interpolate_cubic(dx, v[0], v[1], v[2], v[3]);
4537  default:
4538  assert(0);
4539  return Numeric();
4540  }
4541  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
T interpolate_cubic(const double x, const T &f0, const T &f1, const T &f2, const T &f3)
Definition: interpolate.h:47
unsigned * shape_
Definition: ArrayND.h:1007
T interpolate_quadratic(const double x, const T &f0, const T &f1, const T &f2)
Definition: interpolate.h:34
Numeric interpolateLoop(unsigned level, const double *x, const Numeric *base) const
Definition: ArrayND.h:4493
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Definition: DDAxes.h:10
T interpolate_linear(const double x, const T &f0, const T &f1)
Definition: interpolate.h:23
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, Len, Dim >::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).

Definition at line 4805 of file ArrayND.h.

References npstat::absDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

4807  {
4808  if (eps < 0.0) throw npstat::NpstatDomainError(
4809  "In npstat::ArrayND::isClose: tolerance must not be negative");
4811  "In npstat::ArrayND::isClose: incompatible argument array shape");
4812  if (dim_)
4813  {
4814  for (unsigned long i=0; i<len_; ++i)
4815  {
4816  const Numeric rval = r.data_[i];
4817  if (static_cast<double>(absDifference(data_[i], rval)) > eps)
4818  return false;
4819  }
4820  }
4821  else
4822  {
4823  const Numeric rval = r.localData_[0];
4824  if (static_cast<double>(absDifference(localData_[0], rval)) > eps)
4825  return false;
4826  }
4827  return true;
4828  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
Private::AbsReturnType< T >::type absDifference(const T &v1, const T &v2)
Definition: absDifference.h:85
unsigned long long int rval
Definition: vlib.h:22
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible ( const ArrayShape shape) const
inline

Check compatibility with another shape

Definition at line 2255 of file ArrayND.h.

References i.

2257  {
2258  if (!shapeIsKnown_)
2259  return false;
2260  if (dim_ != shape.size())
2261  return false;
2262  if (dim_)
2263  {
2264  for (unsigned i=0; i<dim_; ++i)
2265  if (shape_[i] != shape[i])
2266  return false;
2267  }
2268  else
2269  assert(len_ == 1UL);
2270  return true;
2271  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
ArrayShape shape() const
Definition: ArrayND.h:2983
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
bool npstat::ArrayND< Numeric, Len, Dim >::isDensity ( ) const

This method checks whether all array elements are non-negative and, in addition, there is at least one positive element

Definition at line 3006 of file ArrayND.h.

References i, and npstat::ComplexComparesFalse< T >::less().

3007  {
3009  "Initialize npstat::ArrayND before calling method \"isDensity\"");
3010  const Numeric zero = Numeric();
3011  bool hasPositive = false;
3012  if (dim_)
3013  for (unsigned long i=0; i<len_; ++i)
3014  {
3015  // Don't make comparisons whose result can be
3016  // determined in advance by assuming that Numeric
3017  // is an unsigned type. Some compilers will
3018  // complain about it when this template is
3019  // instantiated with such a type.
3020  if (data_[i] == zero)
3021  continue;
3022  if (ComplexComparesFalse<Numeric>::less(zero, data_[i]))
3023  hasPositive = true;
3024  else
3025  return false;
3026  }
3027  else
3029  zero, localData_[0]);
3030  return hasPositive;
3031  }
int i
Definition: DBlmapReader.cc:9
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
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
inline

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

Definition at line 2275 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

2277  {
2278  if (!shapeIsKnown_)
2279  return false;
2280  if (!r.shapeIsKnown_)
2281  return false;
2282  if (dim_ != r.dim_)
2283  return false;
2284  if (len_ != r.len_)
2285  return false;
2286  if (dim_)
2287  {
2288  assert(shape_);
2289  assert(r.shape_);
2290  for (unsigned i=0; i<dim_; ++i)
2291  if (shape_[i] != r.shape_[i])
2292  return false;
2293  }
2294  else
2295  assert(len_ == 1UL);
2296  return true;
2297  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeKnown ( ) const
inline

Check whether the array has been initialized

Definition at line 237 of file ArrayND.h.

237 {return shapeIsKnown_;}
bool shapeIsKnown_
Definition: ArrayND.h:1012
template<typename Numeric , unsigned Len, unsigned Dim>
bool npstat::ArrayND< Numeric, Len, Dim >::isZero ( ) const

Check if all array elements are zero

Definition at line 3034 of file ArrayND.h.

References i.

3035  {
3037  "Initialize npstat::ArrayND before calling method \"isZero\"");
3038  const Numeric zero = Numeric();
3039  if (dim_)
3040  {
3041  for (unsigned long i=0; i<len_; ++i)
3042  if (data_[i] != zero)
3043  return false;
3044  }
3045  else
3046  if (localData_[0] != zero)
3047  return false;
3048  return true;
3049  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
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

Definition at line 2221 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

Referenced by npstat::ArrayND< Num1, Len1, Dim1 >::inPlaceMul().

2223  {
2225  "In npstat::ArrayND::jointScan: incompatible argument array shape");
2226  if (dim_)
2227  for (unsigned long i=0; i<len_; ++i)
2228  binaryFunct(data_[i], r.data_[i]);
2229  else
2230  binaryFunct(localData_[0], r.localData_[0]);
2231  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop ( unsigned  level,
unsigned long  idx0,
unsigned  level1,
unsigned long  idx1,
ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
Functor  binaryFunctor 
)
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Op >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop ( const unsigned  level,
const unsigned long  idx0,
const unsigned  level1,
const unsigned long  idx1,
ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
const unsigned  nFixedIndices,
Op  fcn 
)

Definition at line 1757 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), i, j, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1765  {
1766  bool fixed = false;
1767  for (unsigned j=0; j<nFixedIndices; ++j)
1768  if (fixedIndices[j] == level)
1769  {
1770  fixed = true;
1771  break;
1772  }
1773  if (fixed)
1774  {
1775  jointSliceLoop(level+1, idx0, level1, idx1,
1776  slice, fixedIndices, fixedIndexValues,
1777  nFixedIndices, fcn);
1778  }
1779  else
1780  {
1781  const unsigned imax = shape_[level];
1782  assert(imax == slice.shape_[level1]);
1783  const unsigned long stride = strides_[level];
1784 
1785  if (level1 == slice.dim_ - 1)
1786  {
1787  Num2* to = slice.data_ + idx1;
1788  for (unsigned i = 0; i<imax; ++i)
1789  fcn(data_[idx0 + i*stride], to[i]);
1790  }
1791  else
1792  {
1793  const unsigned long stride2 = slice.strides_[level1];
1794  for (unsigned i = 0; i<imax; ++i)
1795  jointSliceLoop(level+1, idx0+i*stride,
1796  level1+1, idx1+i*stride2,
1797  slice, fixedIndices, fixedIndexValues,
1798  nFixedIndices, fcn);
1799  }
1800  }
1801  }
int i
Definition: DBlmapReader.cc:9
void jointSliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
unsigned * shape_
Definition: ArrayND.h:1007
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
void fcn(int &, double *, double &, double *, int)
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
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).

Definition at line 1805 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, customizeTrackingMonitorSeedNumber::idx, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

Referenced by npstat::ArrayND< Num1, Len1, Dim1 >::importSlice().

1811  {
1812  const unsigned long idx = verifySliceCompatibility(
1813  slice, fixedIndices, fixedIndexValues, nFixedIndices);
1814  if (slice.dim_)
1815  jointSliceLoop(0U, idx, 0U, 0UL, slice, fixedIndices,
1816  fixedIndexValues, nFixedIndices, binaryFunct);
1817  else
1818  binaryFunct(data_[idx], slice.localData_[0]);
1819  }
unsigned long verifySliceCompatibility(const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
Definition: ArrayND.h:1698
void jointSliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::length ( ) const
inline
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::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".

Definition at line 4669 of file ArrayND.h.

References edm::shift.

4671  {
4672  // Make sure the object has been initialized
4674  "Initialize npstat::ArrayND before calling method \"linearFill\"");
4675  if (dim_ != dimCoeffs) throw npstat::NpstatInvalidArgument(
4676  "In npstat::ArrayND::linearFill: incompatible number of coefficients");
4677  if (dim_)
4678  {
4679  assert(coeffs);
4680  linearFillLoop(0U, 0.0, 0UL, shift, coeffs);
4681  }
4682  else
4683  localData_[0] = static_cast<Numeric>(shift);
4684  return *this;
4685  }
void linearFillLoop(unsigned level, double s0, unsigned long idx, double shift, const double *coeffs)
Definition: ArrayND.h:4641
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
static unsigned int const shift
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::linearFillLoop ( unsigned  level,
double  s0,
unsigned long  idx,
double  shift,
const double *  coeffs 
)
private

Definition at line 4641 of file ArrayND.h.

References trackerHits::c, i, customizeTrackingMonitorSeedNumber::idx, testEve_cfg::level, and edm::shift.

4644  {
4645  const unsigned imax = shape_[level];
4646  const double c = coeffs[level];
4647  if (level == dim_ - 1)
4648  {
4649  Numeric* d = &data_[idx];
4650  for (unsigned i=0; i<imax; ++i)
4651  {
4652  // Note that we want to add "shift" only at the
4653  // very end. This might improve the numerical
4654  // precision of the result.
4655  const double sum = s0 + c*i + shift;
4656  d[i] = static_cast<Numeric>(sum);
4657  }
4658  }
4659  else
4660  {
4661  const unsigned long stride = strides_[level];
4662  for (unsigned i=0; i<imax; ++i)
4663  linearFillLoop(level+1, s0 + c*i, idx + i*stride,
4664  shift, coeffs);
4665  }
4666  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void linearFillLoop(unsigned level, double s0, unsigned long idx, double shift, const double *coeffs)
Definition: ArrayND.h:4641
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static unsigned int const shift
Num2 sum() const
Definition: ArrayND.h:4941
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned long npstat::ArrayND< Numeric, Len, Dim >::linearIndex ( const unsigned *  idx,
unsigned  idxLen 
) const

Convert multidimensional index into linear index

Definition at line 3075 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

3077  {
3079  "Initialize npstat::ArrayND before calling method \"linearIndex\"");
3080  if (!dim_) throw npstat::NpstatInvalidArgument(
3081  "npstat::ArrayND::linearIndex method "
3082  "can not be used with array of 0 rank");
3083  if (idxLen != dim_) throw npstat::NpstatInvalidArgument(
3084  "In npstat::ArrayND::linearIndex: incompatible index length");
3085  assert(index);
3086 
3087  unsigned long idx = 0UL;
3088  for (unsigned i=0; i<dim_; ++i)
3089  {
3090  if (index[i] >= shape_[i])
3092  "In npstat::ArrayND::linearIndex: index out of range");
3093  idx += index[i]*strides_[i];
3094  }
3095  return idx;
3096  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValue ( unsigned long  index)
inline

Element access using linear index (no bounds checking)

Definition at line 3139 of file ArrayND.h.

References getHLTprescales::index.

Referenced by npstat::HistoND< Numeric, Axis >::setLinearBin().

3141  {
3142  return data_[index];
3143  }
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValue ( unsigned long  index) const
inline

Definition at line 3146 of file ArrayND.h.

References getHLTprescales::index.

3148  {
3149  return data_[index];
3150  }
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValueAt ( unsigned long  index)
inline

Element access using linear index (with bounds checking)

Definition at line 3153 of file ArrayND.h.

References getHLTprescales::index.

Referenced by npstat::HistoND< Numeric, Axis >::setLinearBinAt().

3155  {
3156  if (index >= len_)
3158  "In npstat::ArrayND::linearValueAt: linear index out of range");
3159  return data_[index];
3160  }
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValueAt ( unsigned long  index) const
inline

Definition at line 3163 of file ArrayND.h.

References getHLTprescales::index.

3165  {
3166  if (index >= len_)
3168  "In npstat::ArrayND::linearValueAt: linear index out of range");
3169  return data_[index];
3170  }
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 4274 of file ArrayND.h.

References a, npstat::absDifference(), i, customizeTrackingMonitorSeedNumber::idx, and ConfigFiles::l.

4276  {
4278  "Initialize npstat::ArrayND before calling method \"makeCopulaSteps\"");
4279  if (nCycles == 0U)
4280  return 0U;
4281  if (!dim_) throw npstat::NpstatInvalidArgument(
4282  "npstat::ArrayND::makeCopulaSteps method "
4283  "can not be used with array of 0 rank");
4284 
4285  const Numeric zero = Numeric();
4286  for (unsigned long i=0; i<len_; ++i)
4287  if (!(ComplexComparesAbs<Numeric>::more(data_[i], zero)))
4288  data_[i] = zero;
4289 
4290  std::vector<Numeric*> axesPtrBuf(dim_);
4291  Numeric** axes = &axesPtrBuf[0];
4292  const Numeric one = static_cast<Numeric>(1);
4293 
4294  // Memory for the axis accumulators
4295  unsigned idxSum = 0;
4296  for (unsigned i=0; i<dim_; ++i)
4297  idxSum += shape_[i];
4298  std::vector<Numeric> axesBuf(idxSum);
4299  axes[0] = &axesBuf[0];
4300  for (unsigned i=1; i<dim_; ++i)
4301  axes[i] = axes[i-1] + shape_[i-1];
4302 
4303  // Accumulate axis projections
4304  unsigned icycle = 0;
4305  for (; icycle<nCycles; ++icycle)
4306  {
4307  for (unsigned i=0; i<idxSum; ++i)
4308  axesBuf[i] = zero;
4309 
4310  // Accumulate sums for each axis
4311  for (unsigned long idat=0; idat<len_; ++idat)
4312  {
4313  unsigned long l = idat;
4314  for (unsigned i=0; i<dim_; ++i)
4315  {
4316  const unsigned idx = l / strides_[i];
4317  l -= (idx * strides_[i]);
4318  axes[i][idx] += data_[idat];
4319  }
4320  }
4321 
4322  // Make averages out of sums
4323  bool withinTolerance = true;
4324  Numeric totalSum = zero;
4325  for (unsigned i=0; i<dim_; ++i)
4326  {
4327  Numeric axisSum = zero;
4328  const unsigned amax = shape_[i];
4329  for (unsigned a=0; a<amax; ++a)
4330  {
4331  if (axes[i][a] == zero)
4333  "In npstat::ArrayND::makeCopulaSteps: "
4334  "marginal density is zero");
4335  axisSum += axes[i][a];
4336  }
4337  totalSum += axisSum;
4338  const Numeric axisAverage = axisSum/static_cast<Numeric>(amax);
4339  for (unsigned a=0; a<amax; ++a)
4340  axes[i][a] /= axisAverage;
4341  for (unsigned a=0; a<amax && withinTolerance; ++a)
4342  {
4343  const double adelta = absDifference(axes[i][a], one);
4344  if (adelta > tolerance)
4345  withinTolerance = false;
4346  }
4347  }
4348 
4349  if (withinTolerance)
4350  break;
4351 
4352  const Numeric totalAverage = totalSum/
4353  static_cast<Numeric>(len_)/static_cast<Numeric>(dim_);
4354 
4355  // Run over all points again and divide by
4356  // the product of marginals
4357  for (unsigned long idat=0; idat<len_; ++idat)
4358  {
4359  unsigned long l = idat;
4360  for (unsigned i=0; i<dim_; ++i)
4361  {
4362  const unsigned idx = l / strides_[i];
4363  l -= (idx * strides_[i]);
4364  data_[idat] /= axes[i][idx];
4365  }
4366  data_[idat] /= totalAverage;
4367  }
4368  }
4369 
4370  return icycle;
4371  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
Private::AbsReturnType< T >::type absDifference(const T &v1, const T &v2)
Definition: absDifference.h:85
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double a
Definition: hdecay.h:121
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::makeNonNegative ( )

This method turns all negative elements into zeros

Definition at line 4256 of file ArrayND.h.

References i.

4257  {
4259  "Initialize npstat::ArrayND before calling method \"makeNonNegative\"");
4260  const Numeric zero = Numeric();
4261  if (dim_)
4262  {
4263  for (unsigned long i=0; i<len_; ++i)
4264  if (!(ComplexComparesAbs<Numeric>::more(data_[i], zero)))
4265  data_[i] = zero;
4266  }
4267  else
4268  if (!(ComplexComparesAbs<Numeric>::more(localData_[0], zero)))
4269  localData_[0] = zero;
4270  return *this;
4271  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 4617 of file ArrayND.h.

References i.

4618  {
4620  "Initialize npstat::ArrayND before calling method \"makeUnit\"");
4621  if (dim_ < 2) throw npstat::NpstatInvalidArgument(
4622  "npstat::ArrayND::makeUnit method "
4623  "can not be used with arrays of rank less than 2");
4624  constFill(Numeric());
4625  unsigned long stride = 0UL;
4626  const unsigned dimlen = shape_[0];
4627  for (unsigned i=0; i<dim_; ++i)
4628  {
4629  if (shape_[i] != dimlen) throw npstat::NpstatInvalidArgument(
4630  "npstat::ArrayND::makeUnit method needs "
4631  "the array span to be the same in ech dimension");
4632  stride += strides_[i];
4633  }
4634  const Numeric one(static_cast<Numeric>(1));
4635  for (unsigned i=0; i<dimlen; ++i)
4636  data_[i*stride] = one;
4637  return *this;
4638  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
ArrayND & constFill(Numeric c)
Definition: ArrayND.h:4584
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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.

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

Definition at line 1522 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, runTheMatrix::mapped, query::result, and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

1525  {
1527  "Initialize npstat::ArrayND before calling method \"marginalize\"");
1528  if (!(prior.dim_ && prior.dim_ <= dim_)) throw npstat::NpstatInvalidArgument(
1529  "In npstat::ArrayND::marginalize: incompatible argument array rank");
1530  const unsigned resultDim = dim_ - prior.dim_;
1531 
1532  // Check that the index map is reasonable
1533  if (mapLen != prior.dim_) throw npstat::NpstatInvalidArgument(
1534  "In npstat::ArrayND::marginalize: incompatible index map length");
1535  assert(indexMap);
1536  for (unsigned i=0; i<mapLen; ++i)
1537  {
1538  const unsigned thisInd = indexMap[i];
1539  if (shape_[thisInd] != prior.shape_[i]) throw npstat::NpstatInvalidArgument(
1540  "In npstat::ArrayND::marginalize: "
1541  "incompatible argument array dimensions");
1542  if (thisInd >= dim_) throw npstat::NpstatOutOfRange(
1543  "In npstat::ArrayND::marginalize: index map entry out of range");
1544  for (unsigned j=0; j<i; ++j)
1545  if (indexMap[j] == thisInd) throw npstat::NpstatInvalidArgument(
1546  "In npstat::ArrayND::marginalize: "
1547  "duplicate entry in the index map");
1548  }
1549 
1550  // Build the shape for the array of results
1551  ArrayShape newShape;
1552  newShape.reserve(resultDim);
1553  for (unsigned i=0; i<dim_; ++i)
1554  {
1555  bool mapped = false;
1556  for (unsigned j=0; j<mapLen; ++j)
1557  if (indexMap[j] == i)
1558  {
1559  mapped = true;
1560  break;
1561  }
1562  if (!mapped)
1563  newShape.push_back(shape_[i]);
1564  }
1565 
1566  ArrayND result(newShape);
1567  assert(result.dim_ == resultDim);
1568  bool calculated = false;
1569  if (resultDim == 0)
1570  {
1571  calculated = true;
1572  for (unsigned i=0; i<dim_; ++i)
1573  if (indexMap[i] != i)
1574  {
1575  calculated = false;
1576  break;
1577  }
1578  if (calculated)
1579  {
1580  Numeric sum = Numeric();
1581  for (unsigned long i=0; i<len_; ++i)
1582  sum += data_[i]*prior.data_[i];
1583  result.localData_[0] = sum;
1584  }
1585  }
1586 
1587  if (!calculated)
1588  marginalizeLoop(0U, 0UL, 0U, 0UL, prior, indexMap, result);
1589 
1590  return result;
1591  }
void marginalizeLoop(unsigned level, unsigned long idx, unsigned levelRes, unsigned long idxRes, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, ArrayND &res) const
Definition: ArrayND.h:1475
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
unsigned long len_
Definition: ArrayND.h:1009
dictionary prior
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
Numeric npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop ( unsigned long  idx,
unsigned  levelPr,
unsigned long  idxPr,
const ArrayND< Num2, Len2, Dim2 > &  prior,
const unsigned *  indexMap 
) const
private

Definition at line 1445 of file ArrayND.h.

References i.

1449  {
1450  Numeric sum = Numeric();
1451  const unsigned long myStride = strides_[indexMap[levelPr]];
1452  const unsigned imax = prior.shape_[levelPr];
1453  assert(imax == shape_[indexMap[levelPr]]);
1454  if (levelPr == prior.dim_ - 1)
1455  {
1456  for (unsigned i=0; i<imax; ++i)
1457  sum += data_[idx+i*myStride]*prior.data_[idxPr++];
1458  }
1459  else
1460  {
1461  const unsigned long priorStride = prior.strides_[levelPr];
1462  for (unsigned i=0; i<imax; ++i)
1463  {
1464  sum += marginalizeInnerLoop(idx, levelPr+1U, idxPr,
1465  prior, indexMap);
1466  idx += myStride;
1467  idxPr += priorStride;
1468  }
1469  }
1470  return sum;
1471  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
Numeric marginalizeInnerLoop(unsigned long idx, unsigned levelPr, unsigned long idxPr, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap) const
Definition: ArrayND.h:1445
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
dictionary prior
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop ( unsigned  level,
unsigned long  idx,
unsigned  levelRes,
unsigned long  idxRes,
const ArrayND< Num2, Len2, Dim2 > &  prior,
const unsigned *  indexMap,
ArrayND< Numeric, StackLen, StackDim > &  res 
) const
private

Definition at line 1475 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, runTheMatrix::mapped, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1480  {
1481  if (level == dim_)
1482  {
1483  const Numeric res = marginalizeInnerLoop(
1484  idx, 0U, 0UL, prior, indexMap);
1485  if (result.dim_)
1486  result.data_[idxRes] = res;
1487  else
1488  result.localData_[0] = res;
1489  }
1490  else
1491  {
1492  // Check if this level is mapped or not
1493  bool mapped = false;
1494  for (unsigned i=0; i<prior.dim_; ++i)
1495  if (level == indexMap[i])
1496  {
1497  mapped = true;
1498  break;
1499  }
1500  if (mapped)
1501  marginalizeLoop(level+1U, idx, levelRes, idxRes,
1502  prior, indexMap, result);
1503  else
1504  {
1505  const unsigned imax = shape_[level];
1506  const unsigned long myStride = strides_[level];
1507  const unsigned long resStride = result.strides_[levelRes];
1508  for (unsigned i=0; i<imax; ++i)
1509  {
1510  marginalizeLoop(level+1U, idx, levelRes+1U, idxRes,
1511  prior, indexMap, result);
1512  idx += myStride;
1513  idxRes += resStride;
1514  }
1515  }
1516  }
1517  }
void marginalizeLoop(unsigned level, unsigned long idx, unsigned levelRes, unsigned long idxRes, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap, ArrayND &res) const
Definition: ArrayND.h:1475
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
Numeric marginalizeInnerLoop(unsigned long idx, unsigned levelPr, unsigned long idxPr, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap) const
Definition: ArrayND.h:1445
tuple result
Definition: query.py:137
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
dictionary prior
tuple level
Definition: testEve_cfg.py:34
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::max ( ) const

Maximum array element

Definition at line 5009 of file ArrayND.h.

References i.

5010  {
5012  "Initialize npstat::ArrayND before calling method \"max\"");
5013  if (dim_)
5014  {
5015  Numeric maxval(data_[0]);
5016  for (unsigned long i=1UL; i<len_; ++i)
5017  if (ComplexComparesAbs<Numeric>::less(maxval, data_[i]))
5018  maxval = data_[i];
5019  return maxval;
5020  }
5021  else
5022  return localData_[0];
5023  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::max ( unsigned *  index,
unsigned  indexLen 
) const

Maximum array element and its index

Definition at line 5026 of file ArrayND.h.

References i.

5028  {
5030  "Initialize npstat::ArrayND before calling method \"max\"");
5031  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
5032  "In npstat::ArrayND::max: incompatible index length");
5033  if (dim_)
5034  {
5035  unsigned long maxind = 0UL;
5036  Numeric maxval(data_[0]);
5037  for (unsigned long i=1UL; i<len_; ++i)
5038  if (ComplexComparesAbs<Numeric>::less(maxval, data_[i]))
5039  {
5040  maxval = data_[i];
5041  maxind = i;
5042  }
5043  convertLinearIndex(maxind, index, indexLen);
5044  return maxval;
5045  }
5046  else
5047  return localData_[0];
5048  }
int i
Definition: DBlmapReader.cc:9
void convertLinearIndex(unsigned long l, unsigned *index, unsigned indexLen) const
Definition: ArrayND.h:3052
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned Dim>
template<unsigned Len2, unsigned Dim2>
double npstat::ArrayND< Numeric, Len, Dim >::maxAbsDifference ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

Largest absolute difference with another bin-compatible array

Definition at line 4110 of file ArrayND.h.

References npstat::absDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

4112  {
4114  "In npstat::ArrayND::maxAbsDifference: "
4115  "incompatible argument array shape");
4116  if (dim_)
4117  {
4118  double maxd = 0.0;
4119  for (unsigned long i=0; i<len_; ++i)
4120  {
4121  const Numeric rval = r.data_[i];
4122  const double d = absDifference(data_[i], rval);
4123  if (d > maxd)
4124  maxd = d;
4125  }
4126  return maxd;
4127  }
4128  else
4129  {
4130  const Numeric rval = r.localData_[0];
4131  return absDifference(localData_[0], rval);
4132  }
4133  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
Private::AbsReturnType< T >::type absDifference(const T &v1, const T &v2)
Definition: absDifference.h:85
unsigned long long int rval
Definition: vlib.h:22
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::maximumSpan ( ) const

Maximum span among all dimensions

Definition at line 5449 of file ArrayND.h.

References i.

5450  {
5451  unsigned maxspan = 0;
5452  for (unsigned i=0; i<dim_; ++i)
5453  if (shape_[i] > maxspan)
5454  maxspan = shape_[i];
5455  return maxspan;
5456  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::min ( ) const

Minimum array element

Definition at line 4967 of file ArrayND.h.

References i.

4968  {
4970  "Initialize npstat::ArrayND before calling method \"min\"");
4971  if (dim_)
4972  {
4973  Numeric minval(data_[0]);
4974  for (unsigned long i=1UL; i<len_; ++i)
4975  if (ComplexComparesAbs<Numeric>::less(data_[i], minval))
4976  minval = data_[i];
4977  return minval;
4978  }
4979  else
4980  return localData_[0];
4981  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::min ( unsigned *  index,
unsigned  indexLen 
) const

Minimum array element and its index

Definition at line 4984 of file ArrayND.h.

References i.

4986  {
4988  "Initialize npstat::ArrayND before calling method \"min\"");
4989  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
4990  "In npstat::ArrayND::min: incompatible index length");
4991  if (dim_)
4992  {
4993  unsigned long minind = 0UL;
4994  Numeric minval(data_[0]);
4995  for (unsigned long i=1UL; i<len_; ++i)
4996  if (ComplexComparesAbs<Numeric>::less(data_[i], minval))
4997  {
4998  minval = data_[i];
4999  minind = i;
5000  }
5001  convertLinearIndex(minind, index, indexLen);
5002  return minval;
5003  }
5004  else
5005  return localData_[0];
5006  }
int i
Definition: DBlmapReader.cc:9
void convertLinearIndex(unsigned long l, unsigned *index, unsigned indexLen) const
Definition: ArrayND.h:3052
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::minimumSpan ( ) const

Minimum span among all dimensions

Definition at line 5459 of file ArrayND.h.

References i.

5460  {
5461  if (dim_ == 0)
5462  return 0U;
5463  unsigned minspan = shape_[0];
5464  for (unsigned i=1; i<dim_; ++i)
5465  if (shape_[i] < minspan)
5466  minspan = shape_[i];
5467  return minspan;
5468  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 5274 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::doubleShape(), i, customizeTrackingMonitorSeedNumber::idx, ConfigFiles::l, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::value().

5276  {
5277  assert(out);
5279  "Initialize npstat::ArrayND before calling method \"multiMirror\"");
5280  if (!out->shapeIsKnown_)
5281  *out = ArrayND<Num2, Len2, Dim2>(doubleShape(shape()));
5282  if (dim_ != out->dim_) throw npstat::NpstatInvalidArgument(
5283  "In npstat::ArrayND::multiMirror: incompatible argument array rank");
5284 
5285  if (dim_)
5286  {
5287  const unsigned *dshape = out->shape_;
5288  for (unsigned i=0; i<dim_; ++i)
5289  if (dshape[i] != shape_[i]*2U) throw npstat::NpstatInvalidArgument(
5290  "In npstat::ArrayND::multiMirror: "
5291  "incompatible argument array shape");
5292 
5293  if (dim_ >= CHAR_BIT*sizeof(unsigned long))
5295  "In npstat::ArrayND::multiMirror: "
5296  "array rank is too large");
5297  const unsigned long maxcycle = 1UL << dim_;
5298  std::vector<unsigned> indexbuf(dim_*2U);
5299  unsigned* idx = &indexbuf[0];
5300  unsigned* mirror = idx + dim_;
5301 
5302  for (unsigned long ipt=0; ipt<len_; ++ipt)
5303  {
5304  unsigned long l = ipt;
5305  for (unsigned i=0; i<dim_; ++i)
5306  {
5307  idx[i] = l / strides_[i];
5308  l -= (idx[i] * strides_[i]);
5309  }
5310  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5311  {
5312  for (unsigned i=0; i<dim_; ++i)
5313  {
5314  if (icycle & (1UL << i))
5315  mirror[i] = dshape[i] - idx[i] - 1U;
5316  else
5317  mirror[i] = idx[i];
5318  }
5319  out->value(mirror, dim_) = data_[ipt];
5320  }
5321  }
5322  }
5323  else
5324  out->localData_[0] = static_cast<Num2>(localData_[0]);
5325  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
ArrayShape shape() const
Definition: ArrayND.h:2983
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
tuple out
Definition: dbtoconf.py:99
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
ArrayShape doubleShape(const ArrayShape &inputShape)
Definition: ArrayShape.cc:155
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

Definition at line 721 of file ArrayND.h.

724  {
725  applySlice(const_cast<ArrayND<Num2,Len2,Dim2>&>(slice),
726  fixedIndices, nFixedIndices,
727  multeq_left<Numeric,Num2>());
728  return *this;
729  }
void applySlice(ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:2235
template<typename Numeric, unsigned Len, unsigned Dim>
template<unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, Len, Dim >::operator!= ( const ArrayND< Numeric, Len2, Dim2 > &  r) const
inline

Logical negation of operator==

Definition at line 4159 of file ArrayND.h.

References alignCSCRings::r.

4161  {
4162  return !(*this == r);
4163  }
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( )
inline

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

Definition at line 3273 of file ArrayND.h.

3274  {
3276  "Initialize npstat::ArrayND before calling method \"operator()\"");
3278  "In npstat::ArrayND::operator(): wrong # of args (not rank 0 array)");
3279  return localData_[0];
3280  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( ) const
inline

Definition at line 3283 of file ArrayND.h.

3284  {
3286  "Initialize npstat::ArrayND before calling method \"operator()\"");
3288  "In npstat::ArrayND::operator(): wrong # of args (not rank 0 array)");
3289  return localData_[0];
3290  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0)
inline

Definition at line 3293 of file ArrayND.h.

References i.

3295  {
3296  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3297  "In npstat::ArrayND::operator(): wrong # of args (not rank 1 array)");
3298  return data_[i];
3299  }
int i
Definition: DBlmapReader.cc:9
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0) const
inline

Definition at line 3302 of file ArrayND.h.

References i.

3304  {
3305  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3306  "In npstat::ArrayND::operator(): wrong # of args (not rank 1 array)");
3307  return data_[i];
3308  }
int i
Definition: DBlmapReader.cc:9
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1 
)
inline

Definition at line 3353 of file ArrayND.h.

3356  {
3357  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3358  "In npstat::ArrayND::operator(): wrong # of args (not rank 2 array)");
3359  return data_[i0*strides_[0] + i1];
3360  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1 
) const
inline

Definition at line 3363 of file ArrayND.h.

3366  {
3367  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3368  "In npstat::ArrayND::operator(): wrong # of args (not rank 2 array)");
3369  return data_[i0*strides_[0] + i1];
3370  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2 
)
inline

Definition at line 3526 of file ArrayND.h.

3530  {
3531  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3532  "In npstat::ArrayND::operator(): wrong # of args (not rank 3 array)");
3533  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3534  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2 
) const
inline

Definition at line 3401 of file ArrayND.h.

3405  {
3406  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3407  "In npstat::ArrayND::operator(): wrong # of args (not rank 3 array)");
3408  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3409  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3 
)
inline

Definition at line 3537 of file ArrayND.h.

3542  {
3543  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3544  "In npstat::ArrayND::operator(): wrong # of args (not rank 4 array)");
3545  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3546  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3 
) const
inline

Definition at line 3412 of file ArrayND.h.

3417  {
3418  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3419  "In npstat::ArrayND::operator(): wrong # of args (not rank 4 array)");
3420  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3421  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4 
)
inline

Definition at line 3549 of file ArrayND.h.

3555  {
3556  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3557  "In npstat::ArrayND::operator(): wrong # of args (not rank 5 array)");
3558  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3559  i3*strides_[3] + i4];
3560  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4 
) const
inline

Definition at line 3424 of file ArrayND.h.

3430  {
3431  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3432  "In npstat::ArrayND::operator(): wrong # of args (not rank 5 array)");
3433  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3434  i3*strides_[3] + i4];
3435  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5 
)
inline

Definition at line 3563 of file ArrayND.h.

3570  {
3571  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3572  "In npstat::ArrayND::operator(): wrong # of args (not rank 6 array)");
3573  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3574  i3*strides_[3] + i4*strides_[4] + i5];
3575  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5 
) const
inline

Definition at line 3438 of file ArrayND.h.

3445  {
3446  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3447  "In npstat::ArrayND::operator(): wrong # of args (not rank 6 array)");
3448  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3449  i3*strides_[3] + i4*strides_[4] + i5];
3450  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6 
)
inline

Definition at line 3578 of file ArrayND.h.

3586  {
3587  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3588  "In npstat::ArrayND::operator(): wrong # of args (not rank 7 array)");
3589  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3590  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3591  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6 
) const
inline

Definition at line 3453 of file ArrayND.h.

3461  {
3462  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3463  "In npstat::ArrayND::operator(): wrong # of args (not rank 7 array)");
3464  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3465  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3466  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7 
)
inline

Definition at line 3594 of file ArrayND.h.

3603  {
3604  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3605  "In npstat::ArrayND::operator(): wrong # of args (not rank 8 array)");
3606  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3607  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3608  i6*strides_[6] + i7];
3609  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7 
) const
inline

Definition at line 3469 of file ArrayND.h.

3478  {
3479  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3480  "In npstat::ArrayND::operator(): wrong # of args (not rank 8 array)");
3481  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3482  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3483  i6*strides_[6] + i7];
3484  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8 
)
inline

Definition at line 3612 of file ArrayND.h.

3622  {
3623  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3624  "In npstat::ArrayND::operator(): wrong # of args (not rank 9 array)");
3625  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3626  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3627  i6*strides_[6] + i7*strides_[7] + i8];
3628  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8 
) const
inline

Definition at line 3487 of file ArrayND.h.

3497  {
3498  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3499  "In npstat::ArrayND::operator(): wrong # of args (not rank 9 array)");
3500  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3501  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3502  i6*strides_[6] + i7*strides_[7] + i8];
3503  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8,
unsigned  i9 
)
inline

Definition at line 3631 of file ArrayND.h.

3642  {
3643  if (10U != dim_) throw npstat::NpstatInvalidArgument(
3644  "In npstat::ArrayND::operator(): wrong # of args (not rank 10 array)");
3645  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3646  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3647  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
3648  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8,
unsigned  i9 
) const
inline

Definition at line 3506 of file ArrayND.h.

3517  {
3518  if (10U != dim_) throw npstat::NpstatInvalidArgument(
3519  "In npstat::ArrayND::operator(): wrong # of args (not rank 10 array)");
3520  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3521  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3522  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
3523  }
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator* ( const Num2 &  r) const

multiplication by a scalar

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

Definition at line 4168 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and query::result.

4169  {
4171  "Initialize npstat::ArrayND before calling method \"operator*\"");
4172  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4173  for (unsigned long i=0; i<len_; ++i)
4174  result.data_[i] = data_[i]*r;
4175  return result;
4176  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator*= ( const Num2 &  r)

In-place operators. Note that these work faster than the binary versions, i.e., A += B is much faster than A = A + B.

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

Definition at line 4245 of file ArrayND.h.

References i.

4246  {
4248  "Initialize npstat::ArrayND before calling method \"operator*=\"");
4249  for (unsigned long i=0; i<len_; ++i)
4250  data_[i] *= r;
4251  return *this;
4252  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > npstat::ArrayND< Numeric, Len, Dim >::operator+ ( ) const
inline

operator+ returns a copy of this array

Definition at line 4224 of file ArrayND.h.

4225  {
4227  "Initialize npstat::ArrayND before calling method \"operator+\"");
4228  return *this;
4229  }
bool shapeIsKnown_
Definition: ArrayND.h:1012
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<unsigned Len2, unsigned Dim2>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator+ ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

addition of two arrays

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::operator+ ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

Definition at line 4196 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and query::result.

4198  {
4200  "In npstat::ArrayND::operator+: "
4201  "incompatible argument array shape");
4202  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4203  for (unsigned long i=0; i<len_; ++i)
4204  result.data_[i] = data_[i] + r.data_[i];
4205  return result;
4206  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
unsigned * shape_
Definition: ArrayND.h:1007
tuple result
Definition: query.py:137
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator+= ( const ArrayND< Num2, Len2, Dim2 > &  r)
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::operator+= ( const ArrayND< Num2, Len2, Dim2 > &  r)

Definition at line 4390 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, and i.

4391  {
4393  "In npstat::ArrayND::operator+=: "
4394  "incompatible argument array shape");
4395  for (unsigned long i=0; i<len_; ++i)
4396  data_[i] += r.data_[i];
4397  return *this;
4398  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > npstat::ArrayND< Numeric, Len, Dim >::operator- ( ) const

operator- applies the unary minus operator to every element

Definition at line 4232 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and query::result.

4233  {
4235  "Initialize npstat::ArrayND before calling method \"operator-\"");
4236  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4237  for (unsigned long i=0; i<len_; ++i)
4238  result.data_[i] = -data_[i];
4239  return result;
4240  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<unsigned Len2, unsigned Dim2>
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator- ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

subtraction of two arrays

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::operator- ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

Definition at line 4211 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and query::result.

4213  {
4215  "In npstat::ArrayND::operator-: "
4216  "incompatible argument array shape");
4217  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4218  for (unsigned long i=0; i<len_; ++i)
4219  result.data_[i] = data_[i] - r.data_[i];
4220  return result;
4221  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
unsigned * shape_
Definition: ArrayND.h:1007
tuple result
Definition: query.py:137
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator-= ( const ArrayND< Num2, Len2, Dim2 > &  r)
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::operator-= ( const ArrayND< Num2, Len2, Dim2 > &  r)

Definition at line 4417 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, and i.

4418  {
4420  "In npstat::ArrayND::operator-=: "
4421  "incompatible argument array shape");
4422  for (unsigned long i=0; i<len_; ++i)
4423  data_[i] -= r.data_[i];
4424  return *this;
4425  }
int i
Definition: DBlmapReader.cc:9
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND npstat::ArrayND< Numeric, StackLen, StackDim >::operator/ ( const Num2 &  r) const

division by a scalar

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::operator/ ( const Num2 &  r) const

Definition at line 4181 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, and query::result.

4182  {
4184  "Initialize npstat::ArrayND before calling method \"operator/\"");
4185  if (r == Num2()) throw npstat::NpstatRuntimeError(
4186  "In npstat::ArrayND::operator/: division by zero");
4187  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4188  for (unsigned long i=0; i<len_; ++i)
4189  result.data_[i] = data_[i]/r;
4190  return result;
4191  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
tuple result
Definition: query.py:137
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator/= ( const Num2 &  r)
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::operator/= ( const Num2 &  r)

Definition at line 4376 of file ArrayND.h.

References i.

4377  {
4379  "Initialize npstat::ArrayND before calling method \"operator/=\"");
4380  if (r == Num2()) throw npstat::NpstatRuntimeError(
4381  "In npstat::ArrayND::operator/=: division by zero");
4382  for (unsigned long i=0; i<len_; ++i)
4383  data_[i] /= r;
4384  return *this;
4385  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::operator= ( const ArrayND< Numeric, StackLen, StackDim > &  r)

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.

Definition at line 2897 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

2898  {
2899  if (this == &r)
2900  return *this;
2901  if (shapeIsKnown_)
2902  {
2903  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
2904  "In npstat::ArrayND assignment operator: "
2905  "uninitialized argument array");
2907  "In npstat::ArrayND assignment operator: "
2908  "incompatible argument array shape");
2909  if (dim_)
2910  copyBuffer(data_, r.data_, len_);
2911  else
2912  localData_[0] = r.localData_[0];
2913  }
2914  else
2915  {
2916  // This object is uninitialized. If the object on the
2917  // right is itself initialized, make an in-place copy.
2918  if (r.shapeIsKnown_)
2919  new (this) ArrayND(r);
2920  }
2921  return *this;
2922  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND& npstat::ArrayND< Numeric, StackLen, StackDim >::operator= ( const ArrayND< Num2, Len2, Dim2 > &  )

Converting assignment operator

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::operator= ( const ArrayND< Num2, Len2, Dim2 > &  r)

Definition at line 2927 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

2928  {
2929  if ((void*)this == (void*)(&r))
2930  return *this;
2931  if (shapeIsKnown_)
2932  {
2933  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
2934  "In npstat::ArrayND assignment operator: "
2935  "uninitialized argument array");
2937  "In npstat::ArrayND assignment operator: "
2938  "incompatible argument array shape");
2939  if (dim_)
2940  copyBuffer(data_, r.data_, len_);
2941  else
2942  localData_[0] = static_cast<Numeric>(r.localData_[0]);
2943  }
2944  else
2945  {
2946  // This object is uninitialized. If the object on the
2947  // right is itself initialized, make an in-place copy.
2948  if (r.shapeIsKnown_)
2949  new (this) ArrayND(r);
2950  }
2951  return *this;
2952  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2275
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned Dim>
template<unsigned Len2, unsigned Dim2>
bool npstat::ArrayND< Numeric, Len, Dim >::operator== ( const ArrayND< Numeric, Len2, Dim2 > &  r) const

Compare two arrays for equality

Definition at line 4137 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

4139  {
4140  if (shapeIsKnown_ != r.shapeIsKnown_)
4141  return false;
4142  if (r.dim_ != dim_)
4143  return false;
4144  if (r.len_ != len_)
4145  return false;
4146  for (unsigned i=0; i<dim_; ++i)
4147  if (shape_[i] != r.shape_[i])
4148  return false;
4149  for (unsigned i=0; i<dim_; ++i)
4150  assert(strides_[i] == r.strides_[i]);
4151  for (unsigned long j=0; j<len_; ++j)
4152  if (data_[j] != r.data_[j])
4153  return false;
4154  return true;
4155  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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)

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
ArrayND<Numeric,Len,Dim> npstat::ArrayND< Numeric, StackLen, StackDim >::outer ( const ArrayND< Num2, Len2, Dim2 > &  r) const

Definition at line 4832 of file ArrayND.h.

References alignCSCRings::r.

4834  {
4835  return ArrayND<Numeric,Len,Dim>(*this, r);
4836  }
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, Dim >::outerProductLoop ( unsigned  level,
unsigned long  idx0,
unsigned long  idx1,
unsigned long  idx2,
const ArrayND< Num1, Len1, Dim1 > &  a1,
const ArrayND< Num2, Len2, Dim2 > &  a2 
)
private

Definition at line 2810 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, testEve_cfg::level, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND().

2815  {
2816  const unsigned imax = shape_[level];
2817  if (level == dim_ - 1)
2818  {
2819  for (unsigned i=0; i<imax; ++i)
2820  data_[idx0 + i] = a1.data_[idx1]*a2.data_[idx2 + i];
2821  }
2822  else
2823  {
2824  for (unsigned i=0; i<imax; ++i)
2825  {
2826  outerProductLoop(level+1, idx0, idx1, idx2, a1, a2);
2827  idx0 += strides_[level];
2828  if (level < a1.dim_)
2829  idx1 += a1.strides_[level];
2830  else
2831  idx2 += a2.strides_[level - a1.dim_];
2832  }
2833  }
2834  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void outerProductLoop(unsigned level, unsigned long idx0, unsigned long idx1, unsigned long idx2, const ArrayND< Num1, Len1, Dim1 > &a1, const ArrayND< Num2, Len2, Dim2 > &a2)
Definition: ArrayND.h:2810
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned StackDim>
template<typename Num2 , typename Integer >
void npstat::ArrayND< Numeric, Len, 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.

Definition at line 2344 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::BoxND< Numeric >::dim(), i, and npstat::makeBuffer().

2347  {
2349  "Initialize npstat::ArrayND before calling method \"processSubrange\"");
2350  if (!dim_) throw npstat::NpstatInvalidArgument(
2351  "npstat::ArrayND::processSubrange method "
2352  "can not be used with array of 0 rank");
2353  if (dim_ != subrange.dim()) throw npstat::NpstatInvalidArgument(
2354  "In npstat::ArrayND::processSubrange: incompatible subrange rank");
2355  unsigned ibuf[StackDim];
2356  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2357  for (unsigned i=0; i<dim_; ++i)
2358  buf[i] = 0U;
2359  processSubrangeLoop(0U, 0UL, buf, f, subrange);
2360  destroyBuffer(buf, ibuf);
2361  }
int i
Definition: DBlmapReader.cc:9
void processSubrangeLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
Definition: ArrayND.h:2301
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned Len, unsigned Dim>
template<typename Num2 , typename Integer >
void npstat::ArrayND< Numeric, Len, Dim >::processSubrangeLoop ( unsigned  level,
unsigned long  idx0,
unsigned *  currentIndex,
AbsArrayProjector< Numeric, Num2 > &  f,
const BoxND< Integer > &  subrange 
) const
private

Definition at line 2301 of file ArrayND.h.

References i, testEve_cfg::level, npstat::Interval< Numeric >::max(), npstat::Interval< Numeric >::min(), and npstat::AbsArrayProjector< Input, Result >::process().

2306  {
2307  // Deal with possible negative limits first
2308  const Interval<Integer>& levelRange(subrange[level]);
2309  long long int iminl = static_cast<long long int>(levelRange.min());
2310  if (iminl < 0LL) iminl = 0LL;
2311  long long int imaxl = static_cast<long long int>(levelRange.max());
2312  if (imaxl < 0LL) imaxl = 0LL;
2313 
2314  // Now deal with possible out-of-range limits
2315  const unsigned imin = static_cast<unsigned>(iminl);
2316  unsigned imax = static_cast<unsigned>(imaxl);
2317  if (imax > shape_[level])
2318  imax = shape_[level];
2319 
2320  if (level == dim_ - 1)
2321  {
2322  idx0 += imin;
2323  for (unsigned i=imin; i<imax; ++i, ++idx0)
2324  {
2325  currentIndex[level] = i;
2326  f.process(currentIndex, dim_, idx0, data_[idx0]);
2327  }
2328  }
2329  else
2330  {
2331  const unsigned long stride = strides_[level];
2332  idx0 += imin*stride;
2333  for (unsigned i=imin; i<imax; ++i)
2334  {
2335  currentIndex[level] = i;
2336  processSubrangeLoop(level+1U, idx0, currentIndex, f, subrange);
2337  idx0 += stride;
2338  }
2339  }
2340  }
int i
Definition: DBlmapReader.cc:9
void processSubrangeLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
Definition: ArrayND.h:2301
unsigned * shape_
Definition: ArrayND.h:1007
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
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.

Definition at line 1966 of file ArrayND.h.

References npstat::destroyBuffer(), i, and npstat::makeBuffer().

1971  {
1972  assert(projection);
1973  verifyProjectionCompatibility(*projection, projectedIndices,
1974  nProjectedIndices);
1975  unsigned ibuf[StackDim];
1976  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
1977  for (unsigned i=0; i<dim_; ++i)
1978  buf[i] = 0U;
1979  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
1980  projector, projectedIndices, nProjectedIndices,
1981  scast_assign_left<Num2,Num3>());
1982  destroyBuffer(buf, ibuf);
1983  }
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
void projectLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, unsigned *currentIndex, ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:1851
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
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,
AbsVisitor< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

Definition at line 2103 of file ArrayND.h.

2108  {
2109  assert(projection);
2110  verifyProjectionCompatibility(*projection, projectedIndices,
2111  nProjectedIndices);
2112  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2113  projector, projectedIndices, nProjectedIndices,
2114  scast_assign_left<Num2,Num3>());
2115  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void projectLoop2(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:2053
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop ( unsigned  level,
unsigned long  idx0,
unsigned *  currentIndex,
AbsArrayProjector< Numeric, Num2 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const
private

Definition at line 1823 of file ArrayND.h.

References i, customizeTrackingMonitorSeedNumber::idx, prof2calltree::last, testEve_cfg::level, and npstat::AbsArrayProjector< Input, Result >::process().

1829  {
1830  // level : dimension number among indices which are being iterated
1831  const unsigned idx = projectedIndices[level];
1832  const unsigned imax = shape_[idx];
1833  const unsigned long stride = strides_[idx];
1834  const bool last = (level == nProjectedIndices - 1);
1835 
1836  for (unsigned i = 0; i<imax; ++i)
1837  {
1838  currentIndex[idx] = i;
1839  if (last)
1840  projector.process(currentIndex, dim_, idx0, data_[idx0]);
1841  else
1842  projectInnerLoop(level+1, idx0, currentIndex, projector,
1843  projectedIndices, nProjectedIndices);
1844  idx0 += stride;
1845  }
1846  }
int i
Definition: DBlmapReader.cc:9
void projectInnerLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1823
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop2 ( unsigned  level,
unsigned long  idx0,
AbsVisitor< Numeric, Num2 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const
private

Definition at line 2029 of file ArrayND.h.

References i, customizeTrackingMonitorSeedNumber::idx, prof2calltree::last, testEve_cfg::level, and npstat::AbsVisitor< Input, Result >::process().

2034  {
2035  const unsigned idx = projectedIndices[level];
2036  const unsigned imax = shape_[idx];
2037  const unsigned long stride = strides_[idx];
2038  const bool last = (level == nProjectedIndices - 1);
2039 
2040  for (unsigned i = 0; i<imax; ++i)
2041  {
2042  if (last)
2043  projector.process(data_[idx0+i*stride]);
2044  else
2045  projectInnerLoop2(level+1, idx0+i*stride, projector,
2046  projectedIndices, nProjectedIndices);
2047  }
2048  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void projectInnerLoop2(unsigned level, unsigned long idx0, AbsVisitor< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2029
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 , class Op >
void npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop ( unsigned  level,
unsigned long  idx0,
unsigned  level1,
unsigned long  idx1,
unsigned *  currentIndex,
ArrayND< Num2, Len2, Dim2 > *  projection,
AbsArrayProjector< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices,
Op  fcn 
) const
private

Definition at line 1851 of file ArrayND.h.

References npstat::AbsArrayProjector< Input, Result >::clear(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), i, j, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::AbsArrayProjector< Input, Result >::result(), and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1859  {
1860  // level : dimension number in this array
1861  // level1 : dimension number in the projection
1862  // idx0 : linear index in this array
1863  // idx1 : linear index in the projection
1864  // currentIndex : cycled over in this loop with the exception of the
1865  // dimensions which are iterated over to build the
1866  // projection
1867  if (level == dim_)
1868  {
1869  assert(level1 == projection->dim_);
1870  projector.clear();
1871  projectInnerLoop(0U, idx0, currentIndex, projector,
1872  projectedIndices, nProjectedIndices);
1873  if (projection->dim_)
1874  fcn(projection->data_[idx1], projector.result());
1875  else
1876  fcn(projection->localData_[0], projector.result());
1877  }
1878  else
1879  {
1880  bool iterated = false;
1881  for (unsigned j=0; j<nProjectedIndices; ++j)
1882  if (projectedIndices[j] == level)
1883  {
1884  iterated = true;
1885  break;
1886  }
1887  if (iterated)
1888  {
1889  // This index will be iterated over inside "projectInnerLoop"
1890  projectLoop(level+1, idx0, level1, idx1,
1891  currentIndex, projection, projector,
1892  projectedIndices, nProjectedIndices, fcn);
1893  }
1894  else
1895  {
1896  const unsigned imax = shape_[level];
1897  const unsigned long stride = strides_[level];
1898  // We will not be able to get here if projection->dim_ is 0.
1899  // Therefore, it is safe to access projection->strides_.
1900  const unsigned long stride2 = projection->strides_[level1];
1901  for (unsigned i = 0; i<imax; ++i)
1902  {
1903  currentIndex[level] = i;
1904  projectLoop(level+1, idx0+i*stride,
1905  level1+1, idx1+i*stride2,
1906  currentIndex, projection, projector,
1907  projectedIndices, nProjectedIndices, fcn);
1908  }
1909  }
1910  }
1911  }
int i
Definition: DBlmapReader.cc:9
void projectInnerLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1823
void projectLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, unsigned *currentIndex, ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:1851
unsigned * shape_
Definition: ArrayND.h:1007
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
void fcn(int &, double *, double &, double *, int)
tuple level
Definition: testEve_cfg.py:34
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 , class Op >
void npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2 ( unsigned  level,
unsigned long  idx0,
unsigned  level1,
unsigned long  idx1,
ArrayND< Num2, Len2, Dim2 > *  projection,
AbsVisitor< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices,
Op  fcn 
) const
private

Definition at line 2053 of file ArrayND.h.

References npstat::AbsVisitor< Input, Result >::clear(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), i, j, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::AbsVisitor< Input, Result >::result(), and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

2060  {
2061  if (level == dim_)
2062  {
2063  assert(level1 == projection->dim_);
2064  projector.clear();
2065  projectInnerLoop2(0U, idx0, projector,
2066  projectedIndices, nProjectedIndices);
2067  if (projection->dim_)
2068  fcn(projection->data_[idx1], projector.result());
2069  else
2070  fcn(projection->localData_[0], projector.result());
2071  }
2072  else
2073  {
2074  bool fixed = false;
2075  for (unsigned j=0; j<nProjectedIndices; ++j)
2076  if (projectedIndices[j] == level)
2077  {
2078  fixed = true;
2079  break;
2080  }
2081  if (fixed)
2082  {
2083  projectLoop2(level+1, idx0, level1, idx1,
2084  projection, projector,
2085  projectedIndices, nProjectedIndices, fcn);
2086  }
2087  else
2088  {
2089  const unsigned imax = shape_[level];
2090  const unsigned long stride = strides_[level];
2091  const unsigned long stride2 = projection->strides_[level1];
2092  for (unsigned i = 0; i<imax; ++i)
2093  projectLoop2(level+1, idx0+i*stride,
2094  level1+1, idx1+i*stride2,
2095  projection, projector,
2096  projectedIndices, nProjectedIndices, fcn);
2097  }
2098  }
2099  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void projectInnerLoop2(unsigned level, unsigned long idx0, AbsVisitor< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2029
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
void fcn(int &, double *, double &, double *, int)
void projectLoop2(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:2053
tuple level
Definition: testEve_cfg.py:34
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::rank ( ) const
inline
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::restore ( const gs::ClassId &  id,
std::istream &  in,
ArrayND< Numeric, StackLen, StackDim > *  array 
)
static

Definition at line 5870 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), cond::rpcobimon::current, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize().

Referenced by npstat::LinInterpolatedTableND< Numeric, Axis >::read(), and npstat::HistoND< Numeric, Axis >::read().

5872  {
5873  static const gs::ClassId current(gs::ClassId::makeId<ArrayND<Numeric,Len,Dim> >());
5874  current.ensureSameId(id);
5875 
5876  ArrayShape rshape;
5877  gs::read_pod_vector(in, &rshape);
5878  if (in.fail()) throw gs::IOReadFailure(
5879  "In npstat::ArrayND::restore: input stream failure (checkpoint 0)");
5880 
5881  assert(array);
5882  array->uninitialize();
5883  array->dim_ = rshape.size();
5884  array->shapeIsKnown_ = true;
5885  array->len_ = 1UL;
5886  if (array->dim_)
5887  {
5888  array->shape_ = makeBuffer(array->dim_, array->localShape_, Dim);
5889  for (unsigned i=0; i<array->dim_; ++i)
5890  {
5891  array->shape_[i] = rshape[i];
5892  assert(array->shape_[i]);
5893  array->len_ *= array->shape_[i];
5894  }
5895  array->buildStrides();
5896  array->data_ = makeBuffer(array->len_, array->localData_, Len);
5897  gs::read_array(in, array->data_, array->len_);
5898  }
5899  else
5900  gs::restore_item(in, array->localData_, false);
5901  if (in.fail()) throw gs::IOReadFailure(
5902  "In npstat::ArrayND::restore: input stream failure (checkpoint 1)");
5903  }
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 5329 of file ArrayND.h.

References npstat::clearBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

5332  {
5333  assert(rotated);
5335  "Initialize npstat::ArrayND before calling method \"rotate\"");
5336  // Can't rotate into itself -- it will be a mess
5337  if ((void*)rotated == (void*)this) throw npstat::NpstatInvalidArgument(
5338  "In npstat::ArrayND::rotate: can not rotate array into itself");
5339  if (!rotated->shapeIsKnown_)
5340  *rotated = *this;
5341  if (dim_ != rotated->dim_) throw npstat::NpstatInvalidArgument(
5342  "In npstat::ArrayND::rotate: incompatible argument array rank");
5343  if (lenShifts != dim_) throw npstat::NpstatInvalidArgument(
5344  "In npstat::ArrayND::rotate: incompatible dimensionality of shifts");
5345 
5346  if (dim_)
5347  {
5348  assert(shifts);
5349  if (dim_ > CHAR_BIT*sizeof(unsigned long))
5351  "In npstat::ArrayND::rotate: array rank is too large");
5352  unsigned buf[CHAR_BIT*sizeof(unsigned long)];
5353  clearBuffer(buf, dim_);
5354  (const_cast<ArrayND*>(this))->flatCircularLoop(
5355  0U, 0UL, 0UL, buf, shape_, shifts,
5356  *rotated, scast_assign_right<Numeric,Num2>());
5357  }
5358  else
5359  rotated->localData_[0] = static_cast<Num2>(localData_[0]);
5360  }
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:57
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceInnerLoop ( unsigned  level,
unsigned long  idx0,
Num2 &  scale,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices,
Functor  binaryFunct 
)
private

Definition at line 2151 of file ArrayND.h.

References data, i, customizeTrackingMonitorSeedNumber::idx, and testEve_cfg::level.

2155  {
2156  const unsigned idx = projectedIndices[level];
2157  const unsigned imax = shape_[idx];
2158  const unsigned long stride = strides_[idx];
2159 
2160  if (level == nProjectedIndices - 1)
2161  {
2162  Numeric* data = data_ + idx0;
2163  for (unsigned i = 0; i<imax; ++i)
2164  binaryFunct(data[i*stride], scale);
2165  }
2166  else
2167  for (unsigned i = 0; i<imax; ++i)
2168  scaleBySliceInnerLoop(level+1, idx0+i*stride, scale,
2169  projectedIndices, nProjectedIndices,
2170  binaryFunct);
2171  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long * strides_
Definition: ArrayND.h:1004
void scaleBySliceInnerLoop(unsigned level, unsigned long idx0, Num2 &scale, const unsigned *projectedIndices, unsigned nProjectedIndices, Functor binaryFunct)
Definition: ArrayND.h:2151
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop ( unsigned  level,
unsigned long  idx0,
unsigned  level1,
unsigned long  idx1,
ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
unsigned  nFixedIndices,
Functor  binaryFunct 
)
private

Definition at line 2175 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, testEve_cfg::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

2182  {
2183  if (level == dim_)
2184  {
2185  assert(level1 == slice.dim_);
2186  Num2& scaleFactor = slice.dim_ ? slice.data_[idx1] :
2187  slice.localData_[0];
2188  scaleBySliceInnerLoop(0U, idx0, scaleFactor, projectedIndices,
2189  nProjectedIndices, binaryFunct);
2190  }
2191  else
2192  {
2193  bool fixed = false;
2194  for (unsigned j=0; j<nProjectedIndices; ++j)
2195  if (projectedIndices[j] == level)
2196  {
2197  fixed = true;
2198  break;
2199  }
2200  if (fixed)
2201  {
2202  scaleBySliceLoop(level+1, idx0, level1, idx1, slice,
2203  projectedIndices, nProjectedIndices,
2204  binaryFunct);
2205  }
2206  else
2207  {
2208  const unsigned imax = shape_[level];
2209  const unsigned long stride = strides_[level];
2210  const unsigned long stride2 = slice.strides_[level1];
2211  for (unsigned i = 0; i<imax; ++i)
2212  scaleBySliceLoop(level+1, idx0+i*stride, level1+1,
2213  idx1+i*stride2, slice, projectedIndices,
2214  nProjectedIndices, binaryFunct);
2215  }
2216  }
2217  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
void scaleBySliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:2175
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
void scaleBySliceInnerLoop(unsigned level, unsigned long idx0, Num2 &scale, const unsigned *projectedIndices, unsigned nProjectedIndices, Functor binaryFunct)
Definition: ArrayND.h:2151
tuple level
Definition: testEve_cfg.py:34
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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).

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<class Functor >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::scanInPlace ( Functor  f)

Definition at line 4573 of file ArrayND.h.

References f, and i.

4575  {
4577  "Initialize npstat::ArrayND before calling method \"scanInPlace\"");
4578  for (unsigned long i=0; i<len_; ++i)
4579  f(data_[i]);
4580  return *this;
4581  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
double f[11][100]
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
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

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
ArrayND<Numeric,Len,Dim>& npstat::ArrayND< Numeric, StackLen, StackDim >::setData ( const Num2 *  data,
const unsigned long  dataLength 
)
inline

Definition at line 2365 of file ArrayND.h.

References npstat::copyBuffer().

2367  {
2369  "Initialize npstat::ArrayND before calling method \"setData\"");
2370  if (dataLength != len_) throw npstat::NpstatInvalidArgument(
2371  "In npstat::ArrayND::setData: incompatible input data length");
2372  copyBuffer(data_, data, dataLength);
2373  return *this;
2374  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
bool shapeIsKnown_
Definition: ArrayND.h:1012
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayShape npstat::ArrayND< Numeric, Len, Dim >::shape ( void  ) const
inline

Get the complete shape

Definition at line 2983 of file ArrayND.h.

2984  {
2986  "Initialize npstat::ArrayND before calling method \"shape\"");
2987  return ArrayShape(shape_, shape_+dim_);
2988  }
unsigned * shape_
Definition: ArrayND.h:1007
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
const unsigned* npstat::ArrayND< Numeric, StackLen, StackDim >::shapeData ( ) const
inline

Shape data as a C-style array

Definition at line 246 of file ArrayND.h.

246 {return shape_;}
unsigned * shape_
Definition: ArrayND.h:1007
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::span ( unsigned  dim) const
inline

Get the number of elements in some particular dimension

Definition at line 5440 of file ArrayND.h.

Referenced by npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::ArrayMapper().

5441  {
5442  if (dim >= dim_)
5444  "In npstat::ArrayND::span: dimension number is out of range");
5445  return shape_[dim];
5446  }
unsigned * shape_
Definition: ArrayND.h:1007
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
const unsigned long* npstat::ArrayND< Numeric, StackLen, StackDim >::strides ( ) const
inline

Get the strides

Definition at line 261 of file ArrayND.h.

261 {return strides_;}
unsigned long * strides_
Definition: ArrayND.h:1004
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection ( ArrayND< Num2, Len2, Dim2 > *  projection,
AbsArrayProjector< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

Definition at line 2008 of file ArrayND.h.

References npstat::destroyBuffer(), i, and npstat::makeBuffer().

2013  {
2014  assert(projection);
2015  verifyProjectionCompatibility(*projection, projectedIndices,
2016  nProjectedIndices);
2017  unsigned ibuf[StackDim];
2018  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2019  for (unsigned i=0; i<dim_; ++i)
2020  buf[i] = 0U;
2021  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
2022  projector, projectedIndices, nProjectedIndices,
2023  scast_minuseq_left<Num2,Num3>());
2024  destroyBuffer(buf, ibuf);
2025  }
int i
Definition: DBlmapReader.cc:9
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
void projectLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, unsigned *currentIndex, ArrayND< Num2, Len2, Dim2 > *projection, AbsArrayProjector< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:1851
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2, typename Num3 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection ( ArrayND< Num2, Len2, Dim2 > *  projection,
AbsVisitor< Numeric, Num3 > &  projector,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const

Definition at line 2135 of file ArrayND.h.

2140  {
2141  assert(projection);
2142  verifyProjectionCompatibility(*projection, projectedIndices,
2143  nProjectedIndices);
2144  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2145  projector, projectedIndices, nProjectedIndices,
2146  scast_minuseq_left<Num2,Num3>());
2147  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:1915
void projectLoop2(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, ArrayND< Num2, Len2, Dim2 > *projection, AbsVisitor< Numeric, Num3 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices, Op fcn) const
Definition: ArrayND.h:2053
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 >
Num2 npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 4941 of file ArrayND.h.

References i.

4942  {
4944  "Initialize npstat::ArrayND before calling method \"sum\"");
4945  Num2 sum = Num2();
4946  for (unsigned long i=0; i<len_; ++i)
4947  sum += data_[i];
4948  return sum;
4949  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long len_
Definition: ArrayND.h:1009
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Accumulator >
Accumulator npstat::ArrayND< Numeric, Len, Dim >::sumBelowLoop ( unsigned  level,
unsigned long  idx0,
const unsigned *  limit 
) const
private

Definition at line 5131 of file ArrayND.h.

References newFWLiteAna::base, i, and testEve_cfg::level.

5134  {
5135  Accumulator cdf = Accumulator();
5136  const unsigned imax = limit[level] + 1U;
5137  if (level == dim_ - 1)
5138  {
5139  Numeric* base = data_ + idx0;
5140  for (unsigned i=0; i<imax; ++i)
5141  cdf += base[i];
5142  }
5143  else
5144  {
5145  const unsigned long stride = strides_[level];
5146  for (unsigned i=0; i<imax; ++i, idx0+=stride)
5147  cdf += sumBelowLoop<Accumulator>(level+1, idx0, limit);
5148  }
5149  return cdf;
5150  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 >
Num2 npstat::ArrayND< Numeric, Len, Dim >::sumsq ( ) const

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

Definition at line 4953 of file ArrayND.h.

References npstat::absValue(), and i.

4954  {
4956  "Initialize npstat::ArrayND before calling method \"sumsq\"");
4957  Num2 sum = Num2();
4958  for (unsigned long i=0; i<len_; ++i)
4959  {
4960  const Num2 absval = absValue(data_[i]);
4961  sum += absval*absval;
4962  }
4963  return sum;
4964  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
Private::AbsReturnType< T >::type absValue(const T &v1)
Definition: absDifference.h:96
unsigned long len_
Definition: ArrayND.h:1009
Num2 sum() const
Definition: ArrayND.h:4941
Numeric * data_
Definition: ArrayND.h:1001
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > npstat::ArrayND< Numeric, Len, Dim >::transpose ( unsigned  pos1,
unsigned  pos2 
) const

Transposed array

Definition at line 5243 of file ArrayND.h.

References npstat::copyBuffer(), npstat::destroyBuffer(), npstat::makeBuffer(), query::result, std::swap(), and geometryDiff::transpose().

5245  {
5247  "Initialize npstat::ArrayND before calling method \"transpose\"");
5248  if (!(pos1 < dim_ && pos2 < dim_ && pos1 != pos2))
5249  throw npstat::NpstatInvalidArgument("In npstat::ArrayND::transpose: "
5250  "incompatible transposition indices");
5251  if (dim_ == 2)
5252  return transpose();
5253  else
5254  {
5255  // Construct the new shape
5256  unsigned newshapeBuf[Dim];
5257  unsigned *newshape = makeBuffer(dim_, newshapeBuf, Dim);
5258  copyBuffer(newshape, shape_, dim_);
5259  std::swap(newshape[pos1], newshape[pos2]);
5260 
5261  // Form the result array
5262  ArrayND<Numeric,Len,Dim> result(newshape, dim_);
5263 
5264  // Fill the result array
5265  transposeLoop(0, pos1, pos2, 0UL, 0UL, result);
5266 
5267  destroyBuffer(newshape, newshapeBuf);
5268  return result;
5269  }
5270  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
void transposeLoop(unsigned level, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:4918
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tuple result
Definition: query.py:137
ArrayND transpose() const
Definition: ArrayND.h:5052
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > npstat::ArrayND< Numeric, Len, Dim >::transpose ( ) const

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

Definition at line 5052 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, j, and query::result.

5053  {
5054  if (dim_ != 2) throw npstat::NpstatInvalidArgument(
5055  "npstat::ArrayND::transpose method "
5056  "can not be used with arrays of rank other than 2");
5057  unsigned newshape[2];
5058  newshape[0] = shape_[1];
5059  newshape[1] = shape_[0];
5060  ArrayND<Numeric,Len,Dim> result(newshape, dim_);
5061  const unsigned imax = shape_[0];
5062  const unsigned jmax = shape_[1];
5063  for (unsigned i=0; i<imax; ++i)
5064  for (unsigned j=0; j<jmax; ++j)
5065  result.data_[j*imax + i] = data_[i*jmax + j];
5066  return result;
5067  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::transposeLoop ( unsigned  level,
unsigned  pos1,
unsigned  pos2,
unsigned long  idxThis,
unsigned long  idxRes,
ArrayND< Numeric, StackLen, StackDim > &  result 
) const
private

Definition at line 4918 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, i, testEve_cfg::level, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

4921  {
4922  const unsigned imax = shape_[level];
4923  const unsigned long mystride = strides_[level];
4924  const unsigned relevel = level == pos1 ? pos2 :
4925  (level == pos2 ? pos1 : level);
4926  const unsigned long restride = result.strides_[relevel];
4927  const bool ready = (level == dim_ - 1);
4928  for (unsigned i=0; i<imax; ++i)
4929  {
4930  if (ready)
4931  result.data_[idxRes] = data_[idxThis];
4932  else
4933  transposeLoop(level+1, pos1, pos2, idxThis, idxRes, result);
4934  idxThis += mystride;
4935  idxRes += restride;
4936  }
4937  }
int i
Definition: DBlmapReader.cc:9
void transposeLoop(unsigned level, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:4918
unsigned * shape_
Definition: ArrayND.h:1007
tuple result
Definition: query.py:137
unsigned long * strides_
Definition: ArrayND.h:1004
tuple level
Definition: testEve_cfg.py:34
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 4601 of file ArrayND.h.

References npstat::destroyBuffer().

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::restore().

4602  {
4606  localData_[0] = Numeric();
4607  data_ = localData_;
4608  strides_ = 0;
4609  shape_ = 0;
4610  len_ = 0;
4611  dim_ = 0;
4612  shapeIsKnown_ = false;
4613  return *this;
4614  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1006
unsigned * shape_
Definition: ArrayND.h:1007
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1003
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
Numeric * data_
Definition: ArrayND.h:1001
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::value ( const unsigned *  index,
unsigned  indexLen 
)
inline

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

Definition at line 3099 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror().

3101  {
3103  "Initialize npstat::ArrayND before calling method \"value\"");
3104  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3105  "In npstat::ArrayND::value: incompatible index length");
3106  if (dim)
3107  {
3108  assert(index);
3109  unsigned long idx = 0UL;
3110  for (unsigned i=0; i<dim_; ++i)
3111  idx += index[i]*strides_[i];
3112  return data_[idx];
3113  }
3114  else
3115  return localData_[0];
3116  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::value ( const unsigned *  index,
unsigned  indexLen 
) const
inline

Definition at line 3119 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

3121  {
3123  "Initialize npstat::ArrayND before calling method \"value\"");
3124  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3125  "In npstat::ArrayND::value: incompatible index length");
3126  if (dim)
3127  {
3128  assert(index);
3129  unsigned long idx = 0UL;
3130  for (unsigned i=0; i<dim_; ++i)
3131  idx += index[i]*strides_[i];
3132  return data_[idx];
3133  }
3134  else
3135  return localData_[0];
3136  }
int i
Definition: DBlmapReader.cc:9
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::valueAt ( const unsigned *  index,
unsigned  indexLen 
)
inline

Element access using multidimensional array index (with bounds checking)

Definition at line 3249 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

3251  {
3253  "Initialize npstat::ArrayND before calling method \"valueAt\"");
3254  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3255  "In npstat::ArrayND::valueAt: incompatible index length");
3256  if (dim)
3257  {
3258  assert(index);
3259  unsigned long idx = 0UL;
3260  for (unsigned i=0; i<dim_; ++i)
3261  {
3262  if (index[i] >= shape_[i]) throw npstat::NpstatOutOfRange(
3263  "In npstat::ArrayND::valueAt: index out of range");
3264  idx += index[i]*strides_[i];
3265  }
3266  return data_[idx];
3267  }
3268  else
3269  return localData_[0];
3270  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::valueAt ( const unsigned *  index,
unsigned  indexLen 
) const
inline

Definition at line 3225 of file ArrayND.h.

References i, and customizeTrackingMonitorSeedNumber::idx.

3227  {
3229  "Initialize npstat::ArrayND before calling method \"valueAt\"");
3230  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3231  "In npstat::ArrayND::valueAt: incompatible index length");
3232  if (dim)
3233  {
3234  assert(index);
3235  unsigned long idx = 0UL;
3236  for (unsigned i=0; i<dim_; ++i)
3237  {
3238  if (index[i] >= shape_[i]) throw npstat::NpstatOutOfRange(
3239  "In npstat::ArrayND::valueAt: index out of range");
3240  idx += index[i]*strides_[i];
3241  }
3242  return data_[idx];
3243  }
3244  else
3245  return localData_[0];
3246  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
unsigned long * strides_
Definition: ArrayND.h:1004
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility ( const ArrayND< Num2, Len2, Dim2 > &  projection,
const unsigned *  projectedIndices,
unsigned  nProjectedIndices 
) const
private

Definition at line 1915 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, j, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

1919  {
1920  if (!(nProjectedIndices && nProjectedIndices <= dim_))
1922  "In npstat::ArrayND::verifyProjectionCompatibility: "
1923  "invalid number of projected indices");
1925  "Initialize npstat::ArrayND before calling "
1926  "method \"verifyProjectionCompatibility\"");
1927  if (!projection.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
1928  "In npstat::ArrayND::verifyProjectionCompatibility: "
1929  "uninitialized argument array");
1930  if (projection.dim_ != dim_ - nProjectedIndices)
1932  "In npstat::ArrayND::verifyProjectionCompatibility: "
1933  "incompatible argument array rank");
1934  assert(projectedIndices);
1935 
1936  for (unsigned j=0; j<nProjectedIndices; ++j)
1937  if (projectedIndices[j] >= dim_) throw npstat::NpstatOutOfRange(
1938  "In npstat::ArrayND::verifyProjectionCompatibility: "
1939  "projected index out of range");
1940 
1941  // Check projection shape compatibility
1942  unsigned sliceDim = 0U;
1943  for (unsigned i=0; i<dim_; ++i)
1944  {
1945  bool fixed = false;
1946  for (unsigned j=0; j<nProjectedIndices; ++j)
1947  if (projectedIndices[j] == i)
1948  {
1949  fixed = true;
1950  break;
1951  }
1952  if (!fixed)
1953  {
1954  if (shape_[i] != projection.shape_[sliceDim])
1956  "In npstat::ArrayND::verifyProjectionCompatibility: "
1957  "incompatible argument array dimensions");
1958  ++sliceDim;
1959  }
1960  }
1961  assert(sliceDim == projection.dim_);
1962  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int j
Definition: DBlmapReader.cc:9
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , unsigned Len2, unsigned Dim2>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility ( const ArrayND< Num2, Len2, Dim2 > &  slice,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
) const
private

Definition at line 1698 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, i, customizeTrackingMonitorSeedNumber::idx, j, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

1703  {
1704  if (!(nFixedIndices && nFixedIndices <= dim_))
1706  "In npstat::ArrayND::verifySliceCompatibility: "
1707  "invalid number of fixed indices");
1709  "Initialize npstat::ArrayND before calling "
1710  "method \"verifySliceCompatibility\"");
1711  if (!slice.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
1712  "In npstat::ArrayND::verifySliceCompatibility: "
1713  "uninitialized argument array");
1714  if (slice.dim_ != dim_ - nFixedIndices) throw npstat::NpstatInvalidArgument(
1715  "In npstat::ArrayND::verifySliceCompatibility: "
1716  "incompatible argument array rank");
1717  assert(fixedIndices);
1718  assert(fixedIndexValues);
1719 
1720  for (unsigned j=0; j<nFixedIndices; ++j)
1721  if (fixedIndices[j] >= dim_) throw npstat::NpstatOutOfRange(
1722  "In npstat::ArrayND::verifySliceCompatibility: "
1723  "fixed index out of range");
1724 
1725  // Check slice shape compatibility
1726  unsigned long idx = 0UL;
1727  unsigned sliceDim = 0U;
1728  for (unsigned i=0; i<dim_; ++i)
1729  {
1730  bool fixed = false;
1731  for (unsigned j=0; j<nFixedIndices; ++j)
1732  if (fixedIndices[j] == i)
1733  {
1734  fixed = true;
1735  if (fixedIndexValues[j] >= shape_[i])
1737  "In npstat::ArrayND::verifySliceCompatibility: "
1738  "fixed index value out of range");
1739  idx += fixedIndexValues[j]*strides_[i];
1740  break;
1741  }
1742  if (!fixed)
1743  {
1744  if (shape_[i] != slice.shape_[sliceDim])
1746  "In npstat::ArrayND::verifySliceCompatibility: "
1747  "incompatible argument array dimensions");
1748  ++sliceDim;
1749  }
1750  }
1751  assert(sliceDim == slice.dim_);
1752  return idx;
1753  }
int i
Definition: DBlmapReader.cc:9
unsigned * shape_
Definition: ArrayND.h:1007
bool shapeIsKnown_
Definition: ArrayND.h:1012
int j
Definition: DBlmapReader.cc:9
unsigned long * strides_
Definition: ArrayND.h:1004
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned dim_
Definition: ArrayND.h:1010
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
static unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::version ( )
inlinestatic

Definition at line 996 of file ArrayND.h.

996 {return 1;}
template<typename Numeric , unsigned StackLen, unsigned StackDim>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::write ( std::ostream &  of) const

Definition at line 5859 of file ArrayND.h.

5860  {
5862  "Initialize npstat::ArrayND before calling method \"write\"");
5863  gs::write_pod_vector(os, shape());
5864  return !os.fail() &&
5865  (dim_ ? gs::write_array(os, data_, len_) :
5866  gs::write_item(os, localData_[0], false));
5867  }
ArrayShape shape() const
Definition: ArrayND.h:2983
bool shapeIsKnown_
Definition: ArrayND.h:1012
Numeric localData_[StackLen]
Definition: ArrayND.h:1000
unsigned long len_
Definition: ArrayND.h:1009
volatile std::atomic< bool > shutdown_flag false
Numeric * data_
Definition: ArrayND.h:1001
unsigned dim_
Definition: ArrayND.h:1010

Friends And Related Function Documentation

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , unsigned Len2, unsigned Dim2>
friend class ArrayND
friend

Definition at line 51 of file ArrayND.h.

Member Data Documentation

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
Numeric* npstat::ArrayND< Numeric, StackLen, StackDim >::data_
private

Definition at line 1001 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addmul(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::commonSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::copyRangeLoopFunct(), npstat::ArrayND< Num1, Len1, Dim1 >::data(), npstat::ArrayND< Numeric, StackLen, StackDim >::derivative(), npstat::ArrayND< Numeric, StackLen, StackDim >::dot(), npstat::ArrayND< Numeric, StackLen, StackDim >::dotProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::dualCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::flatCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator*(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator+(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator+=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator-(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator-=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator/(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::outerProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), and npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop().

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::dim_
private

Definition at line 1010 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::dot(), npstat::ArrayND< Numeric, StackLen, StackDim >::dotProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::outerProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Num1, Len1, Dim1 >::rank(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::rotate(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility(), and npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility().

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::len_
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
Numeric npstat::ArrayND< Numeric, StackLen, StackDim >::localData_[StackLen]
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::localShape_[StackDim]
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::localStrides_[StackDim]
private

Definition at line 1003 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND().

template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned* npstat::ArrayND< Numeric, StackLen, StackDim >::shape_
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
bool npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned long* npstat::ArrayND< Numeric, StackLen, StackDim >::strides_
private