[Numpy-discussion] binary shift for ndarray

dmitrey dmitrey.kroshko at scipy.org
Wed May 20 15:24:57 EDT 2009


hi all,

suppose I have A that is numpy ndarray of floats, with shape n x n.

I want to obtain dot(A, b), b is vector of length n and norm(b)=1, but
instead of exact multiplication I want to approximate b as a vector
[+/- 2^m0, ± 2^m1, ± 2^m2 ,,, ± 2^m_n], m_i are integers, and then
invoke left_shift(vector_m) for rows of A.

So, what is the simplest way to do it, without cycles of course? Or it
cannot be implemented w/o cycles with current numpy version?

Thank you in advance, D.



More information about the NumPy-Discussion mailing list