/// <summary>
        /// Checks if all elements along the specified axis are true.
        /// </summary>
        /// <param name="axis">The axis to check along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        /// <returns>A new NdArray containing the result of this operation.</returns>
        public static NdArray <bool> AllAxis(int axis, NdArray <bool> source)
        {
            var(preparedTargt, preparedSource) = NdArray <bool> .PrepareAxisReduceTarget <bool, bool>(axis, source);

            FillAllAxis(preparedTargt, axis, preparedSource);
            return(preparedTargt);
        }
        /// <summary>
        /// Calculates the minimum value of the elements along the specified axis.
        /// </summary>
        /// <param name="axis">The axis to calculate the minimum along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        /// <returns>A new NdArray containing the result of this operation.</returns>
        public static NdArray <T> MinAxis(int axis, NdArray <T> source)
        {
            var(preparedTarget, preparedSource) = NdArray <T> .PrepareAxisReduceTarget <T, T>(axis, source);

            FillMinAxis(preparedTarget, axis, preparedSource);

            return(preparedTarget);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Finds the index of the maximum value along the specified axis.
        /// </summary>
        /// <param name="axis">The axis to calculate the maximum along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        /// <returns>A new NdArray containing the result of this operation.</returns>
        public static NdArray <int> ArgMaxAxis(int axis, NdArray <T> source)
        {
            var(preparedTargt, preparedSource) = NdArray <T> .PrepareAxisReduceTarget <int, T>(axis, source);

            FillArgMaxAxis(preparedTargt, axis, preparedSource);

            return(preparedTargt);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Finds the first occurence of the specfied value along the specified axis and returns its index.
        /// </summary>
        /// <param name="value">The value to find.</param>
        /// <param name="axis">The axis to find the value along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        /// <returns>A new NdArray containing the indices of the first occurence of <paramref name="value"/>.</returns>
        public static NdArray <int> FindAxis(T value, int axis, NdArray <T> source)
        {
            var(preparedTargt, preparedSource) = NdArray <T> .PrepareAxisReduceTarget <int, T>(axis, source);

            FillFindAxis(preparedTargt, value, axis, preparedSource);

            return(preparedTargt);
        }
        /// <summary>
        /// Calculates the product of the elements along the specified axis.
        /// </summary>
        /// <param name="axis">The axis to calculate the product along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        /// <returns>A new NdArray containing the result of this operation.</returns>
        public static NdArray <T> ProductAxis(int axis, NdArray <T> source)
        {
            var(result, src) = NdArray <T> .PrepareAxisReduceTarget <T, T>(axis, source);

            var(src1, _) = NdArray <T> .PrepareAxisReduceSources(result, axis, source, null);

            result.Backend.ProductLastAxis(result, src1);

            return(result);
        }
        /// <summary>
        /// Counts the elements being true along the specified axis.
        /// </summary>
        /// <param name="axis">The axis the count along.</param>
        /// <param name="source">The NdArray containing the source values.</param>
        public static NdArray <int> CountTrueAxis(int axis, NdArray <bool> source)
        {
            var(preparedTarget, preparedSource) = NdArray <int> .PrepareAxisReduceTarget <int, bool>(axis, source);

            preparedTarget.AssertInt();

            FillCountTrueAxis(preparedTarget, axis, preparedSource);

            return(preparedTarget);
        }