[Numpy-discussion] How to speed up array generating

2021-01-09 Thread klark--kent
Hello. There is a random 1D array m_0 with size 3000, for example:m_0 = np.array([0, 1, 2]) I need to generate two 1D arrays:m_1 = np.array([0, 1, 2, 0, 1, 2, 0, 1, 2]) m_2 = np.array([0, 0, 0, 1, 1, 1, 2, 2, 2]) Is there faster way to do it than this one:import numpy as np import time N = 3 m_0 =

Re: [Numpy-discussion] How to speed up array generating

2021-01-09 Thread klark--kent
np.meshgrid, indexing, reshape09.01.2021, 22:30, "Joseph Fox-Rabinovitz" :What other ways have you tried?On Sat, Jan 9, 2021 at 2:15 PM wrote:Hello. There is a random 1D array m_0 with size 3000, for example:m_0 = np.array([0, 1, 2]) I need to generate two 1D arrays:m_1 = np

Re: [Numpy-discussion] How to speed up array generating

2021-01-09 Thread klark--kent
Thank you but the same time:   import numpy as np    import time    N = 3000    m_0 = np.arange(N)    a = np.ones(N)#= first =    t1 = time.time()    m_1 = np.outer(m_0, a).ravel()    m_2 = np.outer(a, m_0).ravel()    t1 = time.time() - t1#= second ===    t2 = time.time()    m_3

[Numpy-discussion] IRFFT of sound

2021-01-24 Thread klark--kent
Hello friends!Maybe that's not directly a Numpy question but I think it can be solved by Numpy.I do RFFT of microphone sound and find its absolute value np.abs(). Than I need to do IRFFT but I don't know how to restore sinusoida after np.abs(). I can't not to use 'abs'. I need it in my code. Is the

[Numpy-discussion] NumPy logo merchandise

2021-03-04 Thread klark--kent
Hello. I was looking for a T-shirt with Numpy logo but didn't find anywhere. Anybody knows if there's a merchandise with Numpy? So I have to kneet mittens with Numpy logo for myself.Best regards!Konstantin___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] NumPy logo merchandise

2021-03-05 Thread klark--kent
Hello Melissa!I don't mind :)05.03.2021, 15:58, "Melissa Mendonça" :Hi Konstantin,Would you mind open-sourcing that recipe? :DCheers,MelissaEm qui, 4 de mar de 2021 21:59, Juan Nunez-Iglesias escreveu:Yeah I desperately want those mitts!On 5 Mar 2021, at 11:54 am, Stephan Hoyer

[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) 

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] Expanding the scope of numpy.unpackbits and numpy.packbits to include more than uint8 type

2021-03-30 Thread klark--kent
I thought about it as well. Can't NumPy create a custom type which user can set for his needs. It will be usefull because of lack memory. For example I work with data from zero to 1e-6 or to 1e-8 with double prcision and not more. So I could save usefull memory.29.03.2021, 22:11, "Joseph Fox-Rabino

[Numpy-discussion] Broadcasting array with Ursina intersect

2021-06-06 Thread klark--kent
Good day! It could be thought it's not actual Numpy theme but I think it is. For 3D objects intersection detection I use Ursina eith 'for' loop. Is any way to use Numpy broadcasting for not using loops? Thank you!from ursina import *import numpy as npapp = Ursina()cube_1 = Entity(model='cube', coll