This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1; % script file | |
function res = deleted_pivot(M, i, j) | |
% Calculates the deleted pivot of matrix M at row i, column j | |
% as described by Greg Kuperberg in "Kasteleyn cokernels" | |
% X = the jth column of M with element i removed | |
X = [M(:,j)(1:i-1); M(:,j)(i+1:end)]; | |
% Yt = the ith row of M with element j removed | |
Yt = [M(i,:)(1:j-1), M(i,:)(j+1:end)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Placed at /usr/local/bin/python | |
# Expects pylint executable at /usr/bin/pylint | |
# | |
import os | |
import sys | |
def get_python_exec(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
import numpy | |
import scipy.io | |
import scipy.linalg | |
import scipy.sparse.linalg | |
from scipy.sparse.linalg.eigen.arpack.arpack import ArpackNoConvergence | |
def reduce_from_matlab(mat_path, output_dim): | |
mat = scipy.io.loadmat(mat_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function X = graph_pca(A, k) | |
% A: the adjacency matrix of a graph | |
% k: the number of dimensions to reduce to | |
% | |
% Calculates the ECTD-preserving PCA of the graph given by A. | |
% See http://outobox.cs.umn.edu/PCA_on_a_Graph.pdf for background. | |
L = diag(sum(A)) - A; | |
Lp = pinv(L); | |
[U, E] = eigs(Lp, k); | |
X = E.^(1/2) * U'; |
NewerOlder