[SciPy-user] NumPy matrix-vector calculation

Matthieu Brucher matthieu.brucher@gmail....
Tue Oct 2 11:40:13 CDT 2007


Matrix and array are basically the same, you can do what you want with both,
the only difference you will notice is that the multplication is the matrix
multiplication in one case and the elementwise multiplication in the other
case. Just try to be consistent and use only matrix or only arrays.
Then, if you have to add rows or columns, see hstack() and vstack()


2007/10/2, Dinesh B Vadhia <dineshbvadhia@hotmail.com>:
>  Hello!  I am an experienced software engineer but relatively new to
> Python, NumPy and SciPy.  I'll say up front that I've have scanned all the
> pertinent documentation including the paid-for NumPy book but not found an
> answer to our problem(s):
> We have an MxN (M not equal to N) integer matrix A.  The data for A is
> read-in from a file on persistant storage and the data is immutable (ie.
> does not change and cannot be changed).
> The vector x is a vector of size Nx1.  The data elements of x are
> calculated during the program execution.
> We then perform a matrix-vector calculation ie. y = Ax, where the
> resulting y is a Mx1 vector.
> Both x and y are then discarded and a new x and y are calculated and this
> continues until program execution stops but at all times the matrix A
> remains the same until ...
> Under certain circumstances, we may have to increase the size of M to M+R
> leaving N alone ie. append R rows to the end of matrix A.  We would want to
> do this while the program is executing.
> Here are the questions:
> - What NumPy array structure do we use for A - an array or matrix (and
> why)?
> - If A is a matrix data structure then do the x and y vectors have to be
> matrix structures too or can you mix the data structures?
> - If A is a matrix or an array structure, can we append rows during
> program execution and if so, how do we do this?
> Any help towards these questions will be gratefully appreciated.
> Thank-you
> Dinesh
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071002/d1fcd0e8/attachment-0001.html 

More information about the SciPy-user mailing list