Beispiel #1
0
 /// <summary>
 /// Actually executes a nullary operation in CIL by retrieving the data and executing the <see cref="T:NumCIL.INullaryOp{0}"/> or <see cref="T:NumCIL.IUnaryConvOp{0}"/> on each element.
 /// This implementation is optimized for use with up to 4 dimensions, but works for any size dimension.
 /// This method is optimized for 64bit processors, using the .Net 4.0 runtime.
 /// </summary>
 /// <typeparam name="T">The type of data to generat</typeparam>
 /// <typeparam name="C">The type of operation to perform</typeparam>
 /// <param name="op">The operation instance</param>
 /// <param name="out">The output target</param>
 private static void UFunc_Op_Inner_Nullary_Flush <T, C>(C op, NdArray <T> @out)
     where C : struct, INullaryOp <T>
 {
     if (!UnsafeAPI.UFunc_Op_Inner_Nullary_Flush_Unsafe <T, C>(op, @out))
     {
         UFunc_Op_Inner_Nullary_Impl_Flush <T, C>(op, @out);
     }
 }
Beispiel #2
0
 /// <summary>
 /// The inner execution of a <see cref="T:NumCIL.IUnaryOp{0}"/>.
 /// This will just call the UnaryConv flush operation with Ta and Tb set to T
 /// </summary>
 /// <typeparam name="T">The type of data to operate on</typeparam>
 /// <typeparam name="C">The type of operation to perform</typeparam>
 /// <param name="op">The operation instance</param>
 /// <param name="scalar">The input scalar</param>
 /// <param name="out">The output target</param>
 private static void UFunc_Op_Inner_Unary_Flush_Scalar <T, C>(C op, T scalar, NdArray <T> @out)
     where C : struct, IUnaryOp <T>
 {
     if (!UnsafeAPI.UFunc_Op_Inner_Unary_Scalar_Flush_Unsafe <T, C>(op, scalar, ref @out))
     {
         UFunc_Op_Inner_UnaryConv_Flush_Scalar <T, T, C>(op, scalar, @out);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Actually executes a binary operation in CIL by retrieving the data and executing the <see cref="T:NumCIL.IBinaryOp{0}"/> on each element.
        /// This implementation is optimized for use with up to 4 dimensions, but works for any size dimension.
        /// This method is optimized for 64bit processors, using the .Net 4.0 runtime.
        /// </summary>
        /// <typeparam name="T">The type of data to operate on</typeparam>
        /// <typeparam name="C">The type of operation to perform</typeparam>
        /// <param name="op">The operation instance</param>
        /// <param name="in1">The left-hand-side input argument</param>
        /// <param name="scalar">The right-hand-side scalar argument</param>
        /// <param name="out">The output target</param>
        private static void UFunc_Op_Inner_Binary_RhsScalar_Flush <T, C>(C op, NdArray <T> in1, T scalar, NdArray <T> @out)
            where C : struct, IBinaryOp <T>
        {
            if (UnsafeAPI.UFunc_Op_Inner_Binary_RhsScalar_Flush_Unsafe(op, in1, scalar, ref @out))
            {
                return;
            }

            UFunc_Op_Inner_BinaryConv_RhsScalar_Flush <T, T, C>(op, in1, scalar, @out);
        }
Beispiel #4
0
 /// <summary>
 /// The inner execution of a <see cref="T:NumCIL.IUnaryOp{0}"/>.
 /// This will just call the UnaryConv flush operation with Ta and Tb set to T
 /// </summary>
 /// <typeparam name="T">The type of data to operate on</typeparam>
 /// <typeparam name="C">The type of operation to perform</typeparam>
 /// <param name="op">The operation instance</param>
 /// <param name="in1">The input argument</param>
 /// <param name="out">The output target</param>
 private static void UFunc_Op_Inner_Unary_Flush <T, C>(C op, NdArray <T> in1, NdArray <T> @out)
     where C : struct, IUnaryOp <T>
 {
     if (in1.DataAccessor.Length == 1 && in1.DataAccessor.GetType() == typeof(DefaultAccessor <T>))
     {
         UFunc_Op_Inner_Unary_Flush_Scalar <T, C>(op, in1.DataAccessor[0], @out);
     }
     else
     {
         if (!UnsafeAPI.UFunc_Op_Inner_Unary_Flush_Unsafe <T, C>(op, in1, ref @out))
         {
             UFunc_Op_Inner_UnaryConv_Flush <T, T, C>(op, in1, @out);
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// Actually executes a binary operation in CIL by retrieving the data and executing the <see cref="T:NumCIL.IBinaryOp{0}"/> on each element.
        /// This implementation is optimized for use with up to 4 dimensions, but works for any size dimension.
        /// This method is optimized for 64bit processors, using the .Net 4.0 runtime.
        /// </summary>
        /// <typeparam name="T">The type of data to operate on</typeparam>
        /// <typeparam name="C">The type of operation to perform</typeparam>
        /// <param name="op">The operation instance</param>
        /// <param name="in1">The left-hand-side input argument</param>
        /// <param name="in2">The right-hand-side input argument</param>
        /// <param name="out">The output target</param>
        private static void UFunc_Op_Inner_Binary_Flush <T, C>(C op, NdArray <T> in1, NdArray <T> in2, NdArray <T> @out)
            where C : struct, IBinaryOp <T>
        {
            if (in1.DataAccessor.Length == 1 && in1.DataAccessor.GetType() == typeof(DefaultAccessor <T>))
            {
                UFunc_Op_Inner_Binary_LhsScalar_Flush(op, in1.DataAccessor[0], in2, @out);
            }
            else if (in2.DataAccessor.Length == 1 && in2.DataAccessor.GetType() == typeof(DefaultAccessor <T>))
            {
                UFunc_Op_Inner_Binary_RhsScalar_Flush(op, in1, in2.DataAccessor[0], @out);
            }
            else
            {
                if (UnsafeAPI.UFunc_Op_Inner_Binary_Flush_Unsafe(op, in1, in2, ref @out))
                {
                    return;
                }

                UFunc_Op_Inner_BinaryConv_Flush <T, T, C>(op, in1, in2, @out);
            }
        }