python Programming Glossary: ijk
more efficient way to calculate distance in numpy? http://stackoverflow.com/questions/17527340/more-efficient-way-to-calculate-distance-in-numpy deltas.shape # 5.861109972 108225 10500 2 R numpy.einsum 'ijk ijk ij' deltas deltas print R2 t time.time t0 R.shape #14.5291359425.. # 5.861109972 108225 10500 2 R numpy.einsum 'ijk ijk ij' deltas deltas print R2 t time.time t0 R.shape #14.5291359425.. None From here the simplest would be dist np.einsum 'ijk ijk ij' deltas deltas You could also try something like from..
Why is numpy's einsum faster than numpy's built in functions? http://stackoverflow.com/questions/18365073/why-is-numpys-einsum-faster-than-numpys-built-in-functions at the np.sum function np.all np.sum arr_3D np.einsum 'ijk ' arr_3D True timeit np.sum arr_3D 10 loops best of 3 142 ms.. 10 loops best of 3 142 ms per loop timeit np.einsum 'ijk ' arr_3D 10 loops best of 3 70.2 ms per loop Powers np.allclose.. loop Powers np.allclose arr_3D arr_3D arr_3D np.einsum 'ijk ijk ijk ijk' arr_3D arr_3D arr_3D True timeit arr_3D arr_3D..
|