SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.37k stars 192 forks source link

Feature/np cumsum #307

Closed Plankton555 closed 5 years ago

Plankton555 commented 5 years ago

Simple implementation of cumulative sum. Either call as a member function from an NDArray or as a static function via np.cumsum().

Plankton555 commented 5 years ago

@Oceania2018 I tried using Linq instead but didn't get it to work. Any advice are welcome

Assert.IsTrue(Enumerable.SequenceEqual(arr, expected)); resulted in The type arguments for method 'Enumerable.SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly

Assert.IsTrue(Enumerable.SequenceEqual<double>(arr, expected)); resulted in cannot convert from 'NumSharp.NDArray' to 'System.Collections.Generic.IEnumerable<double>

Oceania2018 commented 5 years ago

Assert.IsTrue(Enumerable.SequenceEqual(arr.GetData<double>(), expected.GetData<double>()))

Plankton555 commented 5 years ago

4/6 tests are failing currently. The failing tests are related to summing over specific axes, as well as specifying data types.

Nucs commented 5 years ago

Thank you for the PR!