feat: add numeric and symbolic scripts
This commit is contained in:
parent
6ea7900b55
commit
e80b7c3582
38 changed files with 3314 additions and 0 deletions
18
scripts/party_blocks.py
Normal file
18
scripts/party_blocks.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"""party_blocks.py -- extract the raw (unnormalized) single-party-to-single-party 3x3
|
||||
correlation blocks M_{a->b} from the Pauli correlation tensor."""
|
||||
import numpy as np
|
||||
|
||||
|
||||
def party_block(C, a, b):
|
||||
M = np.zeros((3, 3))
|
||||
for i, ia in enumerate([1, 2, 3]):
|
||||
for j, ib in enumerate([1, 2, 3]):
|
||||
idx = [0, 0, 0, 0]
|
||||
idx[a] = ia
|
||||
idx[b] = ib
|
||||
M[i, j] = C[tuple(idx)]
|
||||
return M
|
||||
|
||||
|
||||
def nuc(M):
|
||||
return np.linalg.svd(M, compute_uv=False).sum()
|
||||
Loading…
Add table
Add a link
Reference in a new issue