summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gard.spreemann@epfl.ch>2016-04-14 14:30:45 +0200
committerGard Spreemann <gard.spreemann@epfl.ch>2016-04-14 14:30:45 +0200
commit7e126c4bdf300ccc69648c8b22a745849667c50f (patch)
treee55f71fdbcf1050c53db85fd1e913c4702346a25
parentb38ee2f1dc79c03c9c100b1b33d6e2acdb13fc98 (diff)
Use symmetric matrix in example just to be safe.
-rw-r--r--README.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0ef3ef4..b98470c 100644
--- a/README.md
+++ b/README.md
@@ -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.