Make the vectorization more flexible

Accept any shape as long as the number of elements match.