Exemple #1
0
 internal  oplogical__int32 ( Int32 parameter,
          ILLogicalFunctionInt32Int32 applyFunc) {
     m_parameter = parameter;
     m_applyFun = applyFunc;
 }
Exemple #2
0
 private static ILLogicalArray  LogicalBinaryInt32Operator (
     ILArray<Int32> A,
     ILArray<Int32> B,
     ILLogicalFunctionInt32Int32 operation) {
     ILDimension inDim = A.m_dimensions;
     if (!inDim.IsSameSize ( B.m_dimensions ))
         throw new ILDimensionMismatchException ();
     byte [] retSystemArr;
     // build ILDimension
     int newLength = inDim.NumberOfElements;
     retSystemArr = new byte [newLength];
     int leadDim = 0;
     int leadDimLen = inDim [0];
     if (A.IsReference || B.IsReference) {
         // this will most probably be not very fast, but .... :|
         #region Reference storage
         // walk along the longest dimension (for performance reasons)
         for (int i = 1; i < inDim.NumberOfDimensions; i++) {
             if (leadDimLen < inDim [i]) {
                 leadDimLen = inDim [i];
                 leadDim = i;
             }
         }
         unsafe {
             fixed (byte* pOutArr = retSystemArr) {
                 int c = 0; 
                 byte* poutarr = pOutArr;
                 byte* outEnd = poutarr + newLength;
                 while (poutarr < outEnd) {
                     *poutarr++ = operation ( A.GetValue(c), B.GetValue(c++) );
                 }
             }
         }
         // ==============================================================
         #endregion
     } else {
         // physical -> pointer arithmetic
         #region physical storage
         unsafe {
             fixed ( Int32 * pInArr1 = A.m_data)
             fixed ( Int32 * pInArr2 = B.m_data)
             fixed (byte* pOutArr = retSystemArr) {
                 byte* poutarr = pOutArr;
                 byte* poutend = poutarr + newLength;
                 Int32 * pIn1 = pInArr1;
                 Int32 * pIn2 = pInArr2;
                 while (poutarr < poutend)
                     *poutarr++ = operation ( *pIn1++, *pIn2++ );
             }
         }
         #endregion
     }
     return new ILLogicalArray ( retSystemArr, inDim.ToIntArray () );
 }