Removed the last dangling full matrix

master
KatolaZ 10 years ago
parent 395bc7cb5c
commit c42c3d71ac
  1. 14
      python/multired.py

@ -126,7 +126,8 @@ class layer:
#K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N))) #K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K)) #D = np.diag(np.diag(K))
K = self.adj_matr.sum(0) 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) self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum() K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K) 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))) #K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K)) #D = np.diag(np.diag(K))
K = self.adj_matr.sum(0) 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) self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum() K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K) self.resc_laplacian = csr_matrix(self.laplacian / K)
self._matrix_called = True self._matrix_called = True
def dump_info(self): def dump_info(self):
N, M = self.adj_matr.shape N, M = self.adj_matr.shape
K = self.adj_matr.nnz 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))) #K = np.multiply(self.adj_matr.sum(0), np.ones((self.N,self.N)))
#D = np.diag(np.diag(K)) #D = np.diag(np.diag(K))
K = self.adj_matr.sum(0) 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) self.laplacian = csr_matrix(D - self.adj_matr)
K = self.laplacian.diagonal().sum() K = self.laplacian.diagonal().sum()
self.resc_laplacian = csr_matrix(self.laplacian / K) self.resc_laplacian = csr_matrix(self.laplacian / K)
self._matrix_called = True self._matrix_called = True
def dump_laplacian(self):
print self.laplacian
class multiplex_red: class multiplex_red:

Loading…
Cancel
Save