<div dir="ltr">Hi,<div><br></div><div>I would like to vectorize the next computation:</div><div><div><br></div><div>nx, ny, nz = 720, 180, 3</div><div>outheight = np.arange(nz) * 3</div><div>oro = np.arange(nx * ny).reshape((nx, ny))</div></div><div><br></div><div><div>def compute1(outheight, oro):</div><div>    result = np.zeros((nx, ny, nz))</div><div>    for ix in range(nx):</div><div>        for iz in range(nz):</div><div>            result[ix, :, iz] = outheight[iz] + oro[ix, :]</div><div>    return result</div><div><br></div><div>I think this should be possible by using an advanced use of broadcasting in numpy.  Anyone willing to post a solution?</div><div><br></div><div>Thanks, </div>-- <br><div class="gmail_signature">Francesc Alted</div>
</div></div>