CMS 3D CMS Logo

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 >
void exportMemSlice (Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
 
template<typename Num2 , unsigned Len2, unsigned Dim2>
void exportSlice (ArrayND< Num2, Len2, Dim2 > *slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
 
template<typename Num2 , 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 >
void importMemSlice (const Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices)
 
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 , class Functor >
void jointMemSliceScan (Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
 
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void jointScan (ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
 
template<typename Num2 , class Op >
void jointSliceLoop (const unsigned level, const unsigned long idx0, const unsigned level1, const unsigned long idx1, Num2 *sliceData, const unsigned long *sliceStrides, 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
 
ArrayShape sliceShape (const unsigned *fixedIndices, unsigned nFixedIndices) 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 , class Functor >
void jointSliceLoop (unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, Num2 *sliceData, const unsigned long *sliceStrides, 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
 
unsigned long verifyBufferSliceCompatibility (unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, unsigned long *sliceStrides) 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 2570 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(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), and npstat::ArrayND< Numeric, StackLen, StackDim >::operator=().

2571  : data_(nullptr), strides_(nullptr), shape_(nullptr),
2572  len_(0UL), dim_(0U), shapeIsKnown_(false)
2573  {
2574  localData_[0] = Numeric();
2575  data_ = localData_;
2576  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2784 of file ArrayND.h.

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

2785  : data_(nullptr), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2786  {
2787  const unsigned sz = sh.size();
2788  buildFromShapePtr(sz ? &sh[0] : nullptr, sz);
2789  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( const unsigned *  shape,
unsigned  dim 
)

Definition at line 2792 of file ArrayND.h.

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

2794  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2795  {
2796  buildFromShapePtr(sizes, dim);
2797  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2579 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_.

2580  : data_(nullptr), strides_(nullptr), shape_(nullptr),
2581  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2582  {
2583  if (dim_)
2584  {
2585  // Copy the shape
2586  shape_ = makeBuffer(dim_, localShape_, Dim);
2587  copyBuffer(shape_, r.shape_, dim_);
2588 
2589  // Copy the strides
2591  copyBuffer(strides_, r.strides_, dim_);
2592 
2593  // Copy the data
2594  data_ = makeBuffer(len_, localData_, Len);
2595  copyBuffer(data_, r.data_, len_);
2596  }
2597  else
2598  {
2599  assert(len_ == 1UL);
2600  localData_[0] = r.localData_[0];
2601  data_ = localData_;
2602  }
2603  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1051
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2607 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_.

2608  : data_(0), strides_(nullptr), shape_(nullptr),
2609  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2610  {
2611  if (dim_)
2612  {
2613  // Copy the shape
2614  shape_ = makeBuffer(dim_, localShape_, Dim);
2615  copyBuffer(shape_, r.shape_, dim_);
2616 
2617  // Copy the strides
2619  copyBuffer(strides_, r.strides_, dim_);
2620 
2621  // Copy the data
2622  data_ = makeBuffer(len_, localData_, Len);
2623  copyBuffer(data_, r.data_, len_);
2624  }
2625  else
2626  {
2627  assert(len_ == 1UL);
2628  localData_[0] = static_cast<Numeric>(r.localData_[0]);
2629  data_ = localData_;
2630  }
2631  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1051
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2635 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, mps_fire::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_.

2637  : data_(0), strides_(nullptr), shape_(nullptr),
2638  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2639  {
2640  if (dim_)
2641  {
2642  // Copy the shape
2643  shape_ = makeBuffer(dim_, localShape_, Dim);
2644  copyBuffer(shape_, r.shape_, dim_);
2645 
2646  // Copy the strides
2648  copyBuffer(strides_, r.strides_, dim_);
2649 
2650  // Copy the data
2651  data_ = makeBuffer(len_, localData_, Len);
2652  for (unsigned long i=0; i<len_; ++i)
2653  data_[i] = static_cast<Numeric>(f(r.data_[i]));
2654  }
2655  else
2656  {
2657  assert(len_ == 1UL);
2658  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
2659  data_ = localData_;
2660  }
2661  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1051
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2695 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(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and mitigatedMETSequence_cff::U.

2697  : data_(0), strides_(nullptr), shape_(nullptr),
2698  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2699  {
2700  if (!range.isCompatible(r.shape_, r.dim_))
2702  "In npstat::ArrayND subrange constructor: invalid subrange");
2703  if (dim_)
2704  {
2705  len_ = range.rangeSize();
2706  if (!len_)
2708  "In npstat::ArrayND subrange constructor: empty subrange");
2709 
2710  // Figure out the shape
2711  shape_ = makeBuffer(dim_, localShape_, Dim);
2712  range.rangeLength(shape_, dim_);
2713 
2714  // Figure out the strides
2715  buildStrides();
2716 
2717  // Allocate the data array
2718  data_ = makeBuffer(len_, localData_, Len);
2719 
2720  // Copy the data
2721  if (dim_ > CHAR_BIT*sizeof(unsigned long))
2723  "In npstat::ArrayND subrange constructor: "
2724  "input array rank is too large");
2725  unsigned lolim[CHAR_BIT*sizeof(unsigned long)];
2726  range.lowerLimits(lolim, dim_);
2727  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
2728  clearBuffer(toBuf, dim_);
2729  (const_cast<ArrayND<Num2, Len2, Dim2>&>(r)).commonSubrangeLoop(
2730  0U, 0UL, 0UL, lolim, shape_, toBuf, *this,
2731  scast_assign_right<Num2,Numeric>());
2732  }
2733  else
2734  {
2735  assert(len_ == 1UL);
2736  localData_[0] = static_cast<Numeric>(r.localData_[0]);
2737  data_ = localData_;
2738  }
2739  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
void buildStrides()
Definition: ArrayND.h:2559
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:100
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2743 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, mps_fire::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(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and mitigatedMETSequence_cff::U.

2746  : data_(0), strides_(nullptr), shape_(nullptr),
2747  len_(r.len_), dim_(r.dim_), shapeIsKnown_(r.shapeIsKnown_)
2748  {
2749  if (!range.isCompatible(r.shape_, r.dim_))
2751  "In npstat::ArrayND transforming subrange constructor: "
2752  "incompatible subrange");
2753  if (dim_)
2754  {
2755  len_ = range.rangeSize();
2756  if (!len_)
2758  "In npstat::ArrayND transforming subrange constructor: "
2759  "empty subrange");
2760 
2761  // Figure out the shape
2762  shape_ = makeBuffer(dim_, localShape_, Dim);
2763  for (unsigned i=0; i<dim_; ++i)
2764  shape_[i] = range[i].length();
2765 
2766  // Figure out the strides
2767  buildStrides();
2768 
2769  // Allocate the data array
2770  data_ = makeBuffer(len_, localData_, Len);
2771 
2772  // Transform the data
2773  copyRangeLoopFunct(0U, 0UL, 0UL, r, range, f);
2774  }
2775  else
2776  {
2777  assert(len_ == 1UL);
2778  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
2779  data_ = localData_;
2780  }
2781  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
void buildStrides()
Definition: ArrayND.h:2559
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long length() const
Definition: ArrayND.h:231
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
void copyRangeLoopFunct(unsigned level, unsigned long idx0, unsigned long idx1, const ArrayND< Num2, Len2, Dim2 > &r, const ArrayRange &range, Functor f)
Definition: ArrayND.h:2665
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1686 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_, alignBH_cfg::fixed, mps_fire::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_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

1689  : data_(0), strides_(nullptr), shape_(nullptr),
1690  len_(1UL), dim_(slicedArray.dim_ - nFixedIndices),
1691  shapeIsKnown_(true)
1692  {
1693  if (nFixedIndices)
1694  {
1695  assert(fixedIndices);
1696  if (nFixedIndices > slicedArray.dim_) throw npstat::NpstatInvalidArgument(
1697  "In npstat::ArrayND slicing constructor: too many fixed indices");
1698  if (!slicedArray.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
1699  "In npstat::ArrayND slicing constructor: "
1700  "uninitialized argument array");
1701 
1702  // Check that the fixed indices are within range
1703  for (unsigned j=0; j<nFixedIndices; ++j)
1704  if (fixedIndices[j] >= slicedArray.dim_)
1705  throw npstat::NpstatOutOfRange("In npstat::ArrayND slicing "
1706  "constructor: fixed index out of range");
1707 
1708  // Build the shape for the slice
1709  shape_ = makeBuffer(dim_, localShape_, StackDim);
1710  unsigned idim = 0;
1711  for (unsigned i=0; i<slicedArray.dim_; ++i)
1712  {
1713  bool fixed = false;
1714  for (unsigned j=0; j<nFixedIndices; ++j)
1715  if (fixedIndices[j] == i)
1716  {
1717  fixed = true;
1718  break;
1719  }
1720  if (!fixed)
1721  {
1722  assert(idim < dim_);
1723  shape_[idim++] = slicedArray.shape_[i];
1724  }
1725  }
1726  assert(idim == dim_);
1727 
1728  if (dim_)
1729  {
1730  // Copy the array shape and figure out the array length
1731  for (unsigned i=0; i<dim_; ++i)
1732  len_ *= shape_[i];
1733 
1734  // Figure out the array strides
1735  buildStrides();
1736 
1737  // Allocate the data array
1738  data_ = makeBuffer(len_, localData_, StackLen);
1739  }
1740  else
1741  {
1742  localData_[0] = Numeric();
1743  data_ = localData_;
1744  }
1745  }
1746  else
1747  {
1748  new (this) ArrayND(slicedArray);
1749  }
1750  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
void buildStrides()
Definition: ArrayND.h:2559
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3021 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_, mps_fire::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_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

3023  : data_(0), strides_(nullptr), shape_(nullptr),
3024  len_(1UL), dim_(a1.dim_ + a2.dim_), shapeIsKnown_(true)
3025  {
3026  if (!(a1.shapeIsKnown_ && a2.shapeIsKnown_))
3028  "In npstat::ArrayND outer product constructor: "
3029  "uninitialized argument array");
3030  if (dim_)
3031  {
3032  shape_ = makeBuffer(dim_, localShape_, Dim);
3033  copyBuffer(shape_, a1.shape_, a1.dim_);
3034  copyBuffer(shape_+a1.dim_, a2.shape_, a2.dim_);
3035 
3036  for (unsigned i=0; i<dim_; ++i)
3037  {
3038  assert(shape_[i]);
3039  len_ *= shape_[i];
3040  }
3041 
3042  // Figure out the array strides
3043  buildStrides();
3044 
3045  // Allocate the data array
3046  data_ = makeBuffer(len_, localData_, Len);
3047 
3048  // Fill the data array
3049  if (a1.dim_ == 0)
3050  {
3051  for (unsigned long i=0; i<len_; ++i)
3052  data_[i] = a1.localData_[0] * a2.data_[i];
3053  }
3054  else if (a2.dim_ == 0)
3055  {
3056  for (unsigned long i=0; i<len_; ++i)
3057  data_[i] = a1.data_[i] * a2.localData_[0];
3058  }
3059  else
3060  outerProductLoop(0U, 0UL, 0UL, 0UL, a1, a2);
3061  }
3062  else
3063  {
3064  localData_[0] = a1.localData_[0] * a2.localData_[0];
3065  data_ = localData_;
3066  }
3067  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
void buildStrides()
Definition: ArrayND.h:2559
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
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:2992
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2800 of file ArrayND.h.

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

2801  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2802  {
2803  const unsigned dim = 1U;
2804  unsigned sizes[dim];
2805  sizes[0] = n0;
2806  buildFromShapePtr(sizes, dim);
2807  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1 
)

Definition at line 2810 of file ArrayND.h.

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

2812  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2813  {
2814  const unsigned dim = 2U;
2815  unsigned sizes[dim];
2816  sizes[0] = n0;
2817  sizes[1] = n1;
2818  buildFromShapePtr(sizes, dim);
2819  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2 
)

Definition at line 2822 of file ArrayND.h.

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

2825  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2826  {
2827  const unsigned dim = 3U;
2828  unsigned sizes[dim];
2829  sizes[0] = n0;
2830  sizes[1] = n1;
2831  sizes[2] = n2;
2832  buildFromShapePtr(sizes, dim);
2833  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::ArrayND ( unsigned  n0,
unsigned  n1,
unsigned  n2,
unsigned  n3 
)

Definition at line 2836 of file ArrayND.h.

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

2840  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2841  {
2842  const unsigned dim = 4U;
2843  unsigned sizes[dim];
2844  sizes[0] = n0;
2845  sizes[1] = n1;
2846  sizes[2] = n2;
2847  sizes[3] = n3;
2848  buildFromShapePtr(sizes, dim);
2849  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2852 of file ArrayND.h.

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

2857  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2858  {
2859  const unsigned dim = 5U;
2860  unsigned sizes[dim];
2861  sizes[0] = n0;
2862  sizes[1] = n1;
2863  sizes[2] = n2;
2864  sizes[3] = n3;
2865  sizes[4] = n4;
2866  buildFromShapePtr(sizes, dim);
2867  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2870 of file ArrayND.h.

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

2876  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2877  {
2878  const unsigned dim = 6U;
2879  unsigned sizes[dim];
2880  sizes[0] = n0;
2881  sizes[1] = n1;
2882  sizes[2] = n2;
2883  sizes[3] = n3;
2884  sizes[4] = n4;
2885  sizes[5] = n5;
2886  buildFromShapePtr(sizes, dim);
2887  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2890 of file ArrayND.h.

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

2897  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2898  {
2899  const unsigned dim = 7U;
2900  unsigned sizes[dim];
2901  sizes[0] = n0;
2902  sizes[1] = n1;
2903  sizes[2] = n2;
2904  sizes[3] = n3;
2905  sizes[4] = n4;
2906  sizes[5] = n5;
2907  sizes[6] = n6;
2908  buildFromShapePtr(sizes, dim);
2909  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2912 of file ArrayND.h.

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

2920  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2921  {
2922  const unsigned dim = 8U;
2923  unsigned sizes[dim];
2924  sizes[0] = n0;
2925  sizes[1] = n1;
2926  sizes[2] = n2;
2927  sizes[3] = n3;
2928  sizes[4] = n4;
2929  sizes[5] = n5;
2930  sizes[6] = n6;
2931  sizes[7] = n7;
2932  buildFromShapePtr(sizes, dim);
2933  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2936 of file ArrayND.h.

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

2945  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2946  {
2947  const unsigned dim = 9U;
2948  unsigned sizes[dim];
2949  sizes[0] = n0;
2950  sizes[1] = n1;
2951  sizes[2] = n2;
2952  sizes[3] = n3;
2953  sizes[4] = n4;
2954  sizes[5] = n5;
2955  sizes[6] = n6;
2956  sizes[7] = n7;
2957  sizes[8] = n8;
2958  buildFromShapePtr(sizes, dim);
2959  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
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 2962 of file ArrayND.h.

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

2972  : data_(0), strides_(nullptr), shape_(nullptr), len_(1UL), shapeIsKnown_(true)
2973  {
2974  const unsigned dim = 10U;
2975  unsigned sizes[dim];
2976  sizes[0] = n0;
2977  sizes[1] = n1;
2978  sizes[2] = n2;
2979  sizes[3] = n3;
2980  sizes[4] = n4;
2981  sizes[5] = n5;
2982  sizes[6] = n6;
2983  sizes[7] = n7;
2984  sizes[8] = n8;
2985  sizes[9] = n9;
2986  buildFromShapePtr(sizes, dim);
2987  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
int n0
Definition: AMPTWrapper.h:34
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
void buildFromShapePtr(const unsigned *, unsigned)
Definition: ArrayND.h:1650
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
npstat::ArrayND< Numeric, Len, Dim >::~ArrayND ( )
inline

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

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

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 4585 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), and npstat::ArrayND< Numeric, StackLen, StackDim >::len_.

4587  {
4589  "In npstat::ArrayND::addmul: "
4590  "incompatible argument array shape");
4591  for (unsigned long i=0; i<len_; ++i)
4592  data_[i] += r.data_[i]*c;
4593  return *this;
4594  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 2169 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

Referenced by npstat::HistoND< Numeric, Axis >::addToProjection(), and npstat::ArrayND< Num1, Len1, Dim1 >::multiplyBySlice().

2174  {
2175  assert(projection);
2176  verifyProjectionCompatibility(*projection, projectedIndices,
2177  nProjectedIndices);
2178  unsigned ibuf[StackDim];
2179  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2180  for (unsigned i=0; i<dim_; ++i)
2181  buf[i] = 0U;
2182  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
2183  projector, projectedIndices, nProjectedIndices,
2184  scast_pluseq_left<Num2,Num3>());
2185  destroyBuffer(buf, ibuf);
2186  }
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:2033
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 2301 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

2306  {
2307  assert(projection);
2308  verifyProjectionCompatibility(*projection, projectedIndices,
2309  nProjectedIndices);
2310  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2311  projector, projectedIndices, nProjectedIndices,
2312  scast_pluseq_left<Num2,Num3>());
2313  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
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:2235
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__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__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__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and npstat::ArrayND< Num1, Len1, Dim1 >::strides().

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 4744 of file ArrayND.h.

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

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__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__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

4745  {
4747  "Initialize npstat::ArrayND before calling method \"apply\"");
4748  for (unsigned long i=0; i<len_; ++i)
4749  data_[i] = static_cast<Numeric>(f(data_[i]));
4750  return *this;
4751  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 2417 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

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

2421  {
2422  if (nFixedIndices)
2423  {
2424  verifyProjectionCompatibility(slice, fixedIndices, nFixedIndices);
2425  if (slice.dim_ == 0U)
2426  for (unsigned long i=0; i<len_; ++i)
2427  binaryFunct(data_[i], slice.localData_[0]);
2428  else
2429  scaleBySliceLoop(0U, 0UL, 0U, 0UL, slice,
2430  fixedIndices, nFixedIndices, binaryFunct);
2431  }
2432  else
2433  jointScan(slice, binaryFunct);
2434  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
void jointScan(ArrayND< Num2, Len2, Dim2 > &other, Functor binaryFunct)
Definition: ArrayND.h:2403
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:2357
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 3139 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

3141  {
3142  if (shapeIsKnown_)
3143  {
3144  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
3145  "In npstat::ArrayND::assign: uninitialized argument array");
3147  "In npstat::ArrayND::assign: incompatible argument array shape");
3148  if (dim_)
3149  for (unsigned long i=0; i<len_; ++i)
3150  data_[i] = static_cast<Numeric>(f(r.data_[i]));
3151  else
3152  localData_[0] = static_cast<Numeric>(f(r.localData_[0]));
3153  }
3154  else
3155  {
3156  // This object is uninitialized. If the object on the
3157  // right is itself initialized, build new array in place.
3158  if (r.shapeIsKnown_)
3159  new (this) ArrayND(r, f);
3160  }
3161  return *this;
3162  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3503 of file ArrayND.h.

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

Referenced by npstat::ArrayND< Num1, Len1, Dim1 >::multiplyBySlice(), and npstat::HistoND< Numeric, Axis >::setBinAt().

3504  {
3506  "Initialize npstat::ArrayND before calling method \"at\"");
3508  "In npstat::ArrayND::at: wrong # of args (not rank 0 array)");
3509  return localData_[0];
3510  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( ) const

Definition at line 3493 of file ArrayND.h.

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

3494  {
3496  "Initialize npstat::ArrayND before calling method \"at\"");
3498  "In npstat::ArrayND::at: wrong # of args (not rank 0 array)");
3499  return localData_[0];
3500  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0)

Definition at line 3524 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and mitigatedMETSequence_cff::U.

3526  {
3527  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3528  "In npstat::ArrayND::at: wrong # of args (not rank 1 array)");
3529  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3530  "In npstat::ArrayND::at: index 0 out of range (rank 1)");
3531  return data_[i0];
3532  }
unsigned * shape_
Definition: ArrayND.h:1055
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0) const

Definition at line 3513 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and mitigatedMETSequence_cff::U.

3515  {
3516  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3517  "In npstat::ArrayND::at: wrong # of args (not rank 1 array)");
3518  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3519  "In npstat::ArrayND::at: index 0 out of range (rank 1)");
3520  return data_[i0];
3521  }
unsigned * shape_
Definition: ArrayND.h:1055
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1 
)

Definition at line 3569 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3572  {
3573  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3574  "In npstat::ArrayND::at: wrong # of args (not rank 2 array)");
3575  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3576  "In npstat::ArrayND::at: index 0 out of range (rank 2)");
3577  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3578  "In npstat::ArrayND::at: index 1 out of range (rank 2)");
3579  return data_[i0*strides_[0] + i1];
3580  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1 
) const

Definition at line 3555 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3558  {
3559  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3560  "In npstat::ArrayND::at: wrong # of args (not rank 2 array)");
3561  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3562  "In npstat::ArrayND::at: index 0 out of range (rank 2)");
3563  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3564  "In npstat::ArrayND::at: index 1 out of range (rank 2)");
3565  return data_[i0*strides_[0] + i1];
3566  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::at ( unsigned  i0,
unsigned  i1,
unsigned  i2 
)

Definition at line 4062 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4066  {
4067  if (3U != dim_) throw npstat::NpstatInvalidArgument(
4068  "In npstat::ArrayND::at: wrong # of args (not rank 3 array)");
4069  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4070  "In npstat::ArrayND::at: index 0 out of range (rank 3)");
4071  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4072  "In npstat::ArrayND::at: index 1 out of range (rank 3)");
4073  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4074  "In npstat::ArrayND::at: index 2 out of range (rank 3)");
4075  return data_[i0*strides_[0] + i1*strides_[1] + i2];
4076  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3833 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3837  {
3838  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3839  "In npstat::ArrayND::at: wrong # of args (not rank 3 array)");
3840  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3841  "In npstat::ArrayND::at: index 0 out of range (rank 3)");
3842  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3843  "In npstat::ArrayND::at: index 1 out of range (rank 3)");
3844  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3845  "In npstat::ArrayND::at: index 2 out of range (rank 3)");
3846  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3847  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4079 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4084  {
4085  if (4U != dim_) throw npstat::NpstatInvalidArgument(
4086  "In npstat::ArrayND::at: wrong # of args (not rank 4 array)");
4087  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4088  "In npstat::ArrayND::at: index 0 out of range (rank 4)");
4089  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4090  "In npstat::ArrayND::at: index 1 out of range (rank 4)");
4091  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4092  "In npstat::ArrayND::at: index 2 out of range (rank 4)");
4093  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4094  "In npstat::ArrayND::at: index 3 out of range (rank 4)");
4095  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
4096  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3850 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3855  {
3856  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3857  "In npstat::ArrayND::at: wrong # of args (not rank 4 array)");
3858  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3859  "In npstat::ArrayND::at: index 0 out of range (rank 4)");
3860  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3861  "In npstat::ArrayND::at: index 1 out of range (rank 4)");
3862  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3863  "In npstat::ArrayND::at: index 2 out of range (rank 4)");
3864  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3865  "In npstat::ArrayND::at: index 3 out of range (rank 4)");
3866  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3867  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4099 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4105  {
4106  if (5U != dim_) throw npstat::NpstatInvalidArgument(
4107  "In npstat::ArrayND::at: wrong # of args (not rank 5 array)");
4108  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4109  "In npstat::ArrayND::at: index 0 out of range (rank 5)");
4110  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4111  "In npstat::ArrayND::at: index 1 out of range (rank 5)");
4112  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4113  "In npstat::ArrayND::at: index 2 out of range (rank 5)");
4114  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4115  "In npstat::ArrayND::at: index 3 out of range (rank 5)");
4116  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4117  "In npstat::ArrayND::at: index 4 out of range (rank 5)");
4118  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4119  i3*strides_[3] + i4];
4120  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3870 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3876  {
3877  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3878  "In npstat::ArrayND::at: wrong # of args (not rank 5 array)");
3879  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3880  "In npstat::ArrayND::at: index 0 out of range (rank 5)");
3881  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3882  "In npstat::ArrayND::at: index 1 out of range (rank 5)");
3883  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3884  "In npstat::ArrayND::at: index 2 out of range (rank 5)");
3885  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3886  "In npstat::ArrayND::at: index 3 out of range (rank 5)");
3887  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3888  "In npstat::ArrayND::at: index 4 out of range (rank 5)");
3889  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3890  i3*strides_[3] + i4];
3891  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4123 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4130  {
4131  if (6U != dim_) throw npstat::NpstatInvalidArgument(
4132  "In npstat::ArrayND::at: wrong # of args (not rank 6 array)");
4133  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4134  "In npstat::ArrayND::at: index 0 out of range (rank 6)");
4135  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4136  "In npstat::ArrayND::at: index 1 out of range (rank 6)");
4137  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4138  "In npstat::ArrayND::at: index 2 out of range (rank 6)");
4139  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4140  "In npstat::ArrayND::at: index 3 out of range (rank 6)");
4141  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4142  "In npstat::ArrayND::at: index 4 out of range (rank 6)");
4143  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4144  "In npstat::ArrayND::at: index 5 out of range (rank 6)");
4145  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4146  i3*strides_[3] + i4*strides_[4] + i5];
4147  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3894 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3901  {
3902  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3903  "In npstat::ArrayND::at: wrong # of args (not rank 6 array)");
3904  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3905  "In npstat::ArrayND::at: index 0 out of range (rank 6)");
3906  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3907  "In npstat::ArrayND::at: index 1 out of range (rank 6)");
3908  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3909  "In npstat::ArrayND::at: index 2 out of range (rank 6)");
3910  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3911  "In npstat::ArrayND::at: index 3 out of range (rank 6)");
3912  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3913  "In npstat::ArrayND::at: index 4 out of range (rank 6)");
3914  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3915  "In npstat::ArrayND::at: index 5 out of range (rank 6)");
3916  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3917  i3*strides_[3] + i4*strides_[4] + i5];
3918  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4150 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4158  {
4159  if (7U != dim_) throw npstat::NpstatInvalidArgument(
4160  "In npstat::ArrayND::at: wrong # of args (not rank 7 array)");
4161  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4162  "In npstat::ArrayND::at: index 0 out of range (rank 7)");
4163  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4164  "In npstat::ArrayND::at: index 1 out of range (rank 7)");
4165  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4166  "In npstat::ArrayND::at: index 2 out of range (rank 7)");
4167  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4168  "In npstat::ArrayND::at: index 3 out of range (rank 7)");
4169  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4170  "In npstat::ArrayND::at: index 4 out of range (rank 7)");
4171  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4172  "In npstat::ArrayND::at: index 5 out of range (rank 7)");
4173  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4174  "In npstat::ArrayND::at: index 6 out of range (rank 7)");
4175  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4176  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
4177  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3921 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3929  {
3930  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3931  "In npstat::ArrayND::at: wrong # of args (not rank 7 array)");
3932  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3933  "In npstat::ArrayND::at: index 0 out of range (rank 7)");
3934  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3935  "In npstat::ArrayND::at: index 1 out of range (rank 7)");
3936  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3937  "In npstat::ArrayND::at: index 2 out of range (rank 7)");
3938  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3939  "In npstat::ArrayND::at: index 3 out of range (rank 7)");
3940  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3941  "In npstat::ArrayND::at: index 4 out of range (rank 7)");
3942  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3943  "In npstat::ArrayND::at: index 5 out of range (rank 7)");
3944  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3945  "In npstat::ArrayND::at: index 6 out of range (rank 7)");
3946  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3947  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3948  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4180 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4189  {
4190  if (8U != dim_) throw npstat::NpstatInvalidArgument(
4191  "In npstat::ArrayND::at: wrong # of args (not rank 8 array)");
4192  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4193  "In npstat::ArrayND::at: index 0 out of range (rank 8)");
4194  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4195  "In npstat::ArrayND::at: index 1 out of range (rank 8)");
4196  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4197  "In npstat::ArrayND::at: index 2 out of range (rank 8)");
4198  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4199  "In npstat::ArrayND::at: index 3 out of range (rank 8)");
4200  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4201  "In npstat::ArrayND::at: index 4 out of range (rank 8)");
4202  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4203  "In npstat::ArrayND::at: index 5 out of range (rank 8)");
4204  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4205  "In npstat::ArrayND::at: index 6 out of range (rank 8)");
4206  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4207  "In npstat::ArrayND::at: index 7 out of range (rank 8)");
4208  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4209  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4210  i6*strides_[6] + i7];
4211  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3951 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3960  {
3961  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3962  "In npstat::ArrayND::at: wrong # of args (not rank 8 array)");
3963  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3964  "In npstat::ArrayND::at: index 0 out of range (rank 8)");
3965  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
3966  "In npstat::ArrayND::at: index 1 out of range (rank 8)");
3967  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
3968  "In npstat::ArrayND::at: index 2 out of range (rank 8)");
3969  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
3970  "In npstat::ArrayND::at: index 3 out of range (rank 8)");
3971  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
3972  "In npstat::ArrayND::at: index 4 out of range (rank 8)");
3973  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
3974  "In npstat::ArrayND::at: index 5 out of range (rank 8)");
3975  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
3976  "In npstat::ArrayND::at: index 6 out of range (rank 8)");
3977  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
3978  "In npstat::ArrayND::at: index 7 out of range (rank 8)");
3979  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3980  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3981  i6*strides_[6] + i7];
3982  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4214 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4224  {
4225  if (9U != dim_) throw npstat::NpstatInvalidArgument(
4226  "In npstat::ArrayND::at: wrong # of args (not rank 9 array)");
4227  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4228  "In npstat::ArrayND::at: index 0 out of range (rank 9)");
4229  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4230  "In npstat::ArrayND::at: index 1 out of range (rank 9)");
4231  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4232  "In npstat::ArrayND::at: index 2 out of range (rank 9)");
4233  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4234  "In npstat::ArrayND::at: index 3 out of range (rank 9)");
4235  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4236  "In npstat::ArrayND::at: index 4 out of range (rank 9)");
4237  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4238  "In npstat::ArrayND::at: index 5 out of range (rank 9)");
4239  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4240  "In npstat::ArrayND::at: index 6 out of range (rank 9)");
4241  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4242  "In npstat::ArrayND::at: index 7 out of range (rank 9)");
4243  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4244  "In npstat::ArrayND::at: index 8 out of range (rank 9)");
4245  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4246  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4247  i6*strides_[6] + i7*strides_[7] + i8];
4248  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3985 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3995  {
3996  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3997  "In npstat::ArrayND::at: wrong # of args (not rank 9 array)");
3998  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
3999  "In npstat::ArrayND::at: index 0 out of range (rank 9)");
4000  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4001  "In npstat::ArrayND::at: index 1 out of range (rank 9)");
4002  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4003  "In npstat::ArrayND::at: index 2 out of range (rank 9)");
4004  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4005  "In npstat::ArrayND::at: index 3 out of range (rank 9)");
4006  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4007  "In npstat::ArrayND::at: index 4 out of range (rank 9)");
4008  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4009  "In npstat::ArrayND::at: index 5 out of range (rank 9)");
4010  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4011  "In npstat::ArrayND::at: index 6 out of range (rank 9)");
4012  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4013  "In npstat::ArrayND::at: index 7 out of range (rank 9)");
4014  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4015  "In npstat::ArrayND::at: index 8 out of range (rank 9)");
4016  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4017  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4018  i6*strides_[6] + i7*strides_[7] + i8];
4019  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4251 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4262  {
4263  if (10U != dim_) throw npstat::NpstatInvalidArgument(
4264  "In npstat::ArrayND::at: wrong # of args (not rank 10 array)");
4265  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4266  "In npstat::ArrayND::at: index 0 out of range (rank 10)");
4267  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4268  "In npstat::ArrayND::at: index 1 out of range (rank 10)");
4269  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4270  "In npstat::ArrayND::at: index 2 out of range (rank 10)");
4271  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4272  "In npstat::ArrayND::at: index 3 out of range (rank 10)");
4273  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4274  "In npstat::ArrayND::at: index 4 out of range (rank 10)");
4275  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4276  "In npstat::ArrayND::at: index 5 out of range (rank 10)");
4277  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4278  "In npstat::ArrayND::at: index 6 out of range (rank 10)");
4279  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4280  "In npstat::ArrayND::at: index 7 out of range (rank 10)");
4281  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4282  "In npstat::ArrayND::at: index 8 out of range (rank 10)");
4283  if (i9 >= shape_[9]) throw npstat::NpstatOutOfRange(
4284  "In npstat::ArrayND::at: index 9 out of range (rank 10)");
4285  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4286  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4287  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
4288  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4022 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

4033  {
4034  if (10U != dim_) throw npstat::NpstatInvalidArgument(
4035  "In npstat::ArrayND::at: wrong # of args (not rank 10 array)");
4036  if (i0 >= shape_[0]) throw npstat::NpstatOutOfRange(
4037  "In npstat::ArrayND::at: index 0 out of range (rank 10)");
4038  if (i1 >= shape_[1]) throw npstat::NpstatOutOfRange(
4039  "In npstat::ArrayND::at: index 1 out of range (rank 10)");
4040  if (i2 >= shape_[2]) throw npstat::NpstatOutOfRange(
4041  "In npstat::ArrayND::at: index 2 out of range (rank 10)");
4042  if (i3 >= shape_[3]) throw npstat::NpstatOutOfRange(
4043  "In npstat::ArrayND::at: index 3 out of range (rank 10)");
4044  if (i4 >= shape_[4]) throw npstat::NpstatOutOfRange(
4045  "In npstat::ArrayND::at: index 4 out of range (rank 10)");
4046  if (i5 >= shape_[5]) throw npstat::NpstatOutOfRange(
4047  "In npstat::ArrayND::at: index 5 out of range (rank 10)");
4048  if (i6 >= shape_[6]) throw npstat::NpstatOutOfRange(
4049  "In npstat::ArrayND::at: index 6 out of range (rank 10)");
4050  if (i7 >= shape_[7]) throw npstat::NpstatOutOfRange(
4051  "In npstat::ArrayND::at: index 7 out of range (rank 10)");
4052  if (i8 >= shape_[8]) throw npstat::NpstatOutOfRange(
4053  "In npstat::ArrayND::at: index 8 out of range (rank 10)");
4054  if (i9 >= shape_[9]) throw npstat::NpstatOutOfRange(
4055  "In npstat::ArrayND::at: index 9 out of range (rank 10)");
4056  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
4057  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
4058  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
4059  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::buildFromShapePtr ( const unsigned *  sizes,
unsigned  dim 
)
private

Definition at line 1650 of file ArrayND.h.

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

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

1652  {
1653  dim_ = dim;
1654  if (dim_)
1655  {
1656  assert(sizes);
1657  for (unsigned i=0; i<dim_; ++i)
1658  if (sizes[i] == 0)
1660  "In npstat::ArrayND::buildFromShapePtr: "
1661  "detected span of zero");
1662 
1663  // Copy the array shape and figure out the array length
1664  shape_ = makeBuffer(dim_, localShape_, Dim);
1665  for (unsigned i=0; i<dim_; ++i)
1666  {
1667  shape_[i] = sizes[i];
1668  len_ *= shape_[i];
1669  }
1670 
1671  // Figure out the array strides
1672  buildStrides();
1673 
1674  // Allocate the data array
1675  data_ = makeBuffer(len_, localData_, Len);
1676  }
1677  else
1678  {
1679  localData_[0] = Numeric();
1680  data_ = localData_;
1681  }
1682  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
void buildStrides()
Definition: ArrayND.h:2559
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
void npstat::ArrayND< Numeric, Len, Dim >::buildStrides ( )
private

Definition at line 2559 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::localStrides_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

2560  {
2561  assert(dim_);
2562  if (strides_ == nullptr)
2564  strides_[dim_ - 1] = 1UL;
2565  for (unsigned j=dim_ - 1; j>0; --j)
2566  strides_[j - 1] = strides_[j]*shape_[j];
2567  }
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1051
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 5355 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::length(), mps_fire::result, Scenarios_cff::scale, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::value().

5357  {
5359  "Initialize npstat::ArrayND before calling method \"cdfArray\"");
5360  if (!dim_) throw npstat::NpstatInvalidArgument(
5361  "npstat::ArrayND::cdfArray method "
5362  "can not be used with array of 0 rank");
5363 
5364  const proper_double scale = inscale;
5365  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
5366  if (dim_ >= maxdim)
5368  "In npstat::ArrayND::cdfArray: array rank is too large");
5369  const unsigned long maxcycle = 1UL << dim_;
5370 
5371  ArrayShape sh;
5372  sh.reserve(dim_);
5373  for (unsigned i=0; i<dim_; ++i)
5374  sh.push_back(shape_[i] + 1U);
5375 
5376  ArrayND<Accumulator> result(sh);
5377 
5378  unsigned* psh = &sh[0];
5379  const unsigned long len = result.length();
5380  for (unsigned long ipre=0; ipre<len; ++ipre)
5381  {
5382  result.convertLinearIndex(ipre, psh, dim_);
5383  Accumulator deriv = Accumulator();
5384  bool has0 = false;
5385  for (unsigned i=0; i<dim_; ++i)
5386  if (psh[i]-- == 0U)
5387  {
5388  has0 = true;
5389  break;
5390  }
5391  if (!has0)
5392  {
5393  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5394  {
5395  unsigned long icell = 0UL;
5396  unsigned n1 = 0U;
5397  for (unsigned i=0; i<dim_; ++i)
5398  {
5399  if (icycle & (1UL << i))
5400  {
5401  ++n1;
5402  icell += result.strides_[i]*(psh[i] + 1);
5403  }
5404  else
5405  icell += result.strides_[i]*psh[i];
5406  }
5407  if (n1 < dim_)
5408  {
5409  if ((dim_ - n1) % 2U)
5410  deriv += result.data_[icell];
5411  else
5412  deriv -= result.data_[icell];
5413  }
5414  }
5415  deriv += static_cast<Accumulator>(value(psh, dim_)*scale);
5416  }
5417  result.data_[ipre] = deriv;
5418  }
5419 
5420  // The "return" will convert Accumulator type into Numeric
5421  return result;
5422  }
unsigned * shape_
Definition: ArrayND.h:1055
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
Numeric & value(const unsigned *index, unsigned indexLen)
Definition: ArrayND.h:3281
bool shapeIsKnown_
Definition: ArrayND.h:1060
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 5336 of file ArrayND.h.

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

5338  {
5340  "Initialize npstat::ArrayND before calling method \"cdfValue\"");
5341  if (!dim_) throw npstat::NpstatInvalidArgument(
5342  "npstat::ArrayND::cdfValue method "
5343  "can not be used with array of 0 rank");
5344  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
5345  "In npstat::ArrayND::cdfValue: incompatible index length");
5346  for (unsigned i=0; i<indexLen; ++i)
5347  if (index[i] >= shape_[i])
5349  "In npstat::ArrayND::cdfValue: index out of range");
5350  return sumBelowLoop<Accumulator>(0, 0U, index);
5351  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned dim_
Definition: ArrayND.h:1058
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 1458 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, hfnoseSimHitStudy_cfi::rMax, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1466  {
1467  const unsigned imax = range[level];
1468  const unsigned leftShift = thisCorner[level];
1469  const unsigned leftPeriod = shape_[level];
1470 
1471  if (level == dim_ - 1)
1472  {
1473  Numeric* left = data_ + idx0;
1474  Num2* right = r.data_ + (idx1 + otherCorner[level]);
1475  Num2* const rMax = r.data_ + (idx1 + r.shape_[level]);
1476 
1477  for (unsigned i=0; i<imax && right<rMax; ++i)
1478  binaryFunct(left[(i+leftShift)%leftPeriod], *right++);
1479  }
1480  else
1481  {
1482  const unsigned long leftStride = strides_[level];
1483  const unsigned long rightStride = r.strides_[level];
1484  const unsigned long rightMax = idx1 + r.shape_[level]*rightStride;
1485  idx1 += otherCorner[level]*rightStride;
1486 
1487  for (unsigned i=0; i<imax && idx1<rightMax; ++i, idx1+=rightStride)
1489  level+1, idx0+((i+leftShift)%leftPeriod)*leftStride,
1490  idx1, thisCorner, range, otherCorner, r, binaryFunct);
1491  }
1492  }
unsigned * shape_
Definition: ArrayND.h:1055
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:1458
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::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

Definition at line 1497 of file ArrayND.h.

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

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 5843 of file ArrayND.h.

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

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

5844  {
5846  "Initialize npstat::ArrayND before calling method \"cl\"");
5848  "In npstat::ArrayND::cl: wrong # of args (not rank 0 array)");
5849  return localData_[0];
5850  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( ) const
inline

Definition at line 5653 of file ArrayND.h.

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

5654  {
5656  "Initialize npstat::ArrayND before calling method \"cl\"");
5658  "In npstat::ArrayND::cl: wrong # of args (not rank 0 array)");
5659  return localData_[0];
5660  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0)
inline

Definition at line 5853 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, and mitigatedMETSequence_cff::U.

5855  {
5856  if (1U != dim_) throw npstat::NpstatInvalidArgument(
5857  "In npstat::ArrayND::cl: wrong # of args (not rank 1 array)");
5858  return data_[coordToIndex(i0, 0)];
5859  }
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0) const
inline

Definition at line 5663 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, and mitigatedMETSequence_cff::U.

5665  {
5666  if (1U != dim_) throw npstat::NpstatInvalidArgument(
5667  "In npstat::ArrayND::cl: wrong # of args (not rank 1 array)");
5668  return data_[coordToIndex(i0, 0)];
5669  }
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1 
)
inline

Definition at line 5862 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5865  {
5866  if (2U != dim_) throw npstat::NpstatInvalidArgument(
5867  "In npstat::ArrayND::cl: wrong # of args (not rank 2 array)");
5868  return data_[coordToIndex(i0, 0)*strides_[0] +
5869  coordToIndex(i1, 1)];
5870  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1 
) const
inline

Definition at line 5672 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5675  {
5676  if (2U != dim_) throw npstat::NpstatInvalidArgument(
5677  "In npstat::ArrayND::cl: wrong # of args (not rank 2 array)");
5678  return data_[coordToIndex(i0, 0)*strides_[0] +
5679  coordToIndex(i1, 1)];
5680  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::cl ( double  x0,
double  x1,
double  x2 
)
inline

Definition at line 5873 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5877  {
5878  if (3U != dim_) throw npstat::NpstatInvalidArgument(
5879  "In npstat::ArrayND::cl: wrong # of args (not rank 3 array)");
5880  return data_[coordToIndex(i0, 0)*strides_[0] +
5881  coordToIndex(i1, 1)*strides_[1] +
5882  coordToIndex(i2, 2)];
5883  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5683 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5687  {
5688  if (3U != dim_) throw npstat::NpstatInvalidArgument(
5689  "In npstat::ArrayND::cl: wrong # of args (not rank 3 array)");
5690  return data_[coordToIndex(i0, 0)*strides_[0] +
5691  coordToIndex(i1, 1)*strides_[1] +
5692  coordToIndex(i2, 2)];
5693  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5886 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5891  {
5892  if (4U != dim_) throw npstat::NpstatInvalidArgument(
5893  "In npstat::ArrayND::cl: wrong # of args (not rank 4 array)");
5894  return data_[coordToIndex(i0, 0)*strides_[0] +
5895  coordToIndex(i1, 1)*strides_[1] +
5896  coordToIndex(i2, 2)*strides_[2] +
5897  coordToIndex(i3, 3)];
5898  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5696 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5701  {
5702  if (4U != dim_) throw npstat::NpstatInvalidArgument(
5703  "In npstat::ArrayND::cl: wrong # of args (not rank 4 array)");
5704  return data_[coordToIndex(i0, 0)*strides_[0] +
5705  coordToIndex(i1, 1)*strides_[1] +
5706  coordToIndex(i2, 2)*strides_[2] +
5707  coordToIndex(i3, 3)];
5708  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5901 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5907  {
5908  if (5U != dim_) throw npstat::NpstatInvalidArgument(
5909  "In npstat::ArrayND::cl: wrong # of args (not rank 5 array)");
5910  return data_[coordToIndex(i0, 0)*strides_[0] +
5911  coordToIndex(i1, 1)*strides_[1] +
5912  coordToIndex(i2, 2)*strides_[2] +
5913  coordToIndex(i3, 3)*strides_[3] +
5914  coordToIndex(i4, 4)];
5915  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5711 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5717  {
5718  if (5U != dim_) throw npstat::NpstatInvalidArgument(
5719  "In npstat::ArrayND::cl: wrong # of args (not rank 5 array)");
5720  return data_[coordToIndex(i0, 0)*strides_[0] +
5721  coordToIndex(i1, 1)*strides_[1] +
5722  coordToIndex(i2, 2)*strides_[2] +
5723  coordToIndex(i3, 3)*strides_[3] +
5724  coordToIndex(i4, 4)];
5725  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5918 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5925  {
5926  if (6U != dim_) throw npstat::NpstatInvalidArgument(
5927  "In npstat::ArrayND::cl: wrong # of args (not rank 6 array)");
5928  return data_[coordToIndex(i0, 0)*strides_[0] +
5929  coordToIndex(i1, 1)*strides_[1] +
5930  coordToIndex(i2, 2)*strides_[2] +
5931  coordToIndex(i3, 3)*strides_[3] +
5932  coordToIndex(i4, 4)*strides_[4] +
5933  coordToIndex(i5, 5)];
5934  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5728 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5735  {
5736  if (6U != dim_) throw npstat::NpstatInvalidArgument(
5737  "In npstat::ArrayND::cl: wrong # of args (not rank 6 array)");
5738  return data_[coordToIndex(i0, 0)*strides_[0] +
5739  coordToIndex(i1, 1)*strides_[1] +
5740  coordToIndex(i2, 2)*strides_[2] +
5741  coordToIndex(i3, 3)*strides_[3] +
5742  coordToIndex(i4, 4)*strides_[4] +
5743  coordToIndex(i5, 5)];
5744  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5937 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5945  {
5946  if (7U != dim_) throw npstat::NpstatInvalidArgument(
5947  "In npstat::ArrayND::cl: wrong # of args (not rank 7 array)");
5948  return data_[coordToIndex(i0, 0)*strides_[0] +
5949  coordToIndex(i1, 1)*strides_[1] +
5950  coordToIndex(i2, 2)*strides_[2] +
5951  coordToIndex(i3, 3)*strides_[3] +
5952  coordToIndex(i4, 4)*strides_[4] +
5953  coordToIndex(i5, 5)*strides_[5] +
5954  coordToIndex(i6, 6)];
5955  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5747 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5755  {
5756  if (7U != dim_) throw npstat::NpstatInvalidArgument(
5757  "In npstat::ArrayND::cl: wrong # of args (not rank 7 array)");
5758  return data_[coordToIndex(i0, 0)*strides_[0] +
5759  coordToIndex(i1, 1)*strides_[1] +
5760  coordToIndex(i2, 2)*strides_[2] +
5761  coordToIndex(i3, 3)*strides_[3] +
5762  coordToIndex(i4, 4)*strides_[4] +
5763  coordToIndex(i5, 5)*strides_[5] +
5764  coordToIndex(i6, 6)];
5765  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5958 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5967  {
5968  if (8U != dim_) throw npstat::NpstatInvalidArgument(
5969  "In npstat::ArrayND::cl: wrong # of args (not rank 8 array)");
5970  return data_[coordToIndex(i0, 0)*strides_[0] +
5971  coordToIndex(i1, 1)*strides_[1] +
5972  coordToIndex(i2, 2)*strides_[2] +
5973  coordToIndex(i3, 3)*strides_[3] +
5974  coordToIndex(i4, 4)*strides_[4] +
5975  coordToIndex(i5, 5)*strides_[5] +
5976  coordToIndex(i6, 6)*strides_[6] +
5977  coordToIndex(i7, 7)];
5978  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5768 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5777  {
5778  if (8U != dim_) throw npstat::NpstatInvalidArgument(
5779  "In npstat::ArrayND::cl: wrong # of args (not rank 8 array)");
5780  return data_[coordToIndex(i0, 0)*strides_[0] +
5781  coordToIndex(i1, 1)*strides_[1] +
5782  coordToIndex(i2, 2)*strides_[2] +
5783  coordToIndex(i3, 3)*strides_[3] +
5784  coordToIndex(i4, 4)*strides_[4] +
5785  coordToIndex(i5, 5)*strides_[5] +
5786  coordToIndex(i6, 6)*strides_[6] +
5787  coordToIndex(i7, 7)];
5788  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5981 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5991  {
5992  if (9U != dim_) throw npstat::NpstatInvalidArgument(
5993  "In npstat::ArrayND::cl: wrong # of args (not rank 9 array)");
5994  return data_[coordToIndex(i0, 0)*strides_[0] +
5995  coordToIndex(i1, 1)*strides_[1] +
5996  coordToIndex(i2, 2)*strides_[2] +
5997  coordToIndex(i3, 3)*strides_[3] +
5998  coordToIndex(i4, 4)*strides_[4] +
5999  coordToIndex(i5, 5)*strides_[5] +
6000  coordToIndex(i6, 6)*strides_[6] +
6001  coordToIndex(i7, 7)*strides_[7] +
6002  coordToIndex(i8, 8)];
6003  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5791 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5801  {
5802  if (9U != dim_) throw npstat::NpstatInvalidArgument(
5803  "In npstat::ArrayND::cl: wrong # of args (not rank 9 array)");
5804  return data_[coordToIndex(i0, 0)*strides_[0] +
5805  coordToIndex(i1, 1)*strides_[1] +
5806  coordToIndex(i2, 2)*strides_[2] +
5807  coordToIndex(i3, 3)*strides_[3] +
5808  coordToIndex(i4, 4)*strides_[4] +
5809  coordToIndex(i5, 5)*strides_[5] +
5810  coordToIndex(i6, 6)*strides_[6] +
5811  coordToIndex(i7, 7)*strides_[7] +
5812  coordToIndex(i8, 8)];
5813  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 6006 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

6017  {
6018  if (10U != dim_) throw npstat::NpstatInvalidArgument(
6019  "In npstat::ArrayND::cl: wrong # of args (not rank 10 array)");
6020  return data_[coordToIndex(i0, 0)*strides_[0] +
6021  coordToIndex(i1, 1)*strides_[1] +
6022  coordToIndex(i2, 2)*strides_[2] +
6023  coordToIndex(i3, 3)*strides_[3] +
6024  coordToIndex(i4, 4)*strides_[4] +
6025  coordToIndex(i5, 5)*strides_[5] +
6026  coordToIndex(i6, 6)*strides_[6] +
6027  coordToIndex(i7, 7)*strides_[7] +
6028  coordToIndex(i8, 8)*strides_[8] +
6029  coordToIndex(i9, 9)];
6030  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5816 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5827  {
5828  if (10U != dim_) throw npstat::NpstatInvalidArgument(
5829  "In npstat::ArrayND::cl: wrong # of args (not rank 10 array)");
5830  return data_[coordToIndex(i0, 0)*strides_[0] +
5831  coordToIndex(i1, 1)*strides_[1] +
5832  coordToIndex(i2, 2)*strides_[2] +
5833  coordToIndex(i3, 3)*strides_[3] +
5834  coordToIndex(i4, 4)*strides_[4] +
5835  coordToIndex(i5, 5)*strides_[5] +
5836  coordToIndex(i6, 6)*strides_[6] +
5837  coordToIndex(i7, 7)*strides_[7] +
5838  coordToIndex(i8, 8)*strides_[8] +
5839  coordToIndex(i9, 9)];
5840  }
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1039 of file ArrayND.h.

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

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

Definition at line 6033 of file ArrayND.h.

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

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

6034  {
6035  static const std::string name(
6036  gs::template_class_name<Numeric>("npstat::ArrayND"));
6037  return name.c_str();
6038  }
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 4777 of file ArrayND.h.

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

Referenced by npstat::HistoND< Numeric, Axis >::clearBinContents(), npstat::HistoND< Numeric, Axis >::clearOverflows(), and npstat::ArrayND< Num1, Len1, Dim1 >::strides().

4778  {
4779  return constFill(Numeric());
4780  }
ArrayND & constFill(Numeric c)
Definition: ArrayND.h:4766
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 3387 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

3389  {
3391  "Initialize npstat::ArrayND before calling method \"closest\"");
3392  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3393  "In npstat::ArrayND::closest: incompatible data length");
3394  if (dim)
3395  {
3396  assert(x);
3397  unsigned long idx = 0UL;
3398  for (unsigned i=0; i<dim_; ++i)
3399  idx += coordToIndex(x[i], i)*strides_[i];
3400  return data_[idx];
3401  }
3402  else
3403  return localData_[0];
3404  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3367 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

3369  {
3371  "Initialize npstat::ArrayND before calling method \"closest\"");
3372  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3373  "In npstat::ArrayND::closest: incompatible data length");
3374  if (dim)
3375  {
3376  assert(x);
3377  unsigned long idx = 0UL;
3378  for (unsigned i=0; i<dim_; ++i)
3379  idx += coordToIndex(x[i], i)*strides_[i];
3380  return data_[idx];
3381  }
3382  else
3383  return localData_[0];
3384  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned coordToIndex(double coord, unsigned idim) const
Definition: ArrayND.h:3355
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1343 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, hfnoseSimHitStudy_cfi::rMax, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

1351  {
1352  const unsigned imax = range[level];
1353 
1354  if (level == dim_ - 1)
1355  {
1356  Numeric* left = data_ + (idx0 + thisCorner[level]);
1357  Numeric* const lMax = data_ + (idx0 + shape_[level]);
1358  Num2* right = r.data_ + (idx1 + otherCorner[level]);
1359  Num2* const rMax = r.data_ + (idx1 + r.shape_[level]);
1360 
1361  for (unsigned i=0; i<imax && left<lMax && right<rMax; ++i)
1362  binaryFunct(*left++, *right++);
1363  }
1364  else
1365  {
1366  const unsigned long leftStride = strides_[level];
1367  const unsigned long leftMax = idx0 + shape_[level]*leftStride;
1368  idx0 += thisCorner[level]*leftStride;
1369  const unsigned long rightStride = r.strides_[level];
1370  const unsigned long rightMax = idx1 + r.shape_[level]*rightStride;
1371  idx1 += otherCorner[level]*rightStride;
1372 
1373  for (unsigned i=0; i<imax && idx0 < leftMax && idx1 < rightMax;
1374  ++i, idx0 += leftStride, idx1 += rightStride)
1375  commonSubrangeLoop(level+1, idx0, idx1, thisCorner, range,
1376  otherCorner, r, binaryFunct);
1377  }
1378  }
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:1343
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric, unsigned Len, unsigned Dim>
ArrayND< Numeric, Len, Dim > & npstat::ArrayND< Numeric, Len, Dim >::constFill ( Numeric  c)
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 5059 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::makeBuffer(), mps_fire::result, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and npstat::ArrayND< Numeric, StackLen, StackDim >::sum().

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

5061  {
5063  "Initialize npstat::ArrayND before calling method \"contract\"");
5064  if (!(pos1 < dim_ && pos2 < dim_ && pos1 != pos2))
5065  throw npstat::NpstatInvalidArgument("In npstat::ArrayND::contract: "
5066  "incompatible contraction indices");
5067  if (shape_[pos1] != shape_[pos2])
5069  "In npstat::ArrayND::contract: incompatible "
5070  "length of contracted dimensions");
5071 
5072  // Construct the new shape
5073  unsigned newshapeBuf[Dim];
5074  unsigned* newshape = makeBuffer(dim_ - 2, newshapeBuf, Dim);
5075  unsigned ishap = 0;
5076  for (unsigned i=0; i<dim_; ++i)
5077  if (i != pos1 && i != pos2)
5078  newshape[ishap++] = shape_[i];
5079 
5080  // Form the result array
5081  ArrayND<Numeric,Len,Dim> result(newshape, ishap);
5082  if (ishap)
5083  contractLoop(0, 0, pos1, pos2, 0UL, 0UL, result);
5084  else
5085  {
5086  // We are just calculating the trace
5087  Numeric sum = Numeric();
5088  const unsigned imax = shape_[0];
5089  const unsigned long stride = strides_[0] + strides_[1];
5090  for (unsigned i=0; i<imax; ++i)
5091  sum += data_[i*stride];
5092  result() = sum;
5093  }
5094 
5095  destroyBuffer(newshape, newshapeBuf);
5096  return result;
5097  }
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
void contractLoop(unsigned thisLevel, unsigned resLevel, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:5021
unsigned long * strides_
Definition: ArrayND.h:1052
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 5021 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), and tmp.

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

5025  {
5026  while (thisLevel == pos1 || thisLevel == pos2)
5027  ++thisLevel;
5028  assert(thisLevel < dim_);
5029 
5030  if (resLevel == result.dim_ - 1)
5031  {
5032  const unsigned ncontract = shape_[pos1];
5033  const unsigned imax = result.shape_[resLevel];
5034  const unsigned long stride = strides_[pos1] + strides_[pos2];
5035  for (unsigned i=0; i<imax; ++i)
5036  {
5037  const Numeric* tmp = data_ + (idxThis + i*strides_[thisLevel]);
5038  Numeric sum = Numeric();
5039  for (unsigned j=0; j<ncontract; ++j)
5040  sum += tmp[j*stride];
5041  result.data_[idxRes + i] = sum;
5042  }
5043  }
5044  else
5045  {
5046  const unsigned imax = result.shape_[resLevel];
5047  assert(imax == shape_[thisLevel]);
5048  for (unsigned i=0; i<imax; ++i)
5049  {
5050  contractLoop(thisLevel+1, resLevel+1, pos1, pos2,
5051  idxThis, idxRes, result);
5052  idxThis += strides_[thisLevel];
5053  idxRes += result.strides_[resLevel];
5054  }
5055  }
5056  }
unsigned * shape_
Definition: ArrayND.h:1055
void contractLoop(unsigned thisLevel, unsigned resLevel, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:5021
unsigned long * strides_
Definition: ArrayND.h:1052
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3234 of file ArrayND.h.

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

Referenced by npstat::HistoND< Numeric, Axis >::allBinCenters(), npstat::HistoND< Numeric, Axis >::binBox(), npstat::HistoND< Numeric, Axis >::binCenter(), npstat::HistoND< Numeric, Axis >::binVolume(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::derivative(), npstat::LinInterpolatedTableND< Numeric, Axis >::getCoords(), npstat::HistoND< Numeric, Axis >::HistoND(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), and npstat::ArrayND< Numeric, StackLen, StackDim >::min().

3236  {
3238  "Initialize npstat::ArrayND before calling "
3239  "method \"convertLinearIndex\"");
3240  if (!dim_) throw npstat::NpstatInvalidArgument(
3241  "npstat::ArrayND::convertLinearIndex method "
3242  "can not be used with array of 0 rank");
3243  if (idxLen != dim_) throw npstat::NpstatInvalidArgument(
3244  "In npstat::ArrayND::convertLinearIndex: incompatible index length");
3245  if (l >= len_) throw npstat::NpstatOutOfRange(
3246  "In npstat::ArrayND::convertLinearIndex: linear index out of range");
3247  assert(idx);
3248 
3249  for (unsigned i=0; i<dim_; ++i)
3250  {
3251  idx[i] = l / strides_[i];
3252  l -= (idx[i] * strides_[i]);
3253  }
3254  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
unsigned dim_
Definition: ArrayND.h:1058
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 4949 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

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

4951  {
4953  "Initialize npstat::ArrayND before calling "
4954  "method \"convertToLastDimCdf\"");
4955  if (!dim_) throw npstat::NpstatInvalidArgument(
4956  "npstat::ArrayND::convertToLastDimCdf method "
4957  "can not be used with array of 0 rank");
4958  assert(sumSlice);
4959  if (!sumSlice->shapeIsKnown_) throw npstat::NpstatInvalidArgument(
4960  "In npstat::ArrayND::convertToLastDimCdf: "
4961  "uninitialized argument array");
4962  convertToLastDimCdfLoop<Accumulator>(sumSlice, 0U, 0UL, 0UL,
4963  useTrapezoids);
4964  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned dim_
Definition: ArrayND.h:1058
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 4899 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

4902  {
4903  static const proper_double half = 0.5;
4904  const unsigned imax = shape_[level];
4905  if (level == dim_ - 1)
4906  {
4907  Accumulator acc = Accumulator();
4908  Numeric* data = data_ + idx0;
4909  if (useTrapezoids)
4910  {
4911  Numeric oldval = Numeric();
4912  for (unsigned i = 0; i<imax; ++i)
4913  {
4914  acc += (data[i] + oldval)*half;
4915  oldval = data[i];
4916  data[i] = static_cast<Numeric>(acc);
4917  }
4918  acc += oldval*half;
4919  }
4920  else
4921  for (unsigned i = 0; i<imax; ++i)
4922  {
4923  acc += data[i];
4924  data[i] = static_cast<Numeric>(acc);
4925  }
4926  if (sumSlice->dim_)
4927  sumSlice->data_[idxSlice] = static_cast<Numeric>(acc);
4928  else
4929  sumSlice->localData_[0] = static_cast<Numeric>(acc);
4930  }
4931  else
4932  {
4933  const unsigned long stride = strides_[level];
4934  unsigned long sumStride = 0UL;
4935  if (sumSlice->dim_)
4936  sumStride = sumSlice->strides_[level];
4937  for (unsigned i = 0; i<imax; ++i)
4938  {
4939  convertToLastDimCdfLoop<Accumulator>(
4940  sumSlice, level+1, idx0, idxSlice, useTrapezoids);
4941  idx0 += stride;
4942  idxSlice += sumStride;
4943  }
4944  }
4945  }
unsigned * shape_
Definition: ArrayND.h:1055
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long * strides_
Definition: ArrayND.h:1052
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::coordToIndex ( double  coord,
unsigned  idim 
) const
inlineprivate

Definition at line 3355 of file ArrayND.h.

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

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

3357  {
3358  if (x <= 0.0)
3359  return 0;
3360  else if (x >= static_cast<double>(shape_[idim] - 1))
3361  return shape_[idim] - 1;
3362  else
3363  return static_cast<unsigned>(std::floor(x + 0.5));
3364  }
unsigned * shape_
Definition: ArrayND.h:1055
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 2665 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

2670  {
2671  const unsigned imax = shape_[level];
2672  if (level == dim_ - 1)
2673  {
2674  Numeric* to = data_ + idx0;
2675  const Num2* from = r.data_ + (idx1 + range[level].min());
2676  for (unsigned i=0; i<imax; ++i)
2677  *to++ = static_cast<Numeric>(f(*from++));
2678  }
2679  else
2680  {
2681  const unsigned long fromstride = r.strides_[level];
2682  const unsigned long tostride = strides_[level];
2683  idx1 += range[level].min()*fromstride;
2684  for (unsigned i=0; i<imax; ++i)
2685  {
2686  copyRangeLoopFunct(level+1, idx0, idx1, r, range, f);
2687  idx0 += tostride;
2688  idx1 += fromstride;
2689  }
2690  }
2691  }
unsigned * shape_
Definition: ArrayND.h:1055
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1052
void copyRangeLoopFunct(unsigned level, unsigned long idx0, unsigned long idx1, const ArrayND< Num2, Len2, Dim2 > &r, const ArrayRange &range, Functor f)
Definition: ArrayND.h:2665
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 5253 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::length(), mps_fire::result, Scenarios_cff::scale, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5255  {
5257  "Initialize npstat::ArrayND before calling method \"derivative\"");
5258  if (!dim_) throw npstat::NpstatInvalidArgument(
5259  "npstat::ArrayND::derivative method "
5260  "can not be used with array of 0 rank");
5261 
5262  const typename ProperDblFromCmpl<Accumulator>::type scale = inscale;
5263  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
5264  if (dim_ >= maxdim) throw npstat::NpstatInvalidArgument(
5265  "In npstat::ArrayND::derivative: array rank is too large");
5266  const unsigned long maxcycle = 1UL << dim_;
5267 
5268  ArrayShape sh;
5269  sh.reserve(dim_);
5270  for (unsigned i=0; i<dim_; ++i)
5271  {
5272  if (shape_[i] <= 1U)
5274  "In npstat::ArrayND::derivative: in some dimendions "
5275  "array size is too small");
5276  sh.push_back(shape_[i] - 1U);
5277  }
5278 
5279  ArrayND result(sh);
5280  const unsigned long rLen = result.length();
5281  for (unsigned long ilin=0; ilin<rLen; ++ilin)
5282  {
5283  result.convertLinearIndex(ilin, &sh[0], dim_);
5284 
5285  Accumulator deriv = Accumulator();
5286  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5287  {
5288  unsigned long icell = 0UL;
5289  unsigned n1 = 0U;
5290  for (unsigned i=0; i<dim_; ++i)
5291  {
5292  if (icycle & (1UL << i))
5293  {
5294  ++n1;
5295  icell += strides_[i]*(sh[i] + 1);
5296  }
5297  else
5298  icell += strides_[i]*sh[i];
5299  }
5300  if ((dim_ - n1) % 2U)
5301  deriv -= data_[icell];
5302  else
5303  deriv += data_[icell];
5304  }
5305  result.data_[ilin] = static_cast<Numeric>(deriv*scale);
5306  }
5307 
5308  return result;
5309  }
unsigned * shape_
Definition: ArrayND.h:1055
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 5583 of file ArrayND.h.

References npstat::copyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::dotProductLoop(), mps_fire::i, npstat::makeBuffer(), mps_fire::result, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), and mitigatedMETSequence_cff::U.

5585  {
5586  if (!dim_) throw npstat::NpstatInvalidArgument(
5587  "npstat::ArrayND::dot method "
5588  "can not be used with array of 0 rank");
5589  if (!r.dim_) throw npstat::NpstatInvalidArgument(
5590  "npstat::ArrayND::dot method "
5591  "can not be used with argument array of 0 rank");
5592  if (shape_[dim_ - 1] != r.shape_[0]) throw npstat::NpstatInvalidArgument(
5593  "In npstat::ArrayND::dot: incompatible argument array shape");
5594 
5595  if (dim_ == 1 && r.dim_ == 1)
5596  {
5597  // Special case: the result is of 0 rank
5598  ArrayND<Numeric,Len,Dim> result(static_cast<unsigned*>(nullptr), 0U);
5599  Numeric sum = Numeric();
5600  const unsigned imax = shape_[0];
5601  for (unsigned i=0; i<imax; ++i)
5602  sum += data_[i]*r.data_[i];
5603  result() = sum;
5604  return result;
5605  }
5606  else
5607  {
5608  unsigned newshapeBuf[2*Dim];
5609  unsigned *newshape = makeBuffer(dim_+r.dim_-2, newshapeBuf, 2*Dim);
5610  copyBuffer(newshape, shape_, dim_-1);
5611  copyBuffer(newshape+(dim_-1), r.shape_+1, r.dim_-1);
5612  ArrayND<Numeric,Len,Dim> result(newshape, dim_+r.dim_-2);
5613 
5614  dotProductLoop(0U, 0UL, 0UL, 0UL, r, result);
5615 
5616  destroyBuffer(newshape, newshapeBuf);
5617  return result;
5618  }
5619  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
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:5546
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 5546 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, checklumidiff::l, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and npstat::ArrayND< Numeric, StackLen, StackDim >::sum().

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

5551  {
5552  // idx0 -- this object
5553  // idx1 -- dot product argument
5554  // idx2 -- result
5555  if (level == result.dim_)
5556  {
5557  Numeric sum = Numeric();
5558  const unsigned imax = r.shape_[0];
5559  const unsigned rstride = r.strides_[0];
5560  const Numeric* l = data_ + idx0;
5561  const Num2* ri = r.data_ + idx1;
5562  for (unsigned i=0; i<imax; ++i)
5563  sum += l[i]*ri[i*rstride];
5564  result.data_[idx2] = sum;
5565  }
5566  else
5567  {
5568  const unsigned imax = result.shape_[level];
5569  for (unsigned i=0; i<imax; ++i)
5570  {
5571  dotProductLoop(level+1, idx0, idx1, idx2, r, result);
5572  idx2 += result.strides_[level];
5573  if (level < dim_ - 1)
5574  idx0 += strides_[level];
5575  else
5576  idx1 += r.strides_[level + 2 - dim_];
5577  }
5578  }
5579  }
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:5546
unsigned long * strides_
Definition: ArrayND.h:1052
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1382 of file ArrayND.h.

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

1390  {
1391  const unsigned imax = range[level];
1392  const unsigned leftShift = thisCorner[level];
1393  const unsigned leftPeriod = shape_[level];
1394  const unsigned rightShift = otherCorner[level];
1395  const unsigned rightPeriod = r.shape_[level];
1396 
1397  if (level == dim_ - 1)
1398  {
1399  Numeric* left = data_ + idx0;
1400  Num2* right = r.data_ + idx1;
1401  for (unsigned i=0; i<imax; ++i)
1402  binaryFunct(left[(i+leftShift)%leftPeriod],
1403  right[(i+rightShift)%rightPeriod]);
1404  }
1405  else
1406  {
1407  const unsigned long leftStride = strides_[level];
1408  const unsigned long rightStride = r.strides_[level];
1409  for (unsigned i=0; i<imax; ++i)
1411  level+1, idx0+((i+leftShift)%leftPeriod)*leftStride,
1412  idx1+((i+rightShift)%rightPeriod)*rightStride,
1413  thisCorner, range, otherCorner, r, binaryFunct);
1414  }
1415  }
unsigned * shape_
Definition: ArrayND.h:1055
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:1382
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::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)

Definition at line 1495 of file ArrayND.h.

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

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

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

Definition at line 716 of file ArrayND.h.

720  {
721  (const_cast<ArrayND*>(this))->jointMemSliceScan(
722  buffer, bufLen, fixedIndices, fixedIndexValues,
723  nFixedIndices, scast_assign_right<Numeric,Num2>());
724  }
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 700 of file ArrayND.h.

Referenced by npstat::LinInterpolatedTableND< Numeric, Axis >::invertRatioResponse(), and npstat::LinInterpolatedTableND< Numeric, Axis >::invertWRTAxis().

704  {
705  assert(slice);
706  (const_cast<ArrayND*>(this))->jointSliceScan(
707  *slice, fixedIndices, fixedIndexValues, nFixedIndices,
708  scast_assign_right<Numeric,Num2>());
709  }
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 6089 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_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

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

6092  {
6094  "Initialize npstat::ArrayND before calling method \"exportSubrange\"");
6095  if (dim_ != lenCorner) throw npstat::NpstatInvalidArgument(
6096  "In npstat::ArrayND::exportSubrange: incompatible corner index length");
6097  assert(out);
6098  if (!out->shapeIsKnown_) throw npstat::NpstatInvalidArgument(
6099  "In npstat::ArrayND::exportSubrange: uninitialized argument array");
6100  if (out->dim_ != dim_) throw npstat::NpstatInvalidArgument(
6101  "In npstat::ArrayND::exportSubrange: incompatible argument array rank");
6102 
6103  if (dim_)
6104  {
6105  assert(corner);
6106  if (dim_ > CHAR_BIT*sizeof(unsigned long))
6108  "In npstat::ArrayND::exportSubrange: "
6109  "array rank is too large");
6110  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
6111  clearBuffer(toBuf, dim_);
6112  (const_cast<ArrayND*>(this))->commonSubrangeLoop(
6113  0U, 0UL, 0UL, corner, out->shape_, toBuf, *out,
6114  scast_assign_right<Numeric,Num2>());
6115  }
6116  else
6117  out->localData_[0] = static_cast<Num2>(localData_[0]);
6118  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:100
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
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 1419 of file ArrayND.h.

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

1427  {
1428  const unsigned imax = range[level];
1429  const unsigned rightShift = otherCorner[level];
1430  const unsigned rightPeriod = r.shape_[level];
1431 
1432  if (level == dim_ - 1)
1433  {
1434  Numeric* left = data_ + (idx0 + thisCorner[level]);
1435  Numeric* const lMax = data_ + (idx0 + shape_[level]);
1436  Num2* right = r.data_ + idx1;
1437 
1438  for (unsigned i=0; i<imax && left<lMax; ++i)
1439  binaryFunct(*left++, right[(i+rightShift)%rightPeriod]);
1440  }
1441  else
1442  {
1443  const unsigned long leftStride = strides_[level];
1444  const unsigned long leftMax = idx0 + shape_[level]*leftStride;
1445  idx0 += thisCorner[level]*leftStride;
1446  const unsigned long rightStride = r.strides_[level];
1447 
1448  for (unsigned i=0; i<imax && idx0 < leftMax; ++i, idx0+=leftStride)
1450  level+1, idx0,
1451  idx1+((i+rightShift)%rightPeriod)*rightStride,
1452  thisCorner, range, otherCorner, r, binaryFunct);
1453  }
1454  }
unsigned * shape_
Definition: ArrayND.h:1055
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:1419
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::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

Definition at line 1496 of file ArrayND.h.

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

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

Get the complete range

Definition at line 3173 of file ArrayND.h.

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

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

3174  {
3176  "Initialize npstat::ArrayND before calling method \"fullRange\"");
3177  ArrayRange range;
3178  if (dim_)
3179  {
3180  range.reserve(dim_);
3181  for (unsigned i=0; i<dim_; ++i)
3182  range.push_back(Interval<unsigned>(0U, shape_[i]));
3183  }
3184  return range;
3185  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned dim_
Definition: ArrayND.h:1058
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(), and npstat::ArrayND< Num1, Len1, Dim1 >::strides().

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 4968 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, npstat::ArrayND< Numeric, StackLen, StackDim >::functorFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

4969  {
4971  "Initialize npstat::ArrayND before calling method \"functorFill\"");
4972  if (dim_)
4973  {
4974  unsigned localIndex[Dim];
4975  unsigned* index = makeBuffer(dim_, localIndex, Dim);
4976  functorFillLoop(0U, 0UL, f, index);
4977  destroyBuffer(index, localIndex);
4978  }
4979  else
4980  localData_[0] = static_cast<Numeric>(
4981  f(static_cast<unsigned*>(nullptr), 0U));
4982  return *this;
4983  }
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:4871
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 4871 of file ArrayND.h.

References edmIntegrityCheck::d, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, f, callgraph::farg, mps_fire::i, training_settings::idx, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

4874  {
4875  const unsigned imax = shape_[level];
4876  if (level == dim_ - 1)
4877  {
4878  Numeric* d = &data_[idx];
4879  const unsigned* myarg = farg;
4880  for (unsigned i = 0; i<imax; ++i)
4881  {
4882  farg[level] = i;
4883  d[i] = static_cast<Numeric>(f(myarg, dim_));
4884  }
4885  }
4886  else
4887  {
4888  const unsigned long stride = strides_[level];
4889  for (unsigned i = 0; i<imax; ++i)
4890  {
4891  farg[level] = i;
4892  functorFillLoop(level+1, idx + i*stride, f, farg);
4893  }
4894  }
4895  }
unsigned * shape_
Definition: ArrayND.h:1055
void functorFillLoop(unsigned level, unsigned long idx, Functor f, unsigned *farg)
Definition: ArrayND.h:4871
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 >
void npstat::ArrayND< Numeric, StackLen, StackDim >::importMemSlice ( const Num2 *  buffer,
unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices 
)
inline

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

Definition at line 743 of file ArrayND.h.

747  {
748  jointMemSliceScan(const_cast<Num2*>(buffer), bufLen,
749  fixedIndices, fixedIndexValues, nFixedIndices,
750  scast_assign_left<Numeric,Num2>());
751  }
void jointMemSliceScan(Num2 *buffer, unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:1982
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 728 of file ArrayND.h.

732  {
733  jointSliceScan(const_cast<ArrayND<Num2,Len2,Dim2>&>(slice),
734  fixedIndices, fixedIndexValues, nFixedIndices,
735  scast_assign_left<Numeric,Num2>());
736  }
void jointSliceScan(ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:1963
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 6122 of file ArrayND.h.

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

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

6125  {
6127  "Initialize npstat::ArrayND before calling method \"importSubrange\"");
6128  if (dim_ != lenCorner) throw npstat::NpstatInvalidArgument(
6129  "In npstat::ArrayND::importSubrange: incompatible corner index length");
6130  if (!from.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
6131  "In npstat::ArrayND::importSubrange: uninitialized argument array");
6132  if (from.dim_ != dim_) throw npstat::NpstatInvalidArgument(
6133  "In npstat::ArrayND::importSubrange: incompatible argument array rank");
6134 
6135  if (dim_)
6136  {
6137  assert(corner);
6138  if (dim_ > CHAR_BIT*sizeof(unsigned long))
6140  "In npstat::ArrayND::importSubrange: "
6141  "array rank is too large");
6142  unsigned toBuf[CHAR_BIT*sizeof(unsigned long)];
6143  clearBuffer(toBuf, dim_);
6144  commonSubrangeLoop(0U, 0UL, 0UL, corner, from.shape_, toBuf,
6145  const_cast<ArrayND<Num2, Len2, Dim2>&>(from),
6146  scast_assign_left<Numeric,Num2>());
6147  }
6148  else
6149  localData_[0] = static_cast<Numeric>(from.localData_[0]);
6150  }
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:1343
bool shapeIsKnown_
Definition: ArrayND.h:1060
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:100
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
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:2403
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 4610 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, PVValHelper::dx, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), mitigatedMETSequence_cff::U, and w.

Referenced by npstat::Private::ArrayMapper< Num1, Len1, Dim1, Num2, Len2, Dim2 >::operator()(), npstat::LinInterpolatedTableND< Numeric, Axis >::operator()(), and npstat::ArrayND< Num1, Len1, Dim1 >::strides().

4612  {
4614  "Initialize npstat::ArrayND before calling method \"interpolate1\"");
4615  if (dim != dim_) throw npstat::NpstatInvalidArgument(
4616  "In npstat::ArrayND::interpolate1: incompatible coordinate length");
4617  if (dim)
4618  {
4619  const unsigned maxdim = CHAR_BIT*sizeof(unsigned long);
4620  if (dim_ >= maxdim)
4622  "In npstat::ArrayND::interpolate1: array rank is too large");
4623 
4624  double dx[maxdim];
4625  unsigned ix[maxdim];
4626  for (unsigned i=0; i<dim; ++i)
4627  {
4628  const double x = coords[i];
4629  if (x <= 0.0)
4630  {
4631  ix[i] = 0;
4632  dx[i] = 0.0;
4633  }
4634  else if (x >= static_cast<double>(shape_[i] - 1))
4635  {
4636  ix[i] = shape_[i] - 1;
4637  dx[i] = 0.0;
4638  }
4639  else
4640  {
4641  ix[i] = static_cast<unsigned>(std::floor(x));
4642  dx[i] = x - ix[i];
4643  }
4644  }
4645 
4646  Numeric sum = Numeric();
4647  const unsigned long maxcycle = 1UL << dim;
4648  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
4649  {
4650  double w = 1.0;
4651  unsigned long icell = 0UL;
4652  for (unsigned i=0; i<dim; ++i)
4653  {
4654  if (icycle & (1UL << i))
4655  {
4656  w *= dx[i];
4657  icell += strides_[i]*(ix[i] + 1U);
4658  }
4659  else
4660  {
4661  w *= (1.0 - dx[i]);
4662  icell += strides_[i]*ix[i];
4663  }
4664  }
4665  if (w > 0.0)
4666  sum += data_[icell]*static_cast<proper_double>(w);
4667  }
4668  return sum;
4669  }
4670  else
4671  return localData_[0];
4672  }
const double w
Definition: UKUtility.cc:23
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Num2 sum() const
Definition: ArrayND.h:5123
ProperDblFromCmpl< Numeric >::type proper_double
Definition: ArrayND.h:55
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4726 of file ArrayND.h.

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

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

4728  {
4730  "Initialize npstat::ArrayND before calling method \"interpolate3\"");
4731  if (dim != dim_) throw npstat::NpstatInvalidArgument(
4732  "In npstat::ArrayND::interpolate3: incompatible coordinate length");
4733  if (dim)
4734  {
4735  assert(coords);
4736  return interpolateLoop(0, coords, data_);
4737  }
4738  else
4739  return localData_[0];
4740  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric interpolateLoop(unsigned level, const double *x, const Numeric *base) const
Definition: ArrayND.h:4675
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4675 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, PVValHelper::dx, trackingPlots::fit, npstat::interpolate_cubic(), npstat::interpolate_linear(), npstat::interpolate_quadratic(), hcalDigis_cfi::level, npoints, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and findQualityFiles::v.

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

4677  {
4678  const unsigned npoints = shape_[level];
4679  const double x = coords[level];
4680 
4681  unsigned ix, npt = 1;
4682  double dx = 0.0;
4683  if (x < 0.0)
4684  ix = 0;
4685  else if (x > static_cast<double>(npoints - 1))
4686  ix = npoints - 1;
4687  else
4688  {
4689  ix = static_cast<unsigned>(std::floor(x));
4690  if (ix) --ix;
4691  unsigned imax = ix + 3;
4692  while (imax >= npoints)
4693  {
4694  if (ix) --ix;
4695  --imax;
4696  }
4697  dx = x - ix;
4698  npt = imax + 1 - ix;
4699  }
4700  assert(npt >= 1 && npt <= 4);
4701 
4702  Numeric fit[4];
4703  if (level < dim_ - 1)
4704  for (unsigned ipt=0; ipt<npt; ++ipt)
4705  fit[ipt] = interpolateLoop(level + 1, coords,
4706  base + (ix + ipt)*strides_[level]);
4707 
4708  const Numeric* const v = (level == dim_ - 1 ? base + ix : fit);
4709  switch (npt)
4710  {
4711  case 1:
4712  return v[0];
4713  case 2:
4714  return interpolate_linear(dx, v[0], v[1]);
4715  case 3:
4716  return interpolate_quadratic(dx, v[0], v[1], v[2]);
4717  case 4:
4718  return interpolate_cubic(dx, v[0], v[1], v[2], v[3]);
4719  default:
4720  assert(0);
4721  return Numeric();
4722  }
4723  }
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:1055
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:4675
static const int npoints
base
Make Sure CMSSW is Setup ##.
unsigned long * strides_
Definition: ArrayND.h:1052
T interpolate_linear(const double x, const T &f0, const T &f1)
Definition: interpolate.h:23
unsigned dim_
Definition: ArrayND.h:1058
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 4987 of file ArrayND.h.

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

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

4989  {
4990  if (eps < 0.0) throw npstat::NpstatDomainError(
4991  "In npstat::ArrayND::isClose: tolerance must not be negative");
4993  "In npstat::ArrayND::isClose: incompatible argument array shape");
4994  if (dim_)
4995  {
4996  for (unsigned long i=0; i<len_; ++i)
4997  {
4998  const Numeric rval = r.data_[i];
4999  if (static_cast<double>(absDifference(data_[i], rval)) > eps)
5000  return false;
5001  }
5002  }
5003  else
5004  {
5005  const Numeric rval = r.localData_[0];
5006  if (static_cast<double>(absDifference(localData_[0], rval)) > eps)
5007  return false;
5008  }
5009  return true;
5010  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
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:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2437 of file ArrayND.h.

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

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

2439  {
2440  if (!shapeIsKnown_)
2441  return false;
2442  if (dim_ != shape.size())
2443  return false;
2444  if (dim_)
2445  {
2446  for (unsigned i=0; i<dim_; ++i)
2447  if (shape_[i] != shape[i])
2448  return false;
2449  }
2450  else
2451  assert(len_ == 1UL);
2452  return true;
2453  }
unsigned * shape_
Definition: ArrayND.h:1055
ArrayShape shape() const
Definition: ArrayND.h:3165
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
unsigned dim_
Definition: ArrayND.h:1058
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 3188 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ComplexComparesFalse< T >::less(), npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

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

3189  {
3191  "Initialize npstat::ArrayND before calling method \"isDensity\"");
3192  const Numeric zero = Numeric();
3193  bool hasPositive = false;
3194  if (dim_)
3195  for (unsigned long i=0; i<len_; ++i)
3196  {
3197  // Don't make comparisons whose result can be
3198  // determined in advance by assuming that Numeric
3199  // is an unsigned type. Some compilers will
3200  // complain about it when this template is
3201  // instantiated with such a type.
3202  if (data_[i] == zero)
3203  continue;
3205  hasPositive = true;
3206  else
3207  return false;
3208  }
3209  else
3211  zero, localData_[0]);
3212  return hasPositive;
3213  }
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2457 of file ArrayND.h.

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

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addmul(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Num1, Len1, Dim1 >::inPlaceMul(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), 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-=(), and npstat::ArrayND< Numeric, StackLen, StackDim >::operator=().

2459  {
2460  if (!shapeIsKnown_)
2461  return false;
2462  if (!r.shapeIsKnown_)
2463  return false;
2464  if (dim_ != r.dim_)
2465  return false;
2466  if (len_ != r.len_)
2467  return false;
2468  if (dim_)
2469  {
2470  assert(shape_);
2471  assert(r.shape_);
2472  for (unsigned i=0; i<dim_; ++i)
2473  if (shape_[i] != r.shape_[i])
2474  return false;
2475  }
2476  else
2477  assert(len_ == 1UL);
2478  return true;
2479  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
unsigned dim_
Definition: ArrayND.h:1058
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:1060
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 3216 of file ArrayND.h.

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

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

3217  {
3219  "Initialize npstat::ArrayND before calling method \"isZero\"");
3220  const Numeric zero = Numeric();
3221  if (dim_)
3222  {
3223  for (unsigned long i=0; i<len_; ++i)
3224  if (data_[i] != zero)
3225  return false;
3226  }
3227  else
3228  if (localData_[0] != zero)
3229  return false;
3230  return true;
3231  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned StackLen, unsigned StackDim>
template<typename Num2 , class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointMemSliceScan ( Num2 *  buffer,
unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
Functor  binaryFunct 
)

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

Definition at line 1982 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility().

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

1986  {
1987  assert(slice);
1988  if (dim_ > CHAR_BIT*sizeof(unsigned long))
1990  "In npstat::ArrayND::jointMemSliceScan: "
1991  "rank of this array is too large");
1992  unsigned long sliceStrides[CHAR_BIT*sizeof(unsigned long)];
1993  const unsigned long idx = verifyBufferSliceCompatibility(
1994  len, fixedIndices, fixedIndexValues, nFixedIndices, sliceStrides);
1995  if (dim_ > nFixedIndices)
1996  jointSliceLoop(0U, idx, 0U, 0UL, slice, sliceStrides,
1997  fixedIndices, fixedIndexValues,
1998  nFixedIndices, binaryFunct);
1999  else
2000  binaryFunct(data_[idx], *slice);
2001  }
unsigned long verifyBufferSliceCompatibility(unsigned long bufLen, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, unsigned long *sliceStrides) const
Definition: ArrayND.h:1849
void jointSliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, Num2 *sliceData, const unsigned long *sliceStrides, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2403 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Num1, Len1, Dim1 >::inPlaceMul(), and npstat::ArrayND< Num1, Len1, Dim1 >::strides().

2405  {
2407  "In npstat::ArrayND::jointScan: incompatible argument array shape");
2408  if (dim_)
2409  for (unsigned long i=0; i<len_; ++i)
2410  binaryFunct(data_[i], r.data_[i]);
2411  else
2412  binaryFunct(localData_[0], r.localData_[0]);
2413  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , class Functor >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop ( unsigned  level,
unsigned long  idx0,
unsigned  level1,
unsigned long  idx1,
Num2 *  sliceData,
const unsigned long *  sliceStrides,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
Functor  binaryFunctor 
)
private
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
template<typename Num2 , class Op >
void npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop ( const unsigned  level,
const unsigned long  idx0,
const unsigned  level1,
const unsigned long  idx1,
Num2 *  sliceData,
const unsigned long *  sliceStrides,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
const unsigned  nFixedIndices,
Op  fcn 
)

Definition at line 1917 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), alignBH_cfg::fixed, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

1925  {
1926  bool fixed = false;
1927  for (unsigned j=0; j<nFixedIndices; ++j)
1928  if (fixedIndices[j] == level)
1929  {
1930  fixed = true;
1931  break;
1932  }
1933  if (fixed)
1934  jointSliceLoop(level+1, idx0, level1, idx1,
1935  sliceData, sliceStrides, fixedIndices,
1936  fixedIndexValues, nFixedIndices, fcn);
1937  else
1938  {
1939  const unsigned imax = shape_[level];
1940  const unsigned long stride = strides_[level];
1941 
1942  if (level1 == dim_ - nFixedIndices - 1)
1943  {
1944  sliceData += idx1;
1945  Numeric* localData = data_ + idx0;
1946  for (unsigned i = 0; i<imax; ++i)
1947  fcn(localData[i*stride], sliceData[i]);
1948  }
1949  else
1950  {
1951  const unsigned long stride2 = sliceStrides[level1];
1952  for (unsigned i = 0; i<imax; ++i)
1953  jointSliceLoop(level+1, idx0+i*stride,
1954  level1+1, idx1+i*stride2,
1955  sliceData, sliceStrides, fixedIndices,
1956  fixedIndexValues, nFixedIndices, fcn);
1957  }
1958  }
1959  }
unsigned * shape_
Definition: ArrayND.h:1055
void jointSliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, Num2 *sliceData, const unsigned long *sliceStrides, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
unsigned long * strides_
Definition: ArrayND.h:1052
void fcn(int &, double *, double &, double *, int)
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1963 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility().

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

1969  {
1970  const unsigned long idx = verifySliceCompatibility(
1971  slice, fixedIndices, fixedIndexValues, nFixedIndices);
1972  if (slice.dim_)
1973  jointSliceLoop(0U, idx, 0U, 0UL, slice.data_, slice.strides_,
1974  fixedIndices, fixedIndexValues,
1975  nFixedIndices, binaryFunct);
1976  else
1977  binaryFunct(data_[idx], slice.localData_[0]);
1978  }
unsigned long verifySliceCompatibility(const ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices) const
Definition: ArrayND.h:1790
void jointSliceLoop(unsigned level, unsigned long idx0, unsigned level1, unsigned long idx1, Num2 *sliceData, const unsigned long *sliceStrides, const unsigned *fixedIndices, const unsigned *fixedIndexValues, unsigned nFixedIndices, Functor binaryFunctor)
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
template<typename Num2 , unsigned Len2, unsigned Dim2, class Functor >
void npstat::ArrayND< Numeric, Len, Dim >::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.

Definition at line 1494 of file ArrayND.h.

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

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 4851 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, edm::shift, and mitigatedMETSequence_cff::U.

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

4853  {
4854  // Make sure the object has been initialized
4856  "Initialize npstat::ArrayND before calling method \"linearFill\"");
4857  if (dim_ != dimCoeffs) throw npstat::NpstatInvalidArgument(
4858  "In npstat::ArrayND::linearFill: incompatible number of coefficients");
4859  if (dim_)
4860  {
4861  assert(coeffs);
4862  linearFillLoop(0U, 0.0, 0UL, shift, coeffs);
4863  }
4864  else
4865  localData_[0] = static_cast<Numeric>(shift);
4866  return *this;
4867  }
void linearFillLoop(unsigned level, double s0, unsigned long idx, double shift, const double *coeffs)
Definition: ArrayND.h:4823
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
static unsigned int const shift
unsigned dim_
Definition: ArrayND.h:1058
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 4823 of file ArrayND.h.

References EnergyCorrector::c, edmIntegrityCheck::d, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, edm::shift, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and npstat::ArrayND< Numeric, StackLen, StackDim >::sum().

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

4826  {
4827  const unsigned imax = shape_[level];
4828  const double c = coeffs[level];
4829  if (level == dim_ - 1)
4830  {
4831  Numeric* d = &data_[idx];
4832  for (unsigned i=0; i<imax; ++i)
4833  {
4834  // Note that we want to add "shift" only at the
4835  // very end. This might improve the numerical
4836  // precision of the result.
4837  const double sum = s0 + c*i + shift;
4838  d[i] = static_cast<Numeric>(sum);
4839  }
4840  }
4841  else
4842  {
4843  const unsigned long stride = strides_[level];
4844  for (unsigned i=0; i<imax; ++i)
4845  linearFillLoop(level+1, s0 + c*i, idx + i*stride,
4846  shift, coeffs);
4847  }
4848  }
unsigned * shape_
Definition: ArrayND.h:1055
void linearFillLoop(unsigned level, double s0, unsigned long idx, double shift, const double *coeffs)
Definition: ArrayND.h:4823
unsigned long * strides_
Definition: ArrayND.h:1052
static unsigned int const shift
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3257 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

3259  {
3261  "Initialize npstat::ArrayND before calling method \"linearIndex\"");
3262  if (!dim_) throw npstat::NpstatInvalidArgument(
3263  "npstat::ArrayND::linearIndex method "
3264  "can not be used with array of 0 rank");
3265  if (idxLen != dim_) throw npstat::NpstatInvalidArgument(
3266  "In npstat::ArrayND::linearIndex: incompatible index length");
3267  assert(index);
3268 
3269  unsigned long idx = 0UL;
3270  for (unsigned i=0; i<dim_; ++i)
3271  {
3272  if (index[i] >= shape_[i])
3274  "In npstat::ArrayND::linearIndex: index out of range");
3275  idx += index[i]*strides_[i];
3276  }
3277  return idx;
3278  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValue ( unsigned long  index)
inline
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValue ( unsigned long  index) const
inline

Definition at line 3328 of file ArrayND.h.

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

3330  {
3331  return data_[index];
3332  }
Numeric * data_
Definition: ArrayND.h:1049
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 3335 of file ArrayND.h.

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

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

3337  {
3338  if (index >= len_)
3340  "In npstat::ArrayND::linearValueAt: linear index out of range");
3341  return data_[index];
3342  }
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::linearValueAt ( unsigned long  index) const
inline

Definition at line 3345 of file ArrayND.h.

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

3347  {
3348  if (index >= len_)
3350  "In npstat::ArrayND::linearValueAt: linear index out of range");
3351  return data_[index];
3352  }
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 4456 of file ArrayND.h.

References a, npstat::absDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, checklumidiff::l, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

4458  {
4460  "Initialize npstat::ArrayND before calling method \"makeCopulaSteps\"");
4461  if (nCycles == 0U)
4462  return 0U;
4463  if (!dim_) throw npstat::NpstatInvalidArgument(
4464  "npstat::ArrayND::makeCopulaSteps method "
4465  "can not be used with array of 0 rank");
4466 
4467  const Numeric zero = Numeric();
4468  for (unsigned long i=0; i<len_; ++i)
4469  if (!(ComplexComparesAbs<Numeric>::more(data_[i], zero)))
4470  data_[i] = zero;
4471 
4472  std::vector<Numeric*> axesPtrBuf(dim_);
4473  Numeric** axes = &axesPtrBuf[0];
4474  const Numeric one = static_cast<Numeric>(1);
4475 
4476  // Memory for the axis accumulators
4477  unsigned idxSum = 0;
4478  for (unsigned i=0; i<dim_; ++i)
4479  idxSum += shape_[i];
4480  std::vector<Numeric> axesBuf(idxSum);
4481  axes[0] = &axesBuf[0];
4482  for (unsigned i=1; i<dim_; ++i)
4483  axes[i] = axes[i-1] + shape_[i-1];
4484 
4485  // Accumulate axis projections
4486  unsigned icycle = 0;
4487  for (; icycle<nCycles; ++icycle)
4488  {
4489  for (unsigned i=0; i<idxSum; ++i)
4490  axesBuf[i] = zero;
4491 
4492  // Accumulate sums for each axis
4493  for (unsigned long idat=0; idat<len_; ++idat)
4494  {
4495  unsigned long l = idat;
4496  for (unsigned i=0; i<dim_; ++i)
4497  {
4498  const unsigned idx = l / strides_[i];
4499  l -= (idx * strides_[i]);
4500  axes[i][idx] += data_[idat];
4501  }
4502  }
4503 
4504  // Make averages out of sums
4505  bool withinTolerance = true;
4506  Numeric totalSum = zero;
4507  for (unsigned i=0; i<dim_; ++i)
4508  {
4509  Numeric axisSum = zero;
4510  const unsigned amax = shape_[i];
4511  for (unsigned a=0; a<amax; ++a)
4512  {
4513  if (axes[i][a] == zero)
4515  "In npstat::ArrayND::makeCopulaSteps: "
4516  "marginal density is zero");
4517  axisSum += axes[i][a];
4518  }
4519  totalSum += axisSum;
4520  const Numeric axisAverage = axisSum/static_cast<Numeric>(amax);
4521  for (unsigned a=0; a<amax; ++a)
4522  axes[i][a] /= axisAverage;
4523  for (unsigned a=0; a<amax && withinTolerance; ++a)
4524  {
4525  const double adelta = absDifference(axes[i][a], one);
4526  if (adelta > tolerance)
4527  withinTolerance = false;
4528  }
4529  }
4530 
4531  if (withinTolerance)
4532  break;
4533 
4534  const Numeric totalAverage = totalSum/
4535  static_cast<Numeric>(len_)/static_cast<Numeric>(dim_);
4536 
4537  // Run over all points again and divide by
4538  // the product of marginals
4539  for (unsigned long idat=0; idat<len_; ++idat)
4540  {
4541  unsigned long l = idat;
4542  for (unsigned i=0; i<dim_; ++i)
4543  {
4544  const unsigned idx = l / strides_[i];
4545  l -= (idx * strides_[i]);
4546  data_[idat] /= axes[i][idx];
4547  }
4548  data_[idat] /= totalAverage;
4549  }
4550  }
4551 
4552  return icycle;
4553  }
const double tolerance
unsigned * shape_
Definition: ArrayND.h:1055
Private::AbsReturnType< T >::type absDifference(const T &v1, const T &v2)
Definition: absDifference.h:85
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
double a
Definition: hdecay.h:121
static bool more(const T &l, const T &r)
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4438 of file ArrayND.h.

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

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

4439  {
4441  "Initialize npstat::ArrayND before calling method \"makeNonNegative\"");
4442  const Numeric zero = Numeric();
4443  if (dim_)
4444  {
4445  for (unsigned long i=0; i<len_; ++i)
4446  if (!(ComplexComparesAbs<Numeric>::more(data_[i], zero)))
4447  data_[i] = zero;
4448  }
4449  else
4451  localData_[0] = zero;
4452  return *this;
4453  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
static bool more(const T &l, const T &r)
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4799 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::constFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

4800  {
4802  "Initialize npstat::ArrayND before calling method \"makeUnit\"");
4803  if (dim_ < 2) throw npstat::NpstatInvalidArgument(
4804  "npstat::ArrayND::makeUnit method "
4805  "can not be used with arrays of rank less than 2");
4806  constFill(Numeric());
4807  unsigned long stride = 0UL;
4808  const unsigned dimlen = shape_[0];
4809  for (unsigned i=0; i<dim_; ++i)
4810  {
4811  if (shape_[i] != dimlen) throw npstat::NpstatInvalidArgument(
4812  "npstat::ArrayND::makeUnit method needs "
4813  "the array span to be the same in ech dimension");
4814  stride += strides_[i];
4815  }
4816  const Numeric one(static_cast<Numeric>(1));
4817  for (unsigned i=0; i<dimlen; ++i)
4818  data_[i*stride] = one;
4819  return *this;
4820  }
unsigned * shape_
Definition: ArrayND.h:1055
ArrayND & constFill(Numeric c)
Definition: ArrayND.h:4766
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 1578 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), mps_fire::result, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), and mitigatedMETSequence_cff::U.

1581  {
1583  "Initialize npstat::ArrayND before calling method \"marginalize\"");
1584  if (!(prior.dim_ && prior.dim_ <= dim_)) throw npstat::NpstatInvalidArgument(
1585  "In npstat::ArrayND::marginalize: incompatible argument array rank");
1586  const unsigned resultDim = dim_ - prior.dim_;
1587 
1588  // Check that the index map is reasonable
1589  if (mapLen != prior.dim_) throw npstat::NpstatInvalidArgument(
1590  "In npstat::ArrayND::marginalize: incompatible index map length");
1591  assert(indexMap);
1592  for (unsigned i=0; i<mapLen; ++i)
1593  {
1594  const unsigned thisInd = indexMap[i];
1595  if (shape_[thisInd] != prior.shape_[i]) throw npstat::NpstatInvalidArgument(
1596  "In npstat::ArrayND::marginalize: "
1597  "incompatible argument array dimensions");
1598  if (thisInd >= dim_) throw npstat::NpstatOutOfRange(
1599  "In npstat::ArrayND::marginalize: index map entry out of range");
1600  for (unsigned j=0; j<i; ++j)
1601  if (indexMap[j] == thisInd) throw npstat::NpstatInvalidArgument(
1602  "In npstat::ArrayND::marginalize: "
1603  "duplicate entry in the index map");
1604  }
1605 
1606  // Build the shape for the array of results
1607  ArrayShape newShape;
1608  newShape.reserve(resultDim);
1609  for (unsigned i=0; i<dim_; ++i)
1610  {
1611  bool mapped = false;
1612  for (unsigned j=0; j<mapLen; ++j)
1613  if (indexMap[j] == i)
1614  {
1615  mapped = true;
1616  break;
1617  }
1618  if (!mapped)
1619  newShape.push_back(shape_[i]);
1620  }
1621 
1622  ArrayND result(newShape);
1623  assert(result.dim_ == resultDim);
1624  bool calculated = false;
1625  if (resultDim == 0)
1626  {
1627  calculated = true;
1628  for (unsigned i=0; i<dim_; ++i)
1629  if (indexMap[i] != i)
1630  {
1631  calculated = false;
1632  break;
1633  }
1634  if (calculated)
1635  {
1636  Numeric sum = Numeric();
1637  for (unsigned long i=0; i<len_; ++i)
1638  sum += data_[i]*prior.data_[i];
1639  result.localData_[0] = sum;
1640  }
1641  }
1642 
1643  if (!calculated)
1644  marginalizeLoop(0U, 0UL, 0U, 0UL, prior, indexMap, result);
1645 
1646  return result;
1647  }
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:1531
unsigned * shape_
Definition: ArrayND.h:1055
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 1501 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), and mitigatedMETSequence_cff::U.

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

1505  {
1506  Numeric sum = Numeric();
1507  const unsigned long myStride = strides_[indexMap[levelPr]];
1508  const unsigned imax = prior.shape_[levelPr];
1509  assert(imax == shape_[indexMap[levelPr]]);
1510  if (levelPr == prior.dim_ - 1)
1511  {
1512  for (unsigned i=0; i<imax; ++i)
1513  sum += data_[idx+i*myStride]*prior.data_[idxPr++];
1514  }
1515  else
1516  {
1517  const unsigned long priorStride = prior.strides_[levelPr];
1518  for (unsigned i=0; i<imax; ++i)
1519  {
1520  sum += marginalizeInnerLoop(idx, levelPr+1U, idxPr,
1521  prior, indexMap);
1522  idx += myStride;
1523  idxPr += priorStride;
1524  }
1525  }
1526  return sum;
1527  }
unsigned * shape_
Definition: ArrayND.h:1055
Numeric marginalizeInnerLoop(unsigned long idx, unsigned levelPr, unsigned long idxPr, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap) const
Definition: ArrayND.h:1501
unsigned long * strides_
Definition: ArrayND.h:1052
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
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 1531 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

1536  {
1537  if (level == dim_)
1538  {
1539  const Numeric res = marginalizeInnerLoop(
1540  idx, 0U, 0UL, prior, indexMap);
1541  if (result.dim_)
1542  result.data_[idxRes] = res;
1543  else
1544  result.localData_[0] = res;
1545  }
1546  else
1547  {
1548  // Check if this level is mapped or not
1549  bool mapped = false;
1550  for (unsigned i=0; i<prior.dim_; ++i)
1551  if (level == indexMap[i])
1552  {
1553  mapped = true;
1554  break;
1555  }
1556  if (mapped)
1557  marginalizeLoop(level+1U, idx, levelRes, idxRes,
1558  prior, indexMap, result);
1559  else
1560  {
1561  const unsigned imax = shape_[level];
1562  const unsigned long myStride = strides_[level];
1563  const unsigned long resStride = result.strides_[levelRes];
1564  for (unsigned i=0; i<imax; ++i)
1565  {
1566  marginalizeLoop(level+1U, idx, levelRes+1U, idxRes,
1567  prior, indexMap, result);
1568  idx += myStride;
1569  idxRes += resStride;
1570  }
1571  }
1572  }
1573  }
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:1531
unsigned * shape_
Definition: ArrayND.h:1055
Definition: Electron.h:6
Numeric marginalizeInnerLoop(unsigned long idx, unsigned levelPr, unsigned long idxPr, const ArrayND< Num2, Len2, Dim2 > &prior, const unsigned *indexMap) const
Definition: ArrayND.h:1501
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::max ( ) const

Maximum array element

Definition at line 5191 of file ArrayND.h.

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

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

5192  {
5194  "Initialize npstat::ArrayND before calling method \"max\"");
5195  if (dim_)
5196  {
5197  Numeric maxval(data_[0]);
5198  for (unsigned long i=1UL; i<len_; ++i)
5200  maxval = data_[i];
5201  return maxval;
5202  }
5203  else
5204  return localData_[0];
5205  }
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5208 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

5210  {
5212  "Initialize npstat::ArrayND before calling method \"max\"");
5213  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
5214  "In npstat::ArrayND::max: incompatible index length");
5215  if (dim_)
5216  {
5217  unsigned long maxind = 0UL;
5218  Numeric maxval(data_[0]);
5219  for (unsigned long i=1UL; i<len_; ++i)
5221  {
5222  maxval = data_[i];
5223  maxind = i;
5224  }
5225  convertLinearIndex(maxind, index, indexLen);
5226  return maxval;
5227  }
5228  else
5229  return localData_[0];
5230  }
void convertLinearIndex(unsigned long l, unsigned *index, unsigned indexLen) const
Definition: ArrayND.h:3234
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4292 of file ArrayND.h.

References npstat::absDifference(), edmIntegrityCheck::d, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, and npstat::ArrayND< Numeric, StackLen, StackDim >::localData_.

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

4294  {
4296  "In npstat::ArrayND::maxAbsDifference: "
4297  "incompatible argument array shape");
4298  if (dim_)
4299  {
4300  double maxd = 0.0;
4301  for (unsigned long i=0; i<len_; ++i)
4302  {
4303  const Numeric rval = r.data_[i];
4304  const double d = absDifference(data_[i], rval);
4305  if (d > maxd)
4306  maxd = d;
4307  }
4308  return maxd;
4309  }
4310  else
4311  {
4312  const Numeric rval = r.localData_[0];
4313  return absDifference(localData_[0], rval);
4314  }
4315  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
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:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::maximumSpan ( ) const

Maximum span among all dimensions

Definition at line 5631 of file ArrayND.h.

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

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

5632  {
5633  unsigned maxspan = 0;
5634  for (unsigned i=0; i<dim_; ++i)
5635  if (shape_[i] > maxspan)
5636  maxspan = shape_[i];
5637  return maxspan;
5638  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric npstat::ArrayND< Numeric, Len, Dim >::min ( ) const

Minimum array element

Definition at line 5149 of file ArrayND.h.

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

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

5150  {
5152  "Initialize npstat::ArrayND before calling method \"min\"");
5153  if (dim_)
5154  {
5155  Numeric minval(data_[0]);
5156  for (unsigned long i=1UL; i<len_; ++i)
5158  minval = data_[i];
5159  return minval;
5160  }
5161  else
5162  return localData_[0];
5163  }
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5166 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, and npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_.

5168  {
5170  "Initialize npstat::ArrayND before calling method \"min\"");
5171  if (indexLen != dim_) throw npstat::NpstatInvalidArgument(
5172  "In npstat::ArrayND::min: incompatible index length");
5173  if (dim_)
5174  {
5175  unsigned long minind = 0UL;
5176  Numeric minval(data_[0]);
5177  for (unsigned long i=1UL; i<len_; ++i)
5179  {
5180  minval = data_[i];
5181  minind = i;
5182  }
5183  convertLinearIndex(minind, index, indexLen);
5184  return minval;
5185  }
5186  else
5187  return localData_[0];
5188  }
void convertLinearIndex(unsigned long l, unsigned *index, unsigned indexLen) const
Definition: ArrayND.h:3234
static bool less(const T &l, const T &r)
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::minimumSpan ( ) const

Minimum span among all dimensions

Definition at line 5641 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and mitigatedMETSequence_cff::U.

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

5642  {
5643  if (dim_ == 0)
5644  return 0U;
5645  unsigned minspan = shape_[0];
5646  for (unsigned i=1; i<dim_; ++i)
5647  if (shape_[i] < minspan)
5648  minspan = shape_[i];
5649  return minspan;
5650  }
unsigned * shape_
Definition: ArrayND.h:1055
unsigned dim_
Definition: ArrayND.h:1058
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 5456 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::doubleShape(), mps_fire::i, training_settings::idx, checklumidiff::l, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, EmbeddingLHEProducer_cfi::mirror, npstat::ArrayND< Numeric, StackLen, StackDim >::shape(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::value().

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

5458  {
5459  assert(out);
5461  "Initialize npstat::ArrayND before calling method \"multiMirror\"");
5462  if (!out->shapeIsKnown_)
5463  *out = ArrayND<Num2, Len2, Dim2>(doubleShape(shape()));
5464  if (dim_ != out->dim_) throw npstat::NpstatInvalidArgument(
5465  "In npstat::ArrayND::multiMirror: incompatible argument array rank");
5466 
5467  if (dim_)
5468  {
5469  const unsigned *dshape = out->shape_;
5470  for (unsigned i=0; i<dim_; ++i)
5471  if (dshape[i] != shape_[i]*2U) throw npstat::NpstatInvalidArgument(
5472  "In npstat::ArrayND::multiMirror: "
5473  "incompatible argument array shape");
5474 
5475  if (dim_ >= CHAR_BIT*sizeof(unsigned long))
5477  "In npstat::ArrayND::multiMirror: "
5478  "array rank is too large");
5479  const unsigned long maxcycle = 1UL << dim_;
5480  std::vector<unsigned> indexbuf(dim_*2U);
5481  unsigned* idx = &indexbuf[0];
5482  unsigned* mirror = idx + dim_;
5483 
5484  for (unsigned long ipt=0; ipt<len_; ++ipt)
5485  {
5486  unsigned long l = ipt;
5487  for (unsigned i=0; i<dim_; ++i)
5488  {
5489  idx[i] = l / strides_[i];
5490  l -= (idx[i] * strides_[i]);
5491  }
5492  for (unsigned long icycle=0UL; icycle<maxcycle; ++icycle)
5493  {
5494  for (unsigned i=0; i<dim_; ++i)
5495  {
5496  if (icycle & (1UL << i))
5497  mirror[i] = dshape[i] - idx[i] - 1U;
5498  else
5499  mirror[i] = idx[i];
5500  }
5501  out->value(mirror, dim_) = data_[ipt];
5502  }
5503  }
5504  }
5505  else
5506  out->localData_[0] = static_cast<Num2>(localData_[0]);
5507  }
unsigned * shape_
Definition: ArrayND.h:1055
ArrayShape shape() const
Definition: ArrayND.h:3165
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
ArrayShape doubleShape(const ArrayShape &inputShape)
Definition: ArrayShape.cc:155
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 769 of file ArrayND.h.

772  {
773  applySlice(const_cast<ArrayND<Num2,Len2,Dim2>&>(slice),
774  fixedIndices, nFixedIndices,
775  multeq_left<Numeric,Num2>());
776  return *this;
777  }
void applySlice(ArrayND< Num2, Len2, Dim2 > &slice, const unsigned *fixedIndices, unsigned nFixedIndices, Functor binaryFunct)
Definition: ArrayND.h:2417
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 4341 of file ArrayND.h.

References alignCSCRings::r.

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

4343  {
4344  return !(*this == r);
4345  }
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 3455 of file ArrayND.h.

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

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

3456  {
3458  "Initialize npstat::ArrayND before calling method \"operator()\"");
3460  "In npstat::ArrayND::operator(): wrong # of args (not rank 0 array)");
3461  return localData_[0];
3462  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( ) const
inline

Definition at line 3465 of file ArrayND.h.

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

3466  {
3468  "Initialize npstat::ArrayND before calling method \"operator()\"");
3470  "In npstat::ArrayND::operator(): wrong # of args (not rank 0 array)");
3471  return localData_[0];
3472  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0)
inline

Definition at line 3475 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, and mitigatedMETSequence_cff::U.

3477  {
3478  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3479  "In npstat::ArrayND::operator(): wrong # of args (not rank 1 array)");
3480  return data_[i];
3481  }
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0) const
inline

Definition at line 3484 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, and mitigatedMETSequence_cff::U.

3486  {
3487  if (1U != dim_) throw npstat::NpstatInvalidArgument(
3488  "In npstat::ArrayND::operator(): wrong # of args (not rank 1 array)");
3489  return data_[i];
3490  }
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1 
)
inline

Definition at line 3535 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3538  {
3539  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3540  "In npstat::ArrayND::operator(): wrong # of args (not rank 2 array)");
3541  return data_[i0*strides_[0] + i1];
3542  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
const Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1 
) const
inline

Definition at line 3545 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3548  {
3549  if (2U != dim_) throw npstat::NpstatInvalidArgument(
3550  "In npstat::ArrayND::operator(): wrong # of args (not rank 2 array)");
3551  return data_[i0*strides_[0] + i1];
3552  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
Numeric & npstat::ArrayND< Numeric, Len, Dim >::operator() ( unsigned  i0,
unsigned  i1,
unsigned  i2 
)
inline

Definition at line 3708 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3712  {
3713  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3714  "In npstat::ArrayND::operator(): wrong # of args (not rank 3 array)");
3715  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3716  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3583 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3587  {
3588  if (3U != dim_) throw npstat::NpstatInvalidArgument(
3589  "In npstat::ArrayND::operator(): wrong # of args (not rank 3 array)");
3590  return data_[i0*strides_[0] + i1*strides_[1] + i2];
3591  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3719 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3724  {
3725  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3726  "In npstat::ArrayND::operator(): wrong # of args (not rank 4 array)");
3727  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3728  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3594 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3599  {
3600  if (4U != dim_) throw npstat::NpstatInvalidArgument(
3601  "In npstat::ArrayND::operator(): wrong # of args (not rank 4 array)");
3602  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] + i3];
3603  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3731 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3737  {
3738  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3739  "In npstat::ArrayND::operator(): wrong # of args (not rank 5 array)");
3740  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3741  i3*strides_[3] + i4];
3742  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3606 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3612  {
3613  if (5U != dim_) throw npstat::NpstatInvalidArgument(
3614  "In npstat::ArrayND::operator(): wrong # of args (not rank 5 array)");
3615  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3616  i3*strides_[3] + i4];
3617  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3745 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3752  {
3753  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3754  "In npstat::ArrayND::operator(): wrong # of args (not rank 6 array)");
3755  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3756  i3*strides_[3] + i4*strides_[4] + i5];
3757  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3620 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3627  {
3628  if (6U != dim_) throw npstat::NpstatInvalidArgument(
3629  "In npstat::ArrayND::operator(): wrong # of args (not rank 6 array)");
3630  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3631  i3*strides_[3] + i4*strides_[4] + i5];
3632  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3760 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3768  {
3769  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3770  "In npstat::ArrayND::operator(): wrong # of args (not rank 7 array)");
3771  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3772  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3773  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3635 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3643  {
3644  if (7U != dim_) throw npstat::NpstatInvalidArgument(
3645  "In npstat::ArrayND::operator(): wrong # of args (not rank 7 array)");
3646  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3647  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] + i6];
3648  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3776 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3785  {
3786  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3787  "In npstat::ArrayND::operator(): wrong # of args (not rank 8 array)");
3788  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3789  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3790  i6*strides_[6] + i7];
3791  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3651 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3660  {
3661  if (8U != dim_) throw npstat::NpstatInvalidArgument(
3662  "In npstat::ArrayND::operator(): wrong # of args (not rank 8 array)");
3663  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3664  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3665  i6*strides_[6] + i7];
3666  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3794 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3804  {
3805  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3806  "In npstat::ArrayND::operator(): wrong # of args (not rank 9 array)");
3807  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3808  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3809  i6*strides_[6] + i7*strides_[7] + i8];
3810  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3669 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3679  {
3680  if (9U != dim_) throw npstat::NpstatInvalidArgument(
3681  "In npstat::ArrayND::operator(): wrong # of args (not rank 9 array)");
3682  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3683  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3684  i6*strides_[6] + i7*strides_[7] + i8];
3685  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3813 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3824  {
3825  if (10U != dim_) throw npstat::NpstatInvalidArgument(
3826  "In npstat::ArrayND::operator(): wrong # of args (not rank 10 array)");
3827  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3828  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3829  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
3830  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3688 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

3699  {
3700  if (10U != dim_) throw npstat::NpstatInvalidArgument(
3701  "In npstat::ArrayND::operator(): wrong # of args (not rank 10 array)");
3702  return data_[i0*strides_[0] + i1*strides_[1] + i2*strides_[2] +
3703  i3*strides_[3] + i4*strides_[4] + i5*strides_[5] +
3704  i6*strides_[6] + i7*strides_[7] + i8*strides_[8] + i9];
3705  }
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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

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

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 4350 of file ArrayND.h.

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

4351  {
4353  "Initialize npstat::ArrayND before calling method \"operator*\"");
4354  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4355  for (unsigned long i=0; i<len_; ++i)
4356  result.data_[i] = data_[i]*r;
4357  return result;
4358  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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.

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

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 4427 of file ArrayND.h.

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

4428  {
4430  "Initialize npstat::ArrayND before calling method \"operator*=\"");
4431  for (unsigned long i=0; i<len_; ++i)
4432  data_[i] *= r;
4433  return *this;
4434  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 4406 of file ArrayND.h.

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

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

4407  {
4409  "Initialize npstat::ArrayND before calling method \"operator+\"");
4410  return *this;
4411  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
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 4378 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, mps_fire::result, and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

4380  {
4382  "In npstat::ArrayND::operator+: "
4383  "incompatible argument array shape");
4384  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4385  for (unsigned long i=0; i<len_; ++i)
4386  result.data_[i] = data_[i] + r.data_[i];
4387  return result;
4388  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4572 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), and npstat::ArrayND< Numeric, StackLen, StackDim >::len_.

4573  {
4575  "In npstat::ArrayND::operator+=: "
4576  "incompatible argument array shape");
4577  for (unsigned long i=0; i<len_; ++i)
4578  data_[i] += r.data_[i];
4579  return *this;
4580  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 4414 of file ArrayND.h.

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

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

4415  {
4417  "Initialize npstat::ArrayND before calling method \"operator-\"");
4418  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4419  for (unsigned long i=0; i<len_; ++i)
4420  result.data_[i] = -data_[i];
4421  return result;
4422  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4393 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::len_, mps_fire::result, and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

4395  {
4397  "In npstat::ArrayND::operator-: "
4398  "incompatible argument array shape");
4399  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4400  for (unsigned long i=0; i<len_; ++i)
4401  result.data_[i] = data_[i] - r.data_[i];
4402  return result;
4403  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4599 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), and npstat::ArrayND< Numeric, StackLen, StackDim >::len_.

4600  {
4602  "In npstat::ArrayND::operator-=: "
4603  "incompatible argument array shape");
4604  for (unsigned long i=0; i<len_; ++i)
4605  data_[i] -= r.data_[i];
4606  return *this;
4607  }
bool isShapeCompatible(const ArrayND< Num2, Len2, Dim2 > &r) const
Definition: ArrayND.h:2457
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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

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

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 4363 of file ArrayND.h.

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

4364  {
4366  "Initialize npstat::ArrayND before calling method \"operator/\"");
4367  if (r == Num2()) throw npstat::NpstatRuntimeError(
4368  "In npstat::ArrayND::operator/: division by zero");
4369  ArrayND<Numeric,Len,Dim> result(shape_, dim_);
4370  for (unsigned long i=0; i<len_; ++i)
4371  result.data_[i] = data_[i]/r;
4372  return result;
4373  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4558 of file ArrayND.h.

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

4559  {
4561  "Initialize npstat::ArrayND before calling method \"operator/=\"");
4562  if (r == Num2()) throw npstat::NpstatRuntimeError(
4563  "In npstat::ArrayND::operator/=: division by zero");
4564  for (unsigned long i=0; i<len_; ++i)
4565  data_[i] /= r;
4566  return *this;
4567  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 3079 of file ArrayND.h.

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

3080  {
3081  if (this == &r)
3082  return *this;
3083  if (shapeIsKnown_)
3084  {
3085  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
3086  "In npstat::ArrayND assignment operator: "
3087  "uninitialized argument array");
3089  "In npstat::ArrayND assignment operator: "
3090  "incompatible argument array shape");
3091  if (dim_)
3092  copyBuffer(data_, r.data_, len_);
3093  else
3094  localData_[0] = r.localData_[0];
3095  }
3096  else
3097  {
3098  // This object is uninitialized. If the object on the
3099  // right is itself initialized, make an in-place copy.
3100  if (r.shapeIsKnown_)
3101  new (this) ArrayND(r);
3102  }
3103  return *this;
3104  }
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:2457
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3109 of file ArrayND.h.

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

3110  {
3111  if ((void*)this == (void*)(&r))
3112  return *this;
3113  if (shapeIsKnown_)
3114  {
3115  if (!r.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
3116  "In npstat::ArrayND assignment operator: "
3117  "uninitialized argument array");
3119  "In npstat::ArrayND assignment operator: "
3120  "incompatible argument array shape");
3121  if (dim_)
3122  copyBuffer(data_, r.data_, len_);
3123  else
3124  localData_[0] = static_cast<Numeric>(r.localData_[0]);
3125  }
3126  else
3127  {
3128  // This object is uninitialized. If the object on the
3129  // right is itself initialized, make an in-place copy.
3130  if (r.shapeIsKnown_)
3131  new (this) ArrayND(r);
3132  }
3133  return *this;
3134  }
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:2457
bool shapeIsKnown_
Definition: ArrayND.h:1060
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4319 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, 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_.

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

4321  {
4322  if (shapeIsKnown_ != r.shapeIsKnown_)
4323  return false;
4324  if (r.dim_ != dim_)
4325  return false;
4326  if (r.len_ != len_)
4327  return false;
4328  for (unsigned i=0; i<dim_; ++i)
4329  if (shape_[i] != r.shape_[i])
4330  return false;
4331  for (unsigned i=0; i<dim_; ++i)
4332  assert(strides_[i] == r.strides_[i]);
4333  for (unsigned long j=0; j<len_; ++j)
4334  if (data_[j] != r.data_[j])
4335  return false;
4336  return true;
4337  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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)

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

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 5014 of file ArrayND.h.

References alignCSCRings::r.

5016  {
5017  return ArrayND<Numeric,Len,Dim>(*this, r);
5018  }
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 2992 of file ArrayND.h.

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

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

