def wigner_d_transform_analysis_vectorized(f, wd_flat, idxs):
    """ computes the wigner transform analysis in a vectorized way
    returns the flattened blocks of f_hat as a single vector

    f: the input signal, shape (2b, 2b, 2b) axes m, beta, n.
    wd_flat: the flattened weighted wigner d functions, shape (num_spectral, 2b), axes (l*m*n, beta)
    idxs: the array of indices containing all analysis blocks
    """
    f_trans = f.transpose([0, 2, 1])
    f_trans_flat = f_trans.reshape(-1, f.shape[1])
    f_i = f_trans_flat[idxs]
    prod = f_i * wd_flat
    result = prod.sum(axis=1)
    return result
