[SciPy-user] Zeros
Hoyt Koepke
hoytak at gmail.com
Sat Mar 15 13:58:54 EDT 2008
Don't know if this helps, but it might:
In matlab, all the typical operations assume the variables are
matrices and tries to do matrix multiplication on them. Array-type
operations are done using .*, .^, etc. In numpy and scipy, however,
there are two types, arrays and matrices, which you can easily convert
back and forth from using mat(X) and M.A or array(M). Array
operations are, roughly speaking, element wise, and matrix operations
do what you'd expect. It takes a little getting used to, but I find
that distinguishing the types has a lot of advantages.
So to get the behavior you're expecting, you probably need to declare
a column matrix, so try mat(zeros(N)).T (the .T to transpose it from
a row to a column).
--Hoyt
On Sat, Mar 15, 2008 at 10:30 AM, Natali Melgarejo Diaz
<nmelgarejodiaz at gmail.com> wrote:
> Good afternoon to everyone!!
>
> I want to make a column vector using numpy, like in Matlab when you do
> zeros(N,1). I've been doing it with zeros(N) and i already get an array. It
> maybe be the same but the results get are different with the formulas
> involved.
> Thanks ;))
>
> ********Natali********
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
More information about the SciPy-User
mailing list