On Fri, 18 Mar 2011 20:27:17 +, Rohaq wrote:
> There could be a lot more than 2 other columns, Result3,Result4, etc.,
> so I need to code it to be scalable; if this were acting like a normal
> dict, I could write a loop that iterates over the keys, and loads the
> results data into a new objec
On Tue, 08 Feb 2011 18:06:48 +, Andrew Jaffe wrote:
> For this shape=(N,3) vector, this is not what you mean: as Robert Kern
> also has it you want axis=1, which produces a shape=(N,) (or the
> [:,newaxis] version which produces shape=(N,1).
>
> But what is the point of the ones(3)? I think
On Tue, 8 Feb 2011 10:46:34 -0600, Robert Kern wrote:
> (v*v).sum(axis=1)[:,np.newaxis]
>
> You can leave off the newaxis bit if you don't really need a column vector.
>
Fair enough, I unfortunately neglected to mention that I ultimately want
to normalize these vectors, hence the *ones(3) in my
I have an array of (say, row) vectors,
v = [ [ a1, a2, a3 ],
[ b1, b2, b3 ],
[ c1, c2, c3 ],
...
]
What is the optimal way to compute the norm of each vector,
norm(v)**2 = [
[ a1**2 + a2**2 + a3**2 ],
[ b1**2 + b2**2 + b3**2 ],
...
]
It see