don't understand matrix-multiplication should be reversed in python?
Dave Farrance
df at see.replyto.invalid
Fri Nov 13 11:35:56 EST 2015
PythonDude <mjoerg.phone at gmail.com> wrote:
>On Thursday, 12 November 2015 22:57:21 UTC+1, Robert Kern wrote:
>> He simply instantiated the two vectors as row-vectors instead of column-vectors,
>> which he could have easily done, so he had to flip the matrix expression.
>
>Thank you very much Robert - I just had to be sure about it :-)
Yep, he's evidently used to the Matlab/Octave way of defining "vectors"
which is somewhat easier for a math-oriented interactive environment.
It's just a *bit* more laborious to append columns in numpy.
>>> from numpy import *
>>> v1=vstack([0,1,2])
>>> v2=vstack([3,4,5])
>>> c_[v1,v2]
array([[0, 3],
[1, 4],
[2, 5]])
>>> append(v1,v2,axis=1)
array([[0, 3],
[1, 4],
[2, 5]])
>>> v3=mat('4;5;6')
>>> v4=mat('7;8;9')
>>> c_[v3,v4]
matrix([[4, 7],
[5, 8],
[6, 9]])
More information about the Python-list
mailing list