Re: [Numpy-discussion] newbie doubt about dot()

2008-04-01 Thread Alan G Isaac
On Tue, 1 Apr 2008, harryos apparently wrote:
> i need to calculate 
> wk=uk o (L-Psi)
> where 
> uk=a vector of size (1 X N^2)
> o =scalar product 
> l,Psi=vectors of (N^2 X 1)
> i have an ndarray U of shape(M X N^2)where uk is one of the rows , and 
> L of shape (M X N^2) where l.transpose() is one of the rows, 


Your explanation is not fully clear to me,
but perhaps the following will help.

#dummy values
rows = 2
cols = 3*3
U = numpy.ones((rows,cols)) + [[0],[1]]
L = numpy.random.random((rows,cols)) - 0.5
Psi = numpy.ones((cols,1))

#computation
numpy.dot(U,L.transpose() - Psi)

hth,
Alan Isaac



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] newbie doubt about dot()

2008-04-01 Thread harryos
i am slightly confused by this maths

i need to calculate
wk=uk o (L-Psi)
where
uk=a vector of size (1 X N^2)
o =scalar product
l,Psi=vectors of (N^2 X 1)

i have an ndarray U of shape(M X N^2)where uk is one of the rows , and
L of shape (M X N^2) where l.transpose() is one of the rows,
If i were to apply the above formula how can i find the matrix where
wk is an element.? I know i have to use dot() but the rest i am
finding a bit confusing
can someone please help?
harryos
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion