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__(), trackTools.MakeAODTrackCandidates::__call__(), coreTools.RunOnData::__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, hfnoseDigiStudy_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, hfnoseDigiStudy_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 ov