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

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

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -