NumSharp icon indicating copy to clipboard operation
NumSharp copied to clipboard

ToString should truncate its output

Open thomasd3 opened this issue 5 years ago • 2 comments

On very large arrays, NDArray.ToString() is never coming back (or maybe it would at some point in time).

It would make sense to truncate the ToString() output.

thomasd3 avatar Jul 18 '19 12:07 thomasd3

I'll add a DebuggerTypeProxy that'll truncute beyond certain amount of characters. After we finish the rework on the NumSharp's backend - It should be much faster.

Nucs avatar Jul 18 '19 12:07 Nucs

I implemented the NDArray.ToString() but at the time I didn't know that Numpy has a way of not showing the middle elements of a huge array. if you create a 100x100 matrix it will show this on the console. the ToString method probably should do the same. See below. Also, current ToString() does not format the elements so that they are equally spaced with a monotype font.

>>> import numpy as np
>>> a=np.arange(10000).reshape(100,100)
>>> a
array([[   0,    1,    2, ...,   97,   98,   99],
       [ 100,  101,  102, ...,  197,  198,  199],
       [ 200,  201,  202, ...,  297,  298,  299],
       ...,
       [9700, 9701, 9702, ..., 9797, 9798, 9799],
       [9800, 9801, 9802, ..., 9897, 9898, 9899],
       [9900, 9901, 9902, ..., 9997, 9998, 9999]])
>>>

henon avatar Jul 18 '19 13:07 henon