Using numpy to build an array of all combinations of two arrays

后端 未结 10 1454
温柔的废话
温柔的废话 2020-11-22 00:41

I\'m trying to run over the parameters space of a 6 parameter function to study it\'s numerical behavior before trying to do anything complex with it so I\'m searching for a

10条回答
  •  暖寄归人
    2020-11-22 01:20

    It looks like you want a grid to evaluate your function, in which case you can use numpy.ogrid (open) or numpy.mgrid (fleshed out):

    import numpy
    my_grid = numpy.mgrid[[slice(0,1,0.1)]*6]
    

提交回复
热议问题