Oct. 6, 2011
2:18 p.m.
On Thu, Oct 6, 2011 at 7:08 AM, Neal Becker <ndbecker2@gmail.com> wrote:
Given a vector y, I want a matrix H whose rows are
y - x0 y - x1 y - x2 ...
where x_i are scalars
Suggestion?
In [15]: import numpy as np In [16]: y = np.array([10.0, 20.0, 30.0]) In [17]: x = np.array([0, 1, 2, 4]) In [18]: H = y - x[:, np.newaxis] In [19]: H Out[19]: array([[ 10., 20., 30.], [ 9., 19., 29.], [ 8., 18., 28.], [ 6., 16., 26.]]) Warren
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion