import numpy as np


def get_position_of_minimum(matrix):
    return np.unravel_index(np.nanargmin(matrix), matrix.shape)


def get_position_of_maximum(matrix):
    return np.unravel_index(np.nanargmax(matrix), matrix.shape)


def get_distance_matrix(cell_grid_x, cell_grid_y, x, y):
    return np.sqrt((x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2)


def get_distance_matrix_squared(cell_grid_x, cell_grid_y, x, y):
    return (x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2

[((295, 351), 'numpy.sqrt', 'np.sqrt', (['((x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2)'], {}), '((x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2)\n', (302, 351), True, 'import numpy as np\n'), ((86, 106), 'numpy.nanargmin', 'np.nanargmin', (['matrix'], {}), '(matrix)\n', (98, 106), True, 'import numpy as np\n'), ((189, 209), 'numpy.nanargmax', 'np.nanargmax', (['matrix'], {}), '(matrix)\n', (201, 209), True, 'import numpy as np\n')]