Skip to content

Commit

Permalink
generalize function.asarray for varying ndim args
Browse files Browse the repository at this point in the history
  • Loading branch information
gertjanvanzwieten committed Feb 27, 2015
1 parent acd890f commit ee5ef7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nutils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,8 @@ def asarray( arg ):
return array

args = [ asarray(a) for a in arg ]
ndim = _max( arg.ndim for arg in args )
args = [ arg[(_,)*(ndim-arg.ndim)] for arg in args ]

if all( isinstance( arg, numpy.ndarray ) for arg in args ):
array = numpy.array( args )
Expand Down

0 comments on commit ee5ef7d

Please sign in to comment.