2997  {
2998  const unsigned imax = shape_[level];
2999  if (level == dim_ - 1)
3000  {
3001  for (unsigned i=0; i<imax; ++i)
3002  data_[idx0 + i] = a1.data_[idx1]*a2.data_[idx2 + i];
3003  }
3004  else
3005  {
3006  for (unsigned i=0; i<imax; ++i)
3007  {
3008  outerProductLoop(level+1, idx0, idx1, idx2, a1, a2);
3009  idx0 += strides_[level];
3010  if (level < a1.dim_)
3011  idx1 += a1.strides_[level];
3012  else
3013  idx2 += a2.strides_[level - a1.dim_];
3014  }
3015  }
3016  }
unsigned * shape_
Definition: ArrayND.h:1055
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:2992
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2526 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::BoxND< Numeric >::dim(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

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

2529  {
2531  "Initialize npstat::ArrayND before calling method \"processSubrange\"");
2532  if (!dim_) throw npstat::NpstatInvalidArgument(
2533  "npstat::ArrayND::processSubrange method "
2534  "can not be used with array of 0 rank");
2535  if (dim_ != subrange.dim()) throw npstat::NpstatInvalidArgument(
2536  "In npstat::ArrayND::processSubrange: incompatible subrange rank");
2537  unsigned ibuf[StackDim];
2538  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2539  for (unsigned i=0; i<dim_; ++i)
2540  buf[i] = 0U;
2541  processSubrangeLoop(0U, 0UL, buf, f, subrange);
2542  destroyBuffer(buf, ibuf);
2543  }
void processSubrangeLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
Definition: ArrayND.h:2483
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 2483 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, npstat::Interval< Numeric >::max(), npstat::Interval< Numeric >::min(), npstat::AbsArrayProjector< Input, Result >::process(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

2488  {
2489  // Deal with possible negative limits first
2490  const Interval<Integer>& levelRange(subrange[level]);
2491  long long int iminl = static_cast<long long int>(levelRange.min());
2492  if (iminl < 0LL) iminl = 0LL;
2493  long long int imaxl = static_cast<long long int>(levelRange.max());
2494  if (imaxl < 0LL) imaxl = 0LL;
2495 
2496  // Now deal with possible out-of-range limits
2497  const unsigned imin = static_cast<unsigned>(iminl);
2498  unsigned imax = static_cast<unsigned>(imaxl);
2499  if (imax > shape_[level])
2500  imax = shape_[level];
2501 
2502  if (level == dim_ - 1)
2503  {
2504  idx0 += imin;
2505  for (unsigned i=imin; i<imax; ++i, ++idx0)
2506  {
2507  currentIndex[level] = i;
2508  f.process(currentIndex, dim_, idx0, data_[idx0]);
2509  }
2510  }
2511  else
2512  {
2513  const unsigned long stride = strides_[level];
2514  idx0 += imin*stride;
2515  for (unsigned i=imin; i<imax; ++i)
2516  {
2517  currentIndex[level] = i;
2518  processSubrangeLoop(level+1U, idx0, currentIndex, f, subrange);
2519  idx0 += stride;
2520  }
2521  }
2522  }
void processSubrangeLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &f, const BoxND< Integer > &subrange) const
Definition: ArrayND.h:2483
unsigned * shape_
Definition: ArrayND.h:1055
double f[11][100]
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2148 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

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

2153  {
2154  assert(projection);
2155  verifyProjectionCompatibility(*projection, projectedIndices,
2156  nProjectedIndices);
2157  unsigned ibuf[StackDim];
2158  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2159  for (unsigned i=0; i<dim_; ++i)
2160  buf[i] = 0U;
2161  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
2162  projector, projectedIndices, nProjectedIndices,
2163  scast_assign_left<Num2,Num3>());
2164  destroyBuffer(buf, ibuf);
2165  }
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:2033
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 2285 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

2290  {
2291  assert(projection);
2292  verifyProjectionCompatibility(*projection, projectedIndices,
2293  nProjectedIndices);
2294  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2295  projector, projectedIndices, nProjectedIndices,
2296  scast_assign_left<Num2,Num3>());
2297  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
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:2235
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 2005 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, plotBeamSpotDB::last, hcalDigis_cfi::level, npstat::AbsArrayProjector< Input, Result >::process(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

2011  {
2012  // level : dimension number among indices which are being iterated
2013  const unsigned idx = projectedIndices[level];
2014  const unsigned imax = shape_[idx];
2015  const unsigned long stride = strides_[idx];
2016  const bool last = (level == nProjectedIndices - 1);
2017 
2018  for (unsigned i = 0; i<imax; ++i)
2019  {
2020  currentIndex[idx] = i;
2021  if (last)
2022  projector.process(currentIndex, dim_, idx0, data_[idx0]);
2023  else
2024  projectInnerLoop(level+1, idx0, currentIndex, projector,
2025  projectedIndices, nProjectedIndices);
2026  idx0 += stride;
2027  }
2028  }
void projectInnerLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2005
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 2211 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, training_settings::idx, plotBeamSpotDB::last, hcalDigis_cfi::level, npstat::AbsVisitor< Input, Result >::process(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

2216  {
2217  const unsigned idx = projectedIndices[level];
2218  const unsigned imax = shape_[idx];
2219  const unsigned long stride = strides_[idx];
2220  const bool last = (level == nProjectedIndices - 1);
2221 
2222  for (unsigned i = 0; i<imax; ++i)
2223  {
2224  if (last)
2225  projector.process(data_[idx0+i*stride]);
2226  else
2227  projectInnerLoop2(level+1, idx0+i*stride, projector,
2228  projectedIndices, nProjectedIndices);
2229  }
2230  }
unsigned * shape_
Definition: ArrayND.h:1055
void projectInnerLoop2(unsigned level, unsigned long idx0, AbsVisitor< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2211
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
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 2033 of file ArrayND.h.

References npstat::AbsArrayProjector< Input, Result >::clear(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop(), npstat::AbsArrayProjector< Input, Result >::result(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addToProjection(), npstat::ArrayND< Numeric, StackLen, StackDim >::project(), and npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection().

2041  {
2042  // level : dimension number in this array
2043  // level1 : dimension number in the projection
2044  // idx0 : linear index in this array
2045  // idx1 : linear index in the projection
2046  // currentIndex : cycled over in this loop with the exception of the
2047  // dimensions which are iterated over to build the
2048  // projection
2049  if (level == dim_)
2050  {
2051  assert(level1 == projection->dim_);
2052  projector.clear();
2053  projectInnerLoop(0U, idx0, currentIndex, projector,
2054  projectedIndices, nProjectedIndices);
2055  if (projection->dim_)
2056  fcn(projection->data_[idx1], projector.result());
2057  else
2058  fcn(projection->localData_[0], projector.result());
2059  }
2060  else
2061  {
2062  bool iterated = false;
2063  for (unsigned j=0; j<nProjectedIndices; ++j)
2064  if (projectedIndices[j] == level)
2065  {
2066  iterated = true;
2067  break;
2068  }
2069  if (iterated)
2070  {
2071  // This index will be iterated over inside "projectInnerLoop"
2072  projectLoop(level+1, idx0, level1, idx1,
2073  currentIndex, projection, projector,
2074  projectedIndices, nProjectedIndices, fcn);
2075  }
2076  else
2077  {
2078  const unsigned imax = shape_[level];
2079  const unsigned long stride = strides_[level];
2080  // We will not be able to get here if projection->dim_ is 0.
2081  // Therefore, it is safe to access projection->strides_.
2082  const unsigned long stride2 = projection->strides_[level1];
2083  for (unsigned i = 0; i<imax; ++i)
2084  {
2085  currentIndex[level] = i;
2086  projectLoop(level+1, idx0+i*stride,
2087  level1+1, idx1+i*stride2,
2088  currentIndex, projection, projector,
2089  projectedIndices, nProjectedIndices, fcn);
2090  }
2091  }
2092  }
2093  }
void projectInnerLoop(unsigned level, unsigned long idx0, unsigned *currentIndex, AbsArrayProjector< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2005
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:2033
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
void fcn(int &, double *, double &, double *, int)
unsigned dim_
Definition: ArrayND.h:1058
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 2235 of file ArrayND.h.

References npstat::AbsVisitor< Input, Result >::clear(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, fcn(), alignBH_cfg::fixed, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop2(), npstat::AbsVisitor< Input, Result >::result(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addToProjection(), npstat::ArrayND< Numeric, StackLen, StackDim >::project(), and npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection().

2242  {
2243  if (level == dim_)
2244  {
2245  assert(level1 == projection->dim_);
2246  projector.clear();
2247  projectInnerLoop2(0U, idx0, projector,
2248  projectedIndices, nProjectedIndices);
2249  if (projection->dim_)
2250  fcn(projection->data_[idx1], projector.result());
2251  else
2252  fcn(projection->localData_[0], projector.result());
2253  }
2254  else
2255  {
2256  bool fixed = false;
2257  for (unsigned j=0; j<nProjectedIndices; ++j)
2258  if (projectedIndices[j] == level)
2259  {
2260  fixed = true;
2261  break;
2262  }
2263  if (fixed)
2264  {
2265  projectLoop2(level+1, idx0, level1, idx1,
2266  projection, projector,
2267  projectedIndices, nProjectedIndices, fcn);
2268  }
2269  else
2270  {
2271  const unsigned imax = shape_[level];
2272  const unsigned long stride = strides_[level];
2273  const unsigned long stride2 = projection->strides_[level1];
2274  for (unsigned i = 0; i<imax; ++i)
2275  projectLoop2(level+1, idx0+i*stride,
2276  level1+1, idx1+i*stride2,
2277  projection, projector,
2278  projectedIndices, nProjectedIndices, fcn);
2279  }
2280  }
2281  }
unsigned * shape_
Definition: ArrayND.h:1055
void projectInnerLoop2(unsigned level, unsigned long idx0, AbsVisitor< Numeric, Num2 > &projector, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2211
unsigned long * strides_
Definition: ArrayND.h:1052
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:2235
unsigned dim_
Definition: ArrayND.h:1058
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 6052 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::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(), npstat::HistoND< Numeric, Axis >::read(), and npstat::ArrayND< Num1, Len1, Dim1 >::version().

6054  {
6055  static const gs::ClassId current(gs::ClassId::makeId<ArrayND<Numeric,Len,Dim> >());
6056  current.ensureSameId(id);
6057 
6058  ArrayShape rshape;
6059  gs::read_pod_vector(in, &rshape);
6060  if (in.fail()) throw gs::IOReadFailure(
6061  "In npstat::ArrayND::restore: input stream failure (checkpoint 0)");
6062 
6063  assert(array);
6064  array->uninitialize();
6065  array->dim_ = rshape.size();
6066  array->shapeIsKnown_ = true;
6067  array->len_ = 1UL;
6068  if (array->dim_)
6069  {
6070  array->shape_ = makeBuffer(array->dim_, array->localShape_, Dim);
6071  for (unsigned i=0; i<array->dim_; ++i)
6072  {
6073  array->shape_[i] = rshape[i];
6074  assert(array->shape_[i]);
6075  array->len_ *= array->shape_[i];
6076  }
6077  array->buildStrides();
6078  array->data_ = makeBuffer(array->len_, array->localData_, Len);
6079  gs::read_array(in, array->data_, array->len_);
6080  }
6081  else
6082  gs::restore_item(in, array->localData_, false);
6083  if (in.fail()) throw gs::IOReadFailure(
6084  "In npstat::ArrayND::restore: input stream failure (checkpoint 1)");
6085  }
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 5511 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_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

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

5514  {
5515  assert(rotated);
5517  "Initialize npstat::ArrayND before calling method \"rotate\"");
5518  // Can't rotate into itself -- it will be a mess
5519  if ((void*)rotated == (void*)this) throw npstat::NpstatInvalidArgument(
5520  "In npstat::ArrayND::rotate: can not rotate array into itself");
5521  if (!rotated->shapeIsKnown_)
5522  *rotated = *this;
5523  if (dim_ != rotated->dim_) throw npstat::NpstatInvalidArgument(
5524  "In npstat::ArrayND::rotate: incompatible argument array rank");
5525  if (lenShifts != dim_) throw npstat::NpstatInvalidArgument(
5526  "In npstat::ArrayND::rotate: incompatible dimensionality of shifts");
5527 
5528  if (dim_)
5529  {
5530  assert(shifts);
5531  if (dim_ > CHAR_BIT*sizeof(unsigned long))
5533  "In npstat::ArrayND::rotate: array rank is too large");
5534  unsigned buf[CHAR_BIT*sizeof(unsigned long)];
5535  clearBuffer(buf, dim_);
5536  (const_cast<ArrayND*>(this))->flatCircularLoop(
5537  0U, 0UL, 0UL, buf, shape_, shifts,
5538  *rotated, scast_assign_right<Numeric,Num2>());
5539  }
5540  else
5541  rotated->localData_[0] = static_cast<Num2>(localData_[0]);
5542  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
void clearBuffer(T *buf, const unsigned long len)
Definition: allocators.h:100
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned dim_
Definition: ArrayND.h:1058
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 2333 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, training_settings::idx, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

2337  {
2338  const unsigned idx = projectedIndices[level];
2339  const unsigned imax = shape_[idx];
2340  const unsigned long stride = strides_[idx];
2341 
2342  if (level == nProjectedIndices - 1)
2343  {
2344  Numeric* data = data_ + idx0;
2345  for (unsigned i = 0; i<imax; ++i)
2346  binaryFunct(data[i*stride], scale);
2347  }
2348  else
2349  for (unsigned i = 0; i<imax; ++i)
2350  scaleBySliceInnerLoop(level+1, idx0+i*stride, scale,
2351  projectedIndices, nProjectedIndices,
2352  binaryFunct);
2353  }
unsigned * shape_
Definition: ArrayND.h:1055
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long * strides_
Definition: ArrayND.h:1052
void scaleBySliceInnerLoop(unsigned level, unsigned long idx0, Num2 &scale, const unsigned *projectedIndices, unsigned nProjectedIndices, Functor binaryFunct)
Definition: ArrayND.h:2333
Numeric * data_
Definition: ArrayND.h:1049
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 2357 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, alignBH_cfg::fixed, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceInnerLoop(), JetEnergyShift_cfi::scaleFactor, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

2364  {
2365  if (level == dim_)
2366  {
2367  assert(level1 == slice.dim_);
2368  Num2& scaleFactor = slice.dim_ ? slice.data_[idx1] :
2369  slice.localData_[0];
2370  scaleBySliceInnerLoop(0U, idx0, scaleFactor, projectedIndices,
2371  nProjectedIndices, binaryFunct);
2372  }
2373  else
2374  {
2375  bool fixed = false;
2376  for (unsigned j=0; j<nProjectedIndices; ++j)
2377  if (projectedIndices[j] == level)
2378  {
2379  fixed = true;
2380  break;
2381  }
2382  if (fixed)
2383  {
2384  scaleBySliceLoop(level+1, idx0, level1, idx1, slice,
2385  projectedIndices, nProjectedIndices,
2386  binaryFunct);
2387  }
2388  else
2389  {
2390  const unsigned imax = shape_[level];
2391  const unsigned long stride = strides_[level];
2392  const unsigned long stride2 = slice.strides_[level1];
2393  for (unsigned i = 0; i<imax; ++i)
2394  scaleBySliceLoop(level+1, idx0+i*stride, level1+1,
2395  idx1+i*stride2, slice, projectedIndices,
2396  nProjectedIndices, binaryFunct);
2397  }
2398  }
2399  }
unsigned * shape_
Definition: ArrayND.h:1055
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:2357
unsigned long * strides_
Definition: ArrayND.h:1052
void scaleBySliceInnerLoop(unsigned level, unsigned long idx0, Num2 &scale, const unsigned *projectedIndices, unsigned nProjectedIndices, Functor binaryFunct)
Definition: ArrayND.h:2333
unsigned dim_
Definition: ArrayND.h:1058
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).

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

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 4755 of file ArrayND.h.

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

4757  {
4759  "Initialize npstat::ArrayND before calling method \"scanInPlace\"");
4760  for (unsigned long i=0; i<len_; ++i)
4761  f(data_[i]);
4762  return *this;
4763  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
double f[11][100]
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
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 
)
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 2547 of file ArrayND.h.

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

2549  {
2551  "Initialize npstat::ArrayND before calling method \"setData\"");
2552  if (dataLength != len_) throw npstat::NpstatInvalidArgument(
2553  "In npstat::ArrayND::setData: incompatible input data length");
2554  copyBuffer(data_, data, dataLength);
2555  return *this;
2556  }
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
Definition: allocators.h:41
bool shapeIsKnown_
Definition: ArrayND.h:1060
const Numeric * data() const
Definition: ArrayND.h:234
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
template<typename Numeric , unsigned Len, unsigned Dim>
ArrayShape npstat::ArrayND< Numeric, Len, Dim >::shape ( void  ) const
inline
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:1055
template<typename Numeric , unsigned StackLen, unsigned StackDim>
ArrayShape npstat::ArrayND< Numeric, StackLen, StackDim >::sliceShape ( const unsigned *  fixedIndices,
unsigned  nFixedIndices 
) const

Figure out the slice shape without actually making the slice

Definition at line 1753 of file ArrayND.h.

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

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

1755  {
1757  "Initialize npstat::ArrayND before calling method \"sliceShape\"");
1758  if (nFixedIndices)
1759  {
1760  assert(fixedIndices);
1761  if (nFixedIndices > dim_)
1763  "In npstat::ArrayND::sliceShape: too many fixed indices");
1764  for (unsigned j=0; j<nFixedIndices; ++j)
1765  if (fixedIndices[j] >= dim_)
1766  throw npstat::NpstatOutOfRange("In npstat::ArrayND::sliceShape: "
1767  "fixed index out of range");
1768  ArrayShape sh;
1769  sh.reserve(dim_ - nFixedIndices);
1770  for (unsigned i=0; i<dim_; ++i)
1771  {
1772  bool fixed = false;
1773  for (unsigned j=0; j<nFixedIndices; ++j)
1774  if (fixedIndices[j] == i)
1775  {
1776  fixed = true;
1777  break;
1778  }
1779  if (!fixed)
1780  sh.push_back(shape_[i]);
1781  }
1782  return sh;
1783  }
1784  else
1785  return ArrayShape(shape_, shape_+dim_);
1786  }
unsigned * shape_
Definition: ArrayND.h:1055
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned Len, unsigned Dim>
unsigned npstat::ArrayND< Numeric, Len, Dim >::span ( unsigned  dim) const
inline
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.

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

261 {return strides_;}
unsigned long * strides_
Definition: ArrayND.h:1052
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 2190 of file ArrayND.h.

References npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, npstat::makeBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

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

2195  {
2196  assert(projection);
2197  verifyProjectionCompatibility(*projection, projectedIndices,
2198  nProjectedIndices);
2199  unsigned ibuf[StackDim];
2200  unsigned* buf = makeBuffer(dim_, ibuf, StackDim);
2201  for (unsigned i=0; i<dim_; ++i)
2202  buf[i] = 0U;
2203  projectLoop(0U, 0UL, 0U, 0UL, buf, projection,
2204  projector, projectedIndices, nProjectedIndices,
2205  scast_minuseq_left<Num2,Num3>());
2206  destroyBuffer(buf, ibuf);
2207  }
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:2033
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 2317 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), mitigatedMETSequence_cff::U, and npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility().

2322  {
2323  assert(projection);
2324  verifyProjectionCompatibility(*projection, projectedIndices,
2325  nProjectedIndices);
2326  projectLoop2(0U, 0UL, 0U, 0UL, projection,
2327  projector, projectedIndices, nProjectedIndices,
2328  scast_minuseq_left<Num2,Num3>());
2329  }
void verifyProjectionCompatibility(const ArrayND< Num2, Len2, Dim2 > &projection, const unsigned *projectedIndices, unsigned nProjectedIndices) const
Definition: ArrayND.h:2097
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:2235
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 5123 of file ArrayND.h.

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

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::dot(), npstat::ArrayND< Numeric, StackLen, StackDim >::dotProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop(), npstat::ArrayND< Num1, Len1, Dim1 >::strides(), and npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq().

5124  {
5126  "Initialize npstat::ArrayND before calling method \"sum\"");
5127  Num2 sum = Num2();
5128  for (unsigned long i=0; i<len_; ++i)
5129  sum += data_[i];
5130  return sum;
5131  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long len_
Definition: ArrayND.h:1057
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
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 5313 of file ArrayND.h.

References runEdmFileComparison::base, npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, hcalDigis_cfi::level, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

5316  {
5317  Accumulator cdf = Accumulator();
5318  const unsigned imax = limit[level] + 1U;
5319  if (level == dim_ - 1)
5320  {
5321  Numeric* base = data_ + idx0;
5322  for (unsigned i=0; i<imax; ++i)
5323  cdf += base[i];
5324  }
5325  else
5326  {
5327  const unsigned long stride = strides_[level];
5328  for (unsigned i=0; i<imax; ++i, idx0+=stride)
5329  cdf += sumBelowLoop<Accumulator>(level+1, idx0, limit);
5330  }
5331  return cdf;
5332  }
base
Make Sure CMSSW is Setup ##.
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5135 of file ArrayND.h.

References npstat::absValue(), npstat::ArrayND< Numeric, StackLen, StackDim >::data_, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::len_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::sum().

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

5136  {
5138  "Initialize npstat::ArrayND before calling method \"sumsq\"");
5139  Num2 sum = Num2();
5140  for (unsigned long i=0; i<len_; ++i)
5141  {
5142  const Num2 absval = absValue(data_[i]);
5143  sum += absval*absval;
5144  }
5145  return sum;
5146  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
Private::AbsReturnType< T >::type absValue(const T &v1)
Definition: absDifference.h:96
unsigned long len_
Definition: ArrayND.h:1057
Num2 sum() const
Definition: ArrayND.h:5123
Numeric * data_
Definition: ArrayND.h:1049
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 5425 of file ArrayND.h.

References npstat::copyBuffer(), npstat::destroyBuffer(), npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, npstat::makeBuffer(), mps_fire::result, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, std::swap(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), and npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop().

5427  {
5429  "Initialize npstat::ArrayND before calling method \"transpose\"");
5430  if (!(pos1 < dim_ && pos2 < dim_ && pos1 != pos2))
5431  throw npstat::NpstatInvalidArgument("In npstat::ArrayND::transpose: "
5432  "incompatible transposition indices");
5433  if (dim_ == 2)
5434  return transpose();
5435  else
5436  {
5437  // Construct the new shape
5438  unsigned newshapeBuf[Dim];
5439  unsigned *newshape = makeBuffer(dim_, newshapeBuf, Dim);
5440  copyBuffer(newshape, shape_, dim_);
5441  std::swap(newshape[pos1], newshape[pos2]);
5442 
5443  // Form the result array
5444  ArrayND<Numeric,Len,Dim> result(newshape, dim_);
5445 
5446  // Fill the result array
5447  transposeLoop(0, pos1, pos2, 0UL, 0UL, result);
5448 
5449  destroyBuffer(newshape, newshapeBuf);
5450  return result;
5451  }
5452  }
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:5100
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
Definition: allocators.h:22
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
ArrayND transpose() const
Definition: ArrayND.h:5234
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 5234 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, mps_fire::result, and npstat::ArrayND< Numeric, StackLen, StackDim >::shape_.

Referenced by npstat::ArrayND< Num1, Len1, Dim1 >::strides(), and npstat::ArrayND< Numeric, StackLen, StackDim >::transpose().

5235  {
5236  if (dim_ != 2) throw npstat::NpstatInvalidArgument(
5237  "npstat::ArrayND::transpose method "
5238  "can not be used with arrays of rank other than 2");
5239  unsigned newshape[2];
5240  newshape[0] = shape_[1];
5241  newshape[1] = shape_[0];
5242  ArrayND<Numeric,Len,Dim> result(newshape, dim_);
5243  const unsigned imax = shape_[0];
5244  const unsigned jmax = shape_[1];
5245  for (unsigned i=0; i<imax; ++i)
5246  for (unsigned j=0; j<jmax; ++j)
5247  result.data_[j*imax + i] = data_[i*jmax + j];
5248  return result;
5249  }
unsigned * shape_
Definition: ArrayND.h:1055
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 5100 of file ArrayND.h.

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

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

5103  {
5104  const unsigned imax = shape_[level];
5105  const unsigned long mystride = strides_[level];
5106  const unsigned relevel = level == pos1 ? pos2 :
5107  (level == pos2 ? pos1 : level);
5108  const unsigned long restride = result.strides_[relevel];
5109  const bool ready = (level == dim_ - 1);
5110  for (unsigned i=0; i<imax; ++i)
5111  {
5112  if (ready)
5113  result.data_[idxRes] = data_[idxThis];
5114  else
5115  transposeLoop(level+1, pos1, pos2, idxThis, idxRes, result);
5116  idxThis += mystride;
5117  idxRes += restride;
5118  }
5119  }
void transposeLoop(unsigned level, unsigned pos1, unsigned pos2, unsigned long idxThis, unsigned long idxRes, ArrayND &result) const
Definition: ArrayND.h:5100
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 4783 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::destroyBuffer(), 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::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

4784  {
4788  localData_[0] = Numeric();
4789  data_ = localData_;
4790  strides_ = nullptr;
4791  shape_ = nullptr;
4792  len_ = 0;
4793  dim_ = 0;
4794  shapeIsKnown_ = false;
4795  return *this;
4796  }
unsigned localShape_[StackDim]
Definition: ArrayND.h:1054
unsigned * shape_
Definition: ArrayND.h:1055
unsigned long localStrides_[StackDim]
Definition: ArrayND.h:1051
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
unsigned long len_
Definition: ArrayND.h:1057
Numeric * data_
Definition: ArrayND.h:1049
void destroyBuffer(T *thisBuffer, const T *stackBuffer)
Definition: allocators.h:33
unsigned dim_
Definition: ArrayND.h:1058
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 3281 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

Referenced by npstat::HistoND< Numeric, Axis >::accumulateBinsLoop(), average.Average::average(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::HistoND< Numeric, Axis >::closestBin(), npstat::HistoND< Numeric, Axis >::dispatch(), npstat::HistoND< Numeric, Axis >::examine(), npstat::HistoND< Numeric, Axis >::fill(), npstat::HistoND< Numeric, Axis >::fillC(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), and npstat::HistoND< Numeric, Axis >::setBin().

3283  {
3285  "Initialize npstat::ArrayND before calling method \"value\"");
3286  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3287  "In npstat::ArrayND::value: incompatible index length");
3288  if (dim)
3289  {
3290  assert(index);
3291  unsigned long idx = 0UL;
3292  for (unsigned i=0; i<dim_; ++i)
3293  idx += index[i]*strides_[i];
3294  return data_[idx];
3295  }
3296  else
3297  return localData_[0];
3298  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3301 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

Referenced by average.Average::average().

3303  {
3305  "Initialize npstat::ArrayND before calling method \"value\"");
3306  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3307  "In npstat::ArrayND::value: incompatible index length");
3308  if (dim)
3309  {
3310  assert(index);
3311  unsigned long idx = 0UL;
3312  for (unsigned i=0; i<dim_; ++i)
3313  idx += index[i]*strides_[i];
3314  return data_[idx];
3315  }
3316  else
3317  return localData_[0];
3318  }
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3431 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

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

3433  {
3435  "Initialize npstat::ArrayND before calling method \"valueAt\"");
3436  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3437  "In npstat::ArrayND::valueAt: incompatible index length");
3438  if (dim)
3439  {
3440  assert(index);
3441  unsigned long idx = 0UL;
3442  for (unsigned i=0; i<dim_; ++i)
3443  {
3444  if (index[i] >= shape_[i]) throw npstat::NpstatOutOfRange(
3445  "In npstat::ArrayND::valueAt: index out of range");
3446  idx += index[i]*strides_[i];
3447  }
3448  return data_[idx];
3449  }
3450  else
3451  return localData_[0];
3452  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
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 3407 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::data_, npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::localData_, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and npstat::ArrayND< Numeric, StackLen, StackDim >::strides_.

3409  {
3411  "Initialize npstat::ArrayND before calling method \"valueAt\"");
3412  if (dim != dim_) throw npstat::NpstatInvalidArgument(
3413  "In npstat::ArrayND::valueAt: incompatible index length");
3414  if (dim)
3415  {
3416  assert(index);
3417  unsigned long idx = 0UL;
3418  for (unsigned i=0; i<dim_; ++i)
3419  {
3420  if (index[i] >= shape_[i]) throw npstat::NpstatOutOfRange(
3421  "In npstat::ArrayND::valueAt: index out of range");
3422  idx += index[i]*strides_[i];
3423  }
3424  return data_[idx];
3425  }
3426  else
3427  return localData_[0];
3428  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
Numeric localData_[StackLen]
Definition: ArrayND.h:1048
Numeric * data_
Definition: ArrayND.h:1049
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric , unsigned StackLen, unsigned StackDim>
unsigned long npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility ( unsigned long  bufLen,
const unsigned *  fixedIndices,
const unsigned *  fixedIndexValues,
unsigned  nFixedIndices,
unsigned long *  sliceStrides 
) const
private

Definition at line 1849 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, alignBH_cfg::fixed, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

1855  {
1856  if (!(nFixedIndices && nFixedIndices <= dim_))
1858  "In npstat::ArrayND::verifyBufferSliceCompatibility: "
1859  "invalid number of fixed indices");
1861  "Initialize npstat::ArrayND before calling "
1862  "method \"verifyBufferSliceCompatibility\"");
1863  assert(fixedIndices);
1864  assert(fixedIndexValues);
1865 
1866  for (unsigned j=0; j<nFixedIndices; ++j)
1867  if (fixedIndices[j] >= dim_) throw npstat::NpstatOutOfRange(
1868  "In npstat::ArrayND::verifyBufferSliceCompatibility: "
1869  "fixed index out of range");
1870 
1871  // Figure out slice shape. Store it, temporarily, in sliceStrides.
1872  unsigned long idx = 0UL;
1873  unsigned sliceDim = 0U;
1874  for (unsigned i=0; i<dim_; ++i)
1875  {
1876  bool fixed = false;
1877  for (unsigned j=0; j<nFixedIndices; ++j)
1878  if (fixedIndices[j] == i)
1879  {
1880  fixed = true;
1881  if (fixedIndexValues[j] >= shape_[i])
1883  "In npstat::ArrayND::verifyBufferSliceCompatibility:"
1884  " fixed index value out of range");
1885  idx += fixedIndexValues[j]*strides_[i];
1886  break;
1887  }
1888  if (!fixed)
1889  sliceStrides[sliceDim++] = shape_[i];
1890  }
1891  assert(sliceDim + nFixedIndices == dim_);
1892 
1893  // Convert the slice shape into slice strides
1894  unsigned long expectedBufLen = 1UL;
1895  if (sliceDim)
1896  {
1897  unsigned long shapeJ = sliceStrides[sliceDim - 1];
1898  sliceStrides[sliceDim - 1] = 1UL;
1899  for (unsigned j=sliceDim - 1; j>0; --j)
1900  {
1901  const unsigned long nextStride = sliceStrides[j]*shapeJ;
1902  shapeJ = sliceStrides[j - 1];
1903  sliceStrides[j - 1] = nextStride;
1904  }
1905  expectedBufLen = sliceStrides[0]*shapeJ;
1906  }
1907  if (expectedBufLen != bufLen)
1909  "In npstat::ArrayND::verifyBufferSliceCompatibility: "
1910  "invalid memory buffer length");
1911 
1912  return idx;
1913  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned dim_
Definition: ArrayND.h:1058
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 2097 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, alignBH_cfg::fixed, mps_fire::i, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, and mitigatedMETSequence_cff::U.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addToProjection(), npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::project(), and npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection().

2101  {
2102  if (!(nProjectedIndices && nProjectedIndices <= dim_))
2104  "In npstat::ArrayND::verifyProjectionCompatibility: "
2105  "invalid number of projected indices");
2107  "Initialize npstat::ArrayND before calling "
2108  "method \"verifyProjectionCompatibility\"");
2109  if (!projection.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
2110  "In npstat::ArrayND::verifyProjectionCompatibility: "
2111  "uninitialized argument array");
2112  if (projection.dim_ != dim_ - nProjectedIndices)
2114  "In npstat::ArrayND::verifyProjectionCompatibility: "
2115  "incompatible argument array rank");
2116  assert(projectedIndices);
2117 
2118  for (unsigned j=0; j<nProjectedIndices; ++j)
2119  if (projectedIndices[j] >= dim_) throw npstat::NpstatOutOfRange(
2120  "In npstat::ArrayND::verifyProjectionCompatibility: "
2121  "projected index out of range");
2122 
2123  // Check projection shape compatibility
2124  unsigned sliceDim = 0U;
2125  for (unsigned i=0; i<dim_; ++i)
2126  {
2127  bool fixed = false;
2128  for (unsigned j=0; j<nProjectedIndices; ++j)
2129  if (projectedIndices[j] == i)
2130  {
2131  fixed = true;
2132  break;
2133  }
2134  if (!fixed)
2135  {
2136  if (shape_[i] != projection.shape_[sliceDim])
2138  "In npstat::ArrayND::verifyProjectionCompatibility: "
2139  "incompatible argument array dimensions");
2140  ++sliceDim;
2141  }
2142  }
2143  assert(sliceDim == projection.dim_);
2144  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned dim_
Definition: ArrayND.h:1058
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 1790 of file ArrayND.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::dim_, alignBH_cfg::fixed, mps_fire::i, training_settings::idx, npstat::ArrayND< Numeric, StackLen, StackDim >::shape_, npstat::ArrayND< Numeric, StackLen, StackDim >::shapeIsKnown_, npstat::ArrayND< Numeric, StackLen, StackDim >::strides_, and mitigatedMETSequence_cff::U.

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

1795  {
1796  if (!(nFixedIndices && nFixedIndices <= dim_))
1798  "In npstat::ArrayND::verifySliceCompatibility: "
1799  "invalid number of fixed indices");
1801  "Initialize npstat::ArrayND before calling "
1802  "method \"verifySliceCompatibility\"");
1803  if (!slice.shapeIsKnown_) throw npstat::NpstatInvalidArgument(
1804  "In npstat::ArrayND::verifySliceCompatibility: "
1805  "uninitialized argument array");
1806  if (slice.dim_ != dim_ - nFixedIndices) throw npstat::NpstatInvalidArgument(
1807  "In npstat::ArrayND::verifySliceCompatibility: "
1808  "incompatible argument array rank");
1809  assert(fixedIndices);
1810  assert(fixedIndexValues);
1811 
1812  for (unsigned j=0; j<nFixedIndices; ++j)
1813  if (fixedIndices[j] >= dim_) throw npstat::NpstatOutOfRange(
1814  "In npstat::ArrayND::verifySliceCompatibility: "
1815  "fixed index out of range");
1816 
1817  // Check slice shape compatibility
1818  unsigned long idx = 0UL;
1819  unsigned sliceDim = 0U;
1820  for (unsigned i=0; i<dim_; ++i)
1821  {
1822  bool fixed = false;
1823  for (unsigned j=0; j<nFixedIndices; ++j)
1824  if (fixedIndices[j] == i)
1825  {
1826  fixed = true;
1827  if (fixedIndexValues[j] >= shape_[i])
1829  "In npstat::ArrayND::verifySliceCompatibility: "
1830  "fixed index value out of range");
1831  idx += fixedIndexValues[j]*strides_[i];
1832  break;
1833  }
1834  if (!fixed)
1835  {
1836  if (shape_[i] != slice.shape_[sliceDim])
1838  "In npstat::ArrayND::verifySliceCompatibility: "
1839  "incompatible argument array dimensions");
1840  ++sliceDim;
1841  }
1842  }
1843  assert(sliceDim == slice.dim_);
1844  return idx;
1845  }
unsigned * shape_
Definition: ArrayND.h:1055
bool shapeIsKnown_
Definition: ArrayND.h:1060
unsigned long * strides_
Definition: ArrayND.h:1052
unsigned dim_
Definition: ArrayND.h:1058
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
static unsigned npstat::ArrayND< Numeric, StackLen, StackDim >::version ( )
inlinestatic

Definition at line 1044 of file ArrayND.h.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

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

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 1049 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addmul(), npstat::ArrayND< Numeric, StackLen, StackDim >::apply(), npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::cl(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::ArrayND< Numeric, StackLen, StackDim >::commonSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::constFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), 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 >::functorFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::isDensity(), npstat::ArrayND< Numeric, StackLen, StackDim >::isZero(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointMemSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearValue(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearValueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::min(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), 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 >::operator/=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::outerProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::scanInPlace(), npstat::ArrayND< Numeric, StackLen, StackDim >::setData(), npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumBelowLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::value(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::write(), and npstat::ArrayND< Numeric, StackLen, StackDim >::~ArrayND().

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

Definition at line 1058 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addToProjection(), npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfValue(), npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::cl(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::ArrayND< Numeric, StackLen, StackDim >::commonSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdf(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::copyRangeLoopFunct(), 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 >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::flatCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::fullRange(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isDensity(), npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isZero(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointMemSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::maximumSpan(), npstat::ArrayND< Numeric, StackLen, StackDim >::min(), npstat::ArrayND< Numeric, StackLen, StackDim >::minimumSpan(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), 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 >::processSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::project(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop(), 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 >::shape(), npstat::ArrayND< Numeric, StackLen, StackDim >::sliceShape(), npstat::ArrayND< Numeric, StackLen, StackDim >::span(), npstat::ArrayND< Numeric, StackLen, StackDim >::subtractFromProjection(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumBelowLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::value(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility(), and npstat::ArrayND< Numeric, StackLen, StackDim >::write().

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

Definition at line 1057 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::addmul(), npstat::ArrayND< Numeric, StackLen, StackDim >::apply(), npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), npstat::ArrayND< Numeric, StackLen, StackDim >::constFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isDensity(), npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isZero(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Num1, Len1, Dim1 >::length(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearValueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::min(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), 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 >::operator=(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::scanInPlace(), npstat::ArrayND< Numeric, StackLen, StackDim >::setData(), npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), and npstat::ArrayND< Numeric, StackLen, StackDim >::write().

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

Definition at line 1048 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::applySlice(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), npstat::ArrayND< Numeric, StackLen, StackDim >::cl(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3(), npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::isDensity(), npstat::ArrayND< Numeric, StackLen, StackDim >::isZero(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference(), npstat::ArrayND< Numeric, StackLen, StackDim >::min(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator()(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator=(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::rotate(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::value(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::write(), and npstat::ArrayND< Numeric, StackLen, StackDim >::~ArrayND().

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
template<typename Numeric, unsigned StackLen = 1U, unsigned StackDim = 10U>
unsigned* npstat::ArrayND< Numeric, StackLen, StackDim >::shape_
private

Definition at line 1055 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildFromShapePtr(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfValue(), npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::commonSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::coordToIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::copyRangeLoopFunct(), 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 >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::flatCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::fullRange(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::maximumSpan(), npstat::ArrayND< Numeric, StackLen, StackDim >::minimumSpan(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), 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 >::processSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::rotate(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape(), npstat::ArrayND< Num1, Len1, Dim1 >::shapeData(), npstat::ArrayND< Numeric, StackLen, StackDim >::sliceShape(), npstat::ArrayND< Numeric, StackLen, StackDim >::span(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility(), and npstat::ArrayND< Numeric, StackLen, StackDim >::~ArrayND().

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

Definition at line 1060 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::apply(), npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::assign(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfValue(), npstat::ArrayND< Numeric, StackLen, StackDim >::cl(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::ArrayND< Numeric, StackLen, StackDim >::constFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdf(), npstat::ArrayND< Numeric, StackLen, StackDim >::derivative(), npstat::ArrayND< Numeric, StackLen, StackDim >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::fullRange(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate3(), npstat::ArrayND< Numeric, StackLen, StackDim >::isCompatible(), npstat::ArrayND< Numeric, StackLen, StackDim >::isDensity(), npstat::ArrayND< Numeric, StackLen, StackDim >::isShapeCompatible(), npstat::ArrayND< Num1, Len1, Dim1 >::isShapeKnown(), npstat::ArrayND< Numeric, StackLen, StackDim >::isZero(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFill(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeNonNegative(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalize(), npstat::ArrayND< Numeric, StackLen, StackDim >::max(), npstat::ArrayND< Numeric, StackLen, StackDim >::min(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), 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 >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::restore(), npstat::ArrayND< Numeric, StackLen, StackDim >::rotate(), npstat::ArrayND< Numeric, StackLen, StackDim >::scanInPlace(), npstat::ArrayND< Numeric, StackLen, StackDim >::setData(), npstat::ArrayND< Numeric, StackLen, StackDim >::shape(), npstat::ArrayND< Numeric, StackLen, StackDim >::sliceShape(), npstat::ArrayND< Numeric, StackLen, StackDim >::sum(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq(), npstat::ArrayND< Numeric, StackLen, StackDim >::transpose(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::value(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyProjectionCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility(), and npstat::ArrayND< Numeric, StackLen, StackDim >::write().

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

Definition at line 1052 of file ArrayND.h.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::at(), npstat::ArrayND< Numeric, StackLen, StackDim >::buildStrides(), npstat::ArrayND< Numeric, StackLen, StackDim >::cdfArray(), npstat::ArrayND< Numeric, StackLen, StackDim >::circularFlatLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::cl(), npstat::ArrayND< Numeric, StackLen, StackDim >::closest(), npstat::ArrayND< Numeric, StackLen, StackDim >::commonSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::contract(), npstat::ArrayND< Numeric, StackLen, StackDim >::contractLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertLinearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::convertToLastDimCdfLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::copyRangeLoopFunct(), npstat::ArrayND< Numeric, StackLen, StackDim >::derivative(), npstat::ArrayND< Numeric, StackLen, StackDim >::dotProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::dualCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::flatCircularLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::functorFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1(), npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::jointSliceScan(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearFillLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::linearIndex(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeUnit(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::marginalizeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator()(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator==(), npstat::ArrayND< Numeric, StackLen, StackDim >::outerProductLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::processSubrangeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectInnerLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceInnerLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::scaleBySliceLoop(), npstat::ArrayND< Num1, Len1, Dim1 >::strides(), npstat::ArrayND< Numeric, StackLen, StackDim >::sumBelowLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::transposeLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >::uninitialize(), npstat::ArrayND< Numeric, StackLen, StackDim >::value(), npstat::ArrayND< Numeric, StackLen, StackDim >::valueAt(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifyBufferSliceCompatibility(), npstat::ArrayND< Numeric, StackLen, StackDim >::verifySliceCompatibility(), and npstat::ArrayND< Numeric, StackLen, StackDim >::~ArrayND().