klyn.Application.sum
method

    public static sum<T extends AbstractNumber>(values as klyn.math.NDArray<T>) as T:

Description

Returns the sum of all numeric values from an NDArray.

    import klyn.math

    ints = NDArray<Int>.ones(i:[2u, 3u])
    print(sum(ints))   # 6

    doubles = NDArray<Double>.fromList([1.5, 2.5, 3.0])
    print(sum(doubles))   # 7.0

Parameters

Parameter | Description
--- | ---
`values` | The NDArray to sum.

Returns

The accumulated total with the same numeric type as the array items.