feat: add numeric and symbolic scripts
This commit is contained in:
parent
6ea7900b55
commit
e80b7c3582
38 changed files with 3314 additions and 0 deletions
25
scripts/subblock.py
Normal file
25
scripts/subblock.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue