Re: [Numpy-discussion] size of arrays

2021-03-13 Thread Todd
No, because the array of 100 elements will only have the overhead once, while the 100 arrays will each have the overhead repeated. Think about the overhead like a book cover on a book. It takes additional space, but provides storage for the book, information to help you find it, etc. Each book on

Re: [Numpy-discussion] size of arrays

2021-03-13 Thread Robert Kern
On Sat, Mar 13, 2021 at 4:18 PM wrote: > So is it right that 100 arrays of one element is smaller than one array > with size of 100 elements? > No, typically the opposite is true. -- Robert Kern ___ NumPy-Discussion mailing list NumPy-Discussion@pyth

Re: [Numpy-discussion] size of arrays

2021-03-13 Thread klark--kent
So is it right that 100 arrays of one element is smaller than one array with size of 100 elements?14.03.2021, 00:06, "Todd" :Ideally float64 uses 64 bits for each number while float16 uses 16 bits.  64/16=4.  However, there is some additional overhead.  This overhead makes up a large portion of sma

Re: [Numpy-discussion] size of arrays

2021-03-13 Thread Robert Kern
On Sat, Mar 13, 2021 at 4:02 PM wrote: > Dear colleagues! > > Size of np.float16(1) is 26 > Size of np.float64(1) is 32 > 32 / 26 = 1.23 > Note that `sys.getsizeof()` is returning the size of the given Python object in bytes. `np.float16(1)` and `np.float64(1)` are so-called "numpy scalar object

Re: [Numpy-discussion] size of arrays

2021-03-13 Thread Todd
Ideally float64 uses 64 bits for each number while float16 uses 16 bits. 64/16=4. However, there is some additional overhead. This overhead makes up a large portion of small arrays, but becomes negligible as the array gets bigger. On Sat, Mar 13, 2021, 16:01 wrote: > Dear colleagues! > > Size

[Numpy-discussion] size of arrays

2021-03-13 Thread klark--kent
Dear colleagues! Size of np.float16(1) is 26Size of np.float64(1) is 3232 / 26 = 1.23 Since memory is limited I have a question after this code:    import numpy as np   import sys    a1 = np.ones(1, dtype='float16')   b1 = np.ones(1, dtype='float64')   div_1 = sys.getsizeof(b1) / sys.getsizeof(a1)