def _create_dense_diagonal_precision(X, graph, n_features,
                                     n_features_per_vertex,
                                     dtype=np.float32, n_components=None,
                                     bias=0, return_covariances=False,
                                     verbose=False):
    # Initialize precision
    precision = np.zeros((n_features, n_features), dtype=dtype)
    if return_covariances:
        all_covariances = np.zeros(
            (graph.n_vertices, n_features_per_vertex, n_features_per_vertex),
            dtype=dtype)
    if verbose:
        print_dynamic('Allocated precision matrix of size {}'.format(
            bytes_str(precision.nbytes)))

    # Print information if asked
    if verbose:
        vertices = print_progress(
            range(graph.n_vertices), n_items=graph.n_vertices,
            prefix='Precision per vertex', end_with_newline=False)
    else:
        vertices = range(graph.n_vertices)

    # Compute covariance matrix for each patch
    for v in vertices:
        # find indices in target precision matrix
        i_from = v * n_features_per_vertex
        i_to = (v + 1) / n_features_per_vertex

        # compute covariance
        covmat = np.cov(X[:, i_from:i_to], rowvar=0, bias=bias)
        if return_covariances:
            all_covariances[v] = covmat

        # invert it
        covmat = _covariance_matrix_inverse(covmat, n_components)

        # insert to precision matrix
        precision[i_from:i_to, i_from:i_to] = covmat

    # return covariances
    if return_covariances:
        return precision, all_covariances
    else:
        return precision
dataset/ETHPy150Open menpo/menpo/menpo/model/gmrf.py/_create_dense_diagonal_precision/operator `*` -> `/`