diff options
author | Gard Spreemann <gard.spreemann@epfl.ch> | 2016-04-14 14:30:45 +0200 |
---|---|---|
committer | Gard Spreemann <gard.spreemann@epfl.ch> | 2016-04-14 14:30:45 +0200 |
commit | 7e126c4bdf300ccc69648c8b22a745849667c50f (patch) | |
tree | e55f71fdbcf1050c53db85fd1e913c4702346a25 | |
parent | b38ee2f1dc79c03c9c100b1b33d6e2acdb13fc98 (diff) |
Use symmetric matrix in example just to be safe.
-rw-r--r-- | README.md | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -123,6 +123,10 @@ the filtration, we can either use `save_edge_list` or import numpy.ma as ma weights = np.random.uniform(0, 1, (100, 100)) + weights = (weights + weights.T)/2.0 # Symmetrize matrix (DIPHA doesn't specify + # which part of the weight matrix it actually + # uses, so be safe and symmetrize). + np.fill_diagonal(weights, 0) masked = ma.masked_greater(weights, 0.5) # All weights above 0.5 are # masked out and will not be # present in the graph, @@ -150,6 +154,10 @@ environment variables. import matplotlib.pyplot as plt weights = np.random.uniform(0, 1, (100, 100)) + weights = (weights + weights.T)/2.0 # Symmetrize matrix (DIPHA doesn't specify + # which part of the weight matrix it actually + # uses, so be safe and symmetrize). + np.fill_diagonal(weights, 0) dipharunner = dipha.DiphaRunner(2) # Compute up to 2-simplices. dipharunner.weight_matrix(weights) # See also dipharunner.masked_weight_matrix, # and dipharunner.edge_list. |