def doTotalOrderExperiment(N, binaryWeights = False):
I, J = np.meshgrid(np.arange(N), np.arange(N))
I = I[np.triu_indices(N, 1)]
J = J[np.triu_indices(N, 1)]
#[I, J] = [I[0:N-1], J[0:N-1]]
NEdges = len(I)
R = np.zeros((NEdges, 2))
R[:, 0] = J
R[:, 1] = I
#W = np.random.rand(NEdges)
W = np.ones(NEdges)
#Note: When using binary weights, Y is not necessarily a cocycle
Y = I - J
if binaryWeights:
Y = np.ones(NEdges)
(s, I, H) = doHodge(R, W, Y, verbose = True)
printConsistencyRatios(Y, I, H, W)
#Random flip experiment with linear order
评论列表
文章目录