def reconstruct_srls(edm, all_points, W=None, print_out=False, n=1, rescale=False,
                     z=None):
    """ Reconstruct point set using S(quared)R(ange)L(east)S(quares) method.
    """
    from .lateration import SRLS, get_lateration_parameters
    Y = all_points.copy()
    indices = range(n)
    for index in indices:
        anchors, w, r2 = get_lateration_parameters(all_points, indices, index,
                                                   edm, W)
        if print_out:
            print('SRLS parameters:')
            print('anchors', anchors)
            print('w', w)
            print('r2', r2)

        srls = SRLS(anchors, w, r2, rescale, z, print_out)
        if rescale:
            srls = srls[0]  # second element of output is the scale
        Y[index, :] = srls
    return Y