def broadcasting_app(matrix, X, Y):
    ys = np.arange(Y)
xs = np.arange(X)
out = ys[:, (None), (None)] * matrix[:, (1)] + xs[:, (None)] * matrix[:, (0)
    ] + matrix[:, (2)]
return out
Жесткое преобразование - Python - ускорение