def cs_baseline()

in admm.py [0:0]


def cs_baseline(m, n, f, mask, mu, beta, n_iter):
    """
    Recovers an image from a subset of its frequencies without any FFTs.

    Reconstructs an m x n image from the subset f of its frequencies specified
    by mask, using ADMM as in function adm (with regularization parameter mu,
    coupling parameter beta, and number of iterations n_iter).
    Unlike function cs_fft, this cs_baseline avoids any FFTs, so runs slowly.

    _N.B._: mask[0] must be True in order to make the optimization well-posed.

    Parameters
    ----------
    m : int
        number of rows in the image being reconstructed
    n : int
        number of columns in the image being reconstructed
    f : ndarray
        potentially nonzero rows (prior to the inverse Fourier transform)
    mask : numpy.ndarray
        boolean indicators of the positions of the rows in the full m x n array
        -- note that the zero frequency entry must be True in order to make the
        optimization well-posed
    mu : float
        regularization parameter
    beta : float
        coupling parameter for the ADMM iterations
    n_iter : int
        number of ADMM iterations to conduct

    Returns
    -------
    ndarray
        reconstructed m x n image
    float
        objective value at the end of the ADMM iterations (see function adm)
    """
    assert f.shape[1] == n
    assert mask[0]
    # Sample the discrete Fourier transform.
    Kx = scipy.linalg.dft(m) / np.sqrt(m)
    Ky = scipy.linalg.dft(n) / np.sqrt(n)
    K = np.kron(Kx[mask], Ky)
    # Form the forward finite-difference matrices.
    fdx = scipy.linalg.circulant([1, -1] + [0] * (n - 2))
    fdy = scipy.linalg.circulant([1, -1] + [0] * (m - 2))
    # Form the matrix taking finite differences horizontally in an image.
    Dx = np.kron(np.eye(m), fdx)
    # Form the matrix taking finite differences vertically in an image.
    Dy = np.kron(fdy, np.eye(n))
    # Stack the horizontal and vertical finite-difference matrices.
    D = np.vstack((Dx, Dy))
    # Run n_iter iterations of ADMM with coupling beta.
    return adm(f.ravel(), K, D, mu, beta, n_iter)