I would like to vectorize some code, but I find it hard to apply some functions to vectors of variables.
For example, I have two constant vectors, a and b, and a vector of vectors x (a matrix). Dimensions of the members of x is the same as those of a and b. I want to make matrices formed by columns from : a member of x, a, and b:
x = [[ 0.76662363 -0.0397725 0.64086377]
[ 0.76198581 -0.04605764 0.6459538 ]]
a = [ 0.2763932 0.85065081 -0.5527864 ]
b = [-0.7236068 0.52573111 -0.5527864 ]
The output should be a vector (or array) of two 3x3 matrices. I am trying to run the following code:
a = np.column_stack((x, a, b))
however I get an error message that the dimensions do not match across the arguments:
File "/software/python/2.7.8/lib/python2.7/site-packages/numpy/lib/shape_base.py", line 317, in column_stack
return _nx.concatenate(arrays, 1)
ValueError: all the input array dimensions except for the concatenation axis must match exactly
Any ideas?