SciSharp / NumSharp

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

implement numpy Matrix Class #27

Closed dotChris90 closed 6 years ago

dotChris90 commented 6 years ago

following the API doc https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.matrix.html

dotChris90 commented 6 years ago

okay understood. Just one question in general here.

In Python there is the possibility to create an array of lists containing doubles for a matrix. Also there is the possibility to create array of arrays. For sure the array of array strategy brings a better performance when using matrix operations.

In C# we would have possibility of NDArray of NArrays of doubles or NDArray of usual double array. I am very sure, that NDArray of NDArray will lead to some performance issues since NDArray is an adapter class of a true array. But in case of NDArray<double[]> we could get full performance support.

So final question : shouldn't we design NumSharp in a way that we avoid nested NDArrays?

Oceania2018 commented 6 years ago

We should consider performance first. Let's make a big change, like separate NDArray as 1 dim array, NDArray2 as 2 dim array, and fore T as value type.

if(!(typeof(T).equals(typeof(int32))) && !(typeof(T).equals(typeof(decimal))))
Oceania2018 commented 6 years ago

Please retire the Matrix class. If you insist to keep it, I suggest that Matrix inherits NDArray<T>, just keep Shape = new List<int>() {0, 0}, the only different is Shape property. I reopen this issue till @dotChris90 fix it. Thanks.

dotChris90 commented 6 years ago

Agree

dotChris90 commented 6 years ago

Merged. Only inv I removed because reimplement in ndarray.

dotChris90 commented 6 years ago

remove because matrix now inheritage from NDArray