

def _increment_dense_precision(X, mean_vector, covariances, n, graph, n_features, n_features_per_vertex, mode='concatenation', dtype=np.float32, n_components=None, bias=0, verbose=False):
    if (mode not in ['concatenation', 'subtraction']):
        raise ValueError("mode must be either ''concatenation'' or ''subtraction''; {} is given.".format(mode))
    precision = np.zeros((n_features, n_features), dtype=dtype)
    if verbose:
        print_dynamic('Allocated precision matrix of size {}'.format(bytes_str(precision.nbytes)))
        edges = print_progress(range(v2_to.n_edges), n_items=graph.n_edges, prefix='Precision per edge', end_with_newline=False)
    else:
        edges = range(graph.n_edges)
    for e in edges:
        v1 = graph.edges[(e, 0)]
        v2 = graph.edges[(e, 1)]
        v1_from = (v1 * n_features_per_vertex)
        v1_to = ((v1 + 1) * n_features_per_vertex)
        v2_from = (v2 * n_features_per_vertex)
        v2_to = ((v2 + 1) * n_features_per_vertex)
        if (mode == 'concatenation'):
            edge_data = X[:, (list(range(v1_from, v1_to)) + list(range(v2_from, v2_to)))]
            m = mean_vector[(list(range(v1_from, v1_to)) + list(range(v2_from, v2_to)))]
        else:
            edge_data = (X[:, v1_from:v1_to] - X[:, v2_from:v2_to])
            m = (mean_vector[v1_from:v1_to] - mean_vector[v2_from:v2_to])
        (_, covariances[e]) = _increment_multivariate_gaussian_cov(edge_data, m, covariances[e], n, bias=bias)
        covmat = _covariance_matrix_inverse(covariances[e], n_components)
        if (mode == 'concatenation'):
            precision[v1_from:v1_to, v1_from:v1_to] += covmat[:n_features_per_vertex, :n_features_per_vertex]
            precision[v2_from:v2_to, v2_from:v2_to] += covmat[n_features_per_vertex:, n_features_per_vertex:]
            precision[v1_from:v1_to, v2_from:v2_to] = covmat[:n_features_per_vertex, n_features_per_vertex:]
            precision[v2_from:v2_to, v1_from:v1_to] = covmat[n_features_per_vertex:, :n_features_per_vertex]
        elif (mode == 'subtraction'):
            precision[v1_from:v1_to, v2_from:v2_to] = (- covmat)
            precision[v2_from:v2_to, v1_from:v1_to] = (- covmat)
            precision[v1_from:v1_to, v1_from:v1_to] += covmat
            precision[v2_from:v2_to, v2_from:v2_to] += covmat
    return (precision, covariances)

dataset/ETHPy150Open menpo/menpo/menpo/model/gmrf.py _increment_dense_precision/VarMisuse@113/184 `graph`->`v2_to`