IMcOMGlobalMcReduce Method
|
|
Reduces one dimension of a multi-dimensional data array by
combining all elements along the given dimension using a specified operator.
Namespace:
MediaCy.IQL.ObjectManager
Assembly:
MediaCy.IQL.ObjectManager (in MediaCy.IQL.ObjectManager.dll) Version: 10.0.6912.0
SyntaxFunction McReduce (
NDimArray As Object,
Optional Operator As String = "+",
Optional DimToReduce As Integer = -1
) As McObject
Parameters
- NDimArray
- Type: SystemObject
May be a scalar or array of any numeric type. It may also be a
McObject instance of a numeric type. - Operator (Optional)
- Type: SystemString
The binary operator to be used for the reduction. The allowed values are
given in the following table. The default is "+", that is summation.
"*" multiply.
"+" addition.
"<>" smaller of ("min" is also accepted).
"><" larger of ("max" is also accepted).
"&" bitwise AND, integral types only.
"|" bitwise OR, integral types only. - DimToReduce (Optional)
- Type: SystemInt32
The number (0 is the slowest moving dimension, the leftmost in
C and the rightmost in VB) of the dimension to be reduced. By default the
value is -1, which indicates that the fastest moving dimension (right-most
in C, left-most in VB) dimension is to be reduced.
Return Value
Type:
McObjectA McObject of the same type as the NDimArray argument with one
dimension reduced. If NDimArray has more than 1 dimension, the returned object
will have one less dimensionality; if NDimArray is a 1-D vector, the returned
object will be a length-1 array. The returned object will have a "standard"
shape (slowest moving dimension VAR, all others FIX'ed size).
RemarksThe returned object has the same shape as the original object, less
the reduced dimension. For example, for a two dimensional matrix, mA (declared
mA[N][M] in C or Dim mA(0 to M-1, 0 to N-1) in VB), reduced with a "+" operation
along dimension 0 (slowest moving dimension; the leftmost in C, or the rightmost
in VB) the return value is a 1-dimensional array vB[M] where each element is
created so that (in C syntax),
vB[m] = mA[0,m]+mA[1,m]+...+mA[N-1,m] for m, 0 to M-1 (i.e., the slowest
moving, row dimension of mA was "reduced" by adding together all rows). A
similar reduction along dimension 1 (the "column" dimension) would return a
vector of length N, with all columns added together. In VB syntax, the
reduction would look like
vB(m) = mA(m,0)+mA(m,1)+...+mA(m,N-1) for m, 0 to M-1 (i.e., the slowest moving,
column dimension of mA was "reduced" by adding together all columns).
Examples
Dim mcoA As McObject
Set mcoA = McObjectTemp(Array(Array(0, 1, 2), Array(10, 11, 12)))
Dim mcoB As McObject
Set mcoB = McReduce(mcoA, "+", 1)
Set mcoB = McReduce(mcoA)
Debug.Print McToText(mcoB)
varB = McReduce(mcoA, "+", 0)
Debug.Print McToText(varB)
See Also