[SciPy-User] Again with matrices multiplication

josef.pktd@gmai... josef.pktd@gmai...
Fri Mar 26 06:43:09 CDT 2010


On Fri, Mar 26, 2010 at 7:10 AM, Graziano Mirata
<graziano.mirata@lu.unisi.ch> wrote:
> Hi guys,
> it's me again. Still problems with matrices multiplication.
>
> So i have used dot(w,R) to multiply two arrays but now i cannot access to elements. I.e
>
> In [224]: w.shape
> Out[224]: (3,)
> In [226]: R.shape
> Out[226]: (24000, 3)
>
> In [227]: r = dot(R,w)
>
> In [228]: type(r)
> Out[228]: <type 'numpy.ndarray'>
>
> In [229]: r.shape
> Out[229]: (24000,)

the shape of r means it is a 1 dimensional array

r[0] to get first element
r[:5] to get first five elements

Josef

>
> In [230]: r[0,0]
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call last)
>
> /<ipython console> in <module>()
>
> IndexError: invalid index
>
> In [231]: r[:,0]
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call last)
>
> /<ipython console> in <module>()
>
> IndexError: invalid index
>
> Thanx
>
> G
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list