Quansight-Labs / numpy.net

A port of NumPy to .Net
BSD 3-Clause "New" or "Revised" License
137 stars 15 forks source link

Cleanup code #44

Closed ChengYen-Tang closed 1 year ago

ChengYen-Tang commented 1 year ago

I think your previous method is too brute force, so I help you clean up the codešŸ¤£ https://github.com/Quansight-Labs/numpy.net/issues/43#issuecomment-1343859790

KevinBaselinesw commented 1 year ago

In the last release, I did find a way to reduce some of the code. Have a look.

I don't see how the sample you provided can be used to copy data from a numpy array to a multi-dimension .net array. Unfortunately I think it has to be done in a brute looping method like I did. Each element from the numpy array needs to be selected because it could be sliced view.

ChengYen-Tang commented 1 year ago

I just think that the previous method is not beautiful. There are 705 lines of code when converting ndarray to Array, and there is an upper limit of supported dimensions. Therefore, I provide a short and flexible method, although the principle is to copy elements one by one.

ChengYen-Tang commented 1 year ago

I just want to help improve the maintainability of this library, the redundant code makes a file too big to read I'm just thinking like this, nothing else