26 lines
923 B
Python
26 lines
923 B
Python
|
|
"""subblock.py -- extract the "fully active" 9x9 sub-block M_{S->S^c} (both source and
|
||
|
|
target sectors fully active, i.e. every party involved) from the full bigraduated
|
||
|
|
cluster map. This is Corollary "sub-block witnesses" specialized to V=S, T=S^c."""
|
||
|
|
import numpy as np
|
||
|
|
|
||
|
|
|
||
|
|
def fully_active_block(C, s0, s1):
|
||
|
|
others = [k for k in range(4) if k not in (s0, s1)]
|
||
|
|
c0, c1 = others
|
||
|
|
M = np.zeros((9, 9))
|
||
|
|
rows = [(i, j) for i in [1, 2, 3] for j in [1, 2, 3]]
|
||
|
|
cols = [(i, j) for i in [1, 2, 3] for j in [1, 2, 3]]
|
||
|
|
for ri, (ia, ib) in enumerate(rows):
|
||
|
|
for ci, (ic, idd) in enumerate(cols):
|
||
|
|
idx = [0, 0, 0, 0]
|
||
|
|
idx[s0] = ia
|
||
|
|
idx[s1] = ib
|
||
|
|
idx[c0] = ic
|
||
|
|
idx[c1] = idd
|
||
|
|
M[ri, ci] = C[tuple(idx)]
|
||
|
|
return M / 3.0 # same normalization convention as cluster.cluster_map
|
||
|
|
|
||
|
|
|
||
|
|
def nuc(M):
|
||
|
|
return np.linalg.svd(M, compute_uv=False).sum()
|