I am translating some MATLAB code and am having some problems understanding the syntaxical difference between MATLAB and numpy for Python.
In MATLAB I have a 6 by 6 matrix, A, as well as 6 float values, a, b, c, d, e, f. The MATLAB code
B = A*[a;b;c;d;e;f];
produces a 6 by 1 matrix, B. So I figured that the MATLAB operator '*' must correspond to the numpy operator numpy.dot().
So in my Python code I have the same matrix, A, and the same values for a, b, c, d, e and f.
B = numpy.dot(A, [[a],[b],[c],[d],[e],[f]])
does not produce the same matrix, B, and neither does
B = numpy.dot(A, [a,b,c,d,e,f])
I have also tried building the Python matrix and array with numpy's array function with the same result. It feels like I am mixing something fundamental up here. Any help is greatly appreciated.
[a;b;c;d;e;f]is a column vector, are you sure your numpy vectors are column vectors and not row vectors?Ais 6 by 6,A*[a;b;c;d;e;f]should be 6 by 1 (i.e. a column vector). Are you sure you got a 1 x 6 matrix?A,a,b, etc), and show the output that you get in Matlab and python.