Exemplo n.º 1
0
        internal static NdArray <T> FillFrom(NdArray <T> target, NdArray <T> source)
        {
            var src1 = NdArray <T> .PrepareElemwiseSources(target, source);

            target.CopyFrom(src1);

            return(target);
        }
        /// <summary>
        /// Element-wise choice between two sources depending on a condition.
        /// </summary>
        /// <param name="cond">The condition NdArray.</param>
        /// <param name="ifTrue">The NdArray containing the values to use for when an element of the condition is true.</param>
        /// <param name="ifFalse">The NdArray containing the values to use for when an element of the condition is false.</param>
        /// <returns>A new NdArray containing the result of this operation.</returns>
        public static NdArray <T> IfThenElse(NdArray <bool> condition, NdArray <T> ifTrue, NdArray <T> ifFalse)
        {
            var(target, cond, ift, iff) = NdArray <T> .PrepareElemwise <T, bool, T, T>(condition, ifTrue, ifFalse);

            var(cond2, ift2, iff2) = NdArray <T> .PrepareElemwiseSources(target, cond, ift, iff);

            target.Backend.IfThenElse(target, cond2, ift2, iff2);

            return(target);
        }
Exemplo n.º 3
0
        public static void FillAtan(NdArray <T> target, NdArray <T> source)
        {
            var preparedSource = NdArray <T> .PrepareElemwiseSources(target, source);

            target.Backend.Atan(target, preparedSource);
        }
Exemplo n.º 4
0
        public static void FillAsin(NdArray <T> target, NdArray <T> source)
        {
            var src2 = NdArray <T> .PrepareElemwiseSources(target, source);

            target.Backend.Asin(target, src2);
        }
Exemplo n.º 5
0
        public static void FillPow(NdArray <T> target, NdArray <T> lhs, NdArray <T> rhs)
        {
            var(preparedLhs, preparedRhs) = NdArray <T> .PrepareElemwiseSources(target, lhs, rhs);

            target.Backend.Pow(target, preparedLhs, preparedRhs);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Copies elements from a NdArray of different data type into the target NdArray and converts their type.
        /// </summary>
        /// <param name="target">The target NdArray.</param>
        /// <typeparam name="TC">The data type to convert from.</typeparam>
        /// <param name="source">The NdArray to copy from.</param>
        public static void FillConvert <TC>(NdArray <T> target, NdArray <TC> source)
        {
            var preparedSource = NdArray <T> .PrepareElemwiseSources(target, source);

            target.Backend.Convert(target, preparedSource);
        }
        public static void FillOr(NdArray <bool> target, NdArray <bool> lhs, NdArray <bool> rhs)
        {
            var(preparedLhs, preparedRhs) = NdArray <bool> .PrepareElemwiseSources(target, lhs, rhs);

            target.Backend.Or(target, preparedLhs, preparedRhs);
        }
        public static void FillNegate(NdArray <bool> target, NdArray <bool> source)
        {
            var preparedSource = NdArray <bool> .PrepareElemwiseSources(target, source);

            target.Backend.Negate(target, preparedSource);
        }
        internal static void FillMultiply(NdArray <T> target, NdArray <T> lhs, NdArray <T> rhs)
        {
            var(preparedLhs, preparedRhs) = NdArray <T> .PrepareElemwiseSources(target, lhs, rhs);

            target.Backend.Multiply(target, preparedLhs, preparedRhs);
        }
Exemplo n.º 10
0
        public static void FillLessOrEqual <TP>(NdArray <bool> target, NdArray <TP> lhs, NdArray <TP> rhs)
        {
            var(preparedLhs, preparedRhs) = NdArray <TP> .PrepareElemwiseSources(target, lhs, rhs);

            target.Backend.LessOrEqual(target, preparedLhs, preparedRhs);
        }
Exemplo n.º 11
0
        public static void FillIsFinite <TP>(NdArray <bool> target, NdArray <TP> source)
        {
            var preparedSource = NdArray <TP> .PrepareElemwiseSources(target, source);

            target.Backend.IsFinite(target, preparedSource);
        }
Exemplo n.º 12
0
        public static void FillGreater <TP>(NdArray <bool> target, NdArray <TP> lhs, NdArray <TP> rhs)
        {
            var(preparedLhs, preparedRhs) = NdArray <TP> .PrepareElemwiseSources(target, lhs, rhs);

            target.Backend.Greater(target, preparedLhs, preparedRhs);
        }