summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@yahoo.it>2015-05-12 12:01:50 +0100
committerKatolaZ <katolaz@yahoo.it>2015-05-12 12:01:50 +0100
commit815c998aa757969edd25b34a8eefa8f5be4d4097 (patch)
tree2462e4ca475525c9da6fea165b43b0983e608878
parent29cc00c2d4dd86d6649d4ddd676601ecae943b6d (diff)
A better solution to remove the last few full matrices around (all of
them were in the "layer" class...)
-rw-r--r--python/multired.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/python/multired.py b/python/multired.py
index f885c12..06fbc79 100644
--- a/python/multired.py
+++ b/python/multired.py
@@ -123,13 +123,8 @@ class layer:
elif matrix != None:
self.adj_matr = copy.copy(matrix)
self.N, _x = matrix.shape
- #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).reshape((1, self.N)).tolist()[0]
D = csr_matrix((K, (range(self.N), range(self.N)) ), shape=(self.N, self.N))
- #K = self.adj_matr.sum(0)
- #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,11 +135,8 @@ class layer:
self.N = N
self.adj_matr = csr_matrix((self._ww, (self._ii, self._jj)), shape=(self.N, self.N))
self.adj_matr = self.adj_matr + self.adj_matr.transpose()
- #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).reshape((1, self.N)).tolist()[0]
D = csr_matrix((K, (range(self.N), range(self.N)) ), shape=(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)
@@ -179,13 +171,8 @@ class layer:
self.adj_matr = self.adj_matr + other_layer.adj_matr
else:
self.adj_matr = copy.copy(other_layer.adj_matr)
- #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).reshape((1, self.N)).tolist()[0]
D = csr_matrix((K, (range(self.N), range(self.N)) ), shape=(self.N, self.N))
- #K = self.adj_matr.sum(0)
- #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)