summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@yahoo.it>2015-05-12 00:04:24 +0100
committerKatolaZ <katolaz@yahoo.it>2015-05-12 00:04:24 +0100
commitc42c3d71ac9244ebb42e76808f0a2e1be4a67f66 (patch)
tree8df2528e155beb8402c5049b0bf03c393566f0db
parent395bc7cb5ce0ffc49a3a316d847830b1dc61085f (diff)
Removed the last dangling full matrix
-rw-r--r--python/multired.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/python/multired.py b/python/multired.py
index 0023d38..be5ddbf 100644
--- a/python/multired.py
+++ b/python/multired.py
@@ -126,7 +126,8 @@ class layer:
#K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K))
K = self.adj_matr.sum(0)
- D = K * eye(self.N)
+ D = csr_matrix((self.N, self.N))
+ D.setdiag(eye(self.N) * K.transpose())
self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K)
@@ -140,12 +141,13 @@ class layer:
#K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K))
K = self.adj_matr.sum(0)
- D = K * eye(self.N)
+ D = csr_matrix((self.N, self.N))
+ D.setdiag(eye(self.N) * K.transpose())
self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K)
self._matrix_called = True
-
+
def dump_info(self):
N, M = self.adj_matr.shape
K = self.adj_matr.nnz
@@ -178,13 +180,15 @@ class layer:
#K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K))
K = self.adj_matr.sum(0)
- D = K * eye(self.N)
+ D = csr_matrix((self.N, self.N))
+ D.setdiag(eye(self.N) * K. transpose())
self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K)
self._matrix_called = True
-
+ def dump_laplacian(self):
+ print self.laplacian
class multiplex_red: