I have a function which I am trying to vectorize. Inside the function I have the following code.
A = np.c_[xdata, ydata, np.ones(len(zdata))]
Where x_data, y_data, z_data are all 1x5 array, eg. [1,2,3,4,5]. The resulting output for A would be
array([[1.90155189, 1.64412979, 1. ],
[2.44148892, 1.73851717, 1. ],
[1.65259189, 2.10693759, 1. ],
[2.52045732, 2.30939049, 1. ],
[1.53516213, 2.39788003, 1. ]])
I would like to convert this part of the function to work on an array of inputs (eg. 1000 rows of 5 columns) for x, y, z. I naively tried to just feed the arrays into this function with the following output for the first row.
array([1.90155189, 2.44148892, 1.65259189, 2.52045732, 1.53516213,
1.64412979, 1.73851717, 2.10693759, 2.30939049, 2.39788003,
1. ])
Here is an example for the inputs for the first result:
x=[1.90155189 2.44148892 1.65259189 2.52045732 1.53516213]
y=[1.64412979 1.73851717 2.10693759 2.30939049 2.39788003]
z=[0.23273446 0.57301046 0.89755946 0.07169598 0.41394575]
Let's say now I have the following data for the second method:
x_array = [[1.90155189 2.44148892 1.65259189 2.52045732 1.53516213],
[1.90155189 2.44148892 1.65259189 2.52045732 1.53516213],
[1.90155189 2.44148892 1.65259189 2.52045732 1.53516213]]
y_array = [[1.64412979 1.73851717 2.10693759 2.30939049 2.39788003],
[1.64412979 1.73851717 2.10693759 2.30939049 2.39788003],
[1.64412979 1.73851717 2.10693759 2.30939049 2.39788003]]
z_array = [[0.23273446 0.57301046 0.89755946 0.07169598 0.41394575],
[0.23273446 0.57301046 0.89755946 0.07169598 0.41394575],
[0.23273446 0.57301046 0.89755946 0.07169598 0.41394575]]
With an expected output of
[[[1.90155189, 1.64412979, 1. ],
[2.44148892, 1.73851717, 1. ],
[1.65259189, 2.10693759, 1. ],
[2.52045732, 2.30939049, 1. ],
[1.53516213, 2.39788003, 1. ]],
[[1.90155189, 1.64412979, 1. ],
[2.44148892, 1.73851717, 1. ],
[1.65259189, 2.10693759, 1. ],
[2.52045732, 2.30939049, 1. ],
[1.53516213, 2.39788003, 1. ]],
[[1.90155189, 1.64412979, 1. ],
[2.44148892, 1.73851717, 1. ],
[1.65259189, 2.10693759, 1. ],
[2.52045732, 2.30939049, 1. ],
[1.53516213, 2.39788003, 1. ]]]