Managing high dimensions in Numpy -


i want write function of 4 variables : f(x1,x2,x3,x4), each in different dimension.

this can achieved f(x1,x2[newaxis],x3[newaxis,newaxis],x4[newaxis,newaxis,newaxis]).

do know smarter way ?

you're looking np.ix_1:

f(*np.ix_(x1, x2, x3, x4)) 

for example:

>>> np.ix_([1, 2, 3], [4, 5]) (array([[1],         [2],         [3]]), array([[4, 5]])) 

1or equivalently, np.meshgrid(..., sparse=true, indexing='ij')


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -