ParticleOverdose
ParticleOverdose copied to clipboard
Remove unnecessary numpy.array() conversion after numpy.dot()
https://github.com/yolowex/ParticleOverdose/blob/7d5a1e474794b313550de5cee9a9e8cf2630e926/pt.py#L16
In the line:
return numpy.array(res).reshape(8)
the use of numpy.array(res) is unnecessary because numpy.dot() already returns a NumPy ndarray. Wrapping it again with numpy.array() introduces redundant copying, leading to unnecessary memory and performance overhead. The code can be simplified and made more efficient by directly calling .reshape() on the result:
return res.reshape(8)
This change preserves the functionality while avoiding an extra and unnecessary array copy.
Thanks, make a pr so i'll accept it