Datasets:
Formats:
csv
Languages:
English
Size:
1K - 10K
Tags:
mathematics
inverse-problems
observability
noncommutative-algebra
symbolic-computation
calibration-rigidity
Download tests/test_determinants.py from PureOne/AELYRION-NOULITH-III: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/PureOne/AELYRION-NOULITH-III/resolve/main/tests/test_determinants.py
- Command line
-
hf download hf://datasets/PureOne/AELYRION-NOULITH-III/tests/test_determinants.py
-
curl -L -o test_determinants.py https://huggingface.co/datasets/PureOne/AELYRION-NOULITH-III/resolve/main/tests/test_determinants.py
1.57 kB
| """Independent dense-minor checks of the split determinantal formula.""" | |
| from itertools import combinations | |
| import sympy as sp | |
| import pytest | |
| from noulith.ideals import equal_polynomial_ideals | |
| def minors(matrix, k): | |
| if k == 0: | |
| return [sp.Integer(1)] | |
| return [matrix.extract(rows, cols).det() | |
| for rows in combinations(range(matrix.rows), k) | |
| for cols in combinations(range(matrix.cols), k)] | |
| def test_split_ideal_dense_minors(k): | |
| a,b,c=sp.symbols('a b c') | |
| matrix=sp.Matrix([[1,0,0], [0,a,0], [0,b,0], [0,0,c]]) | |
| expected=([1], [1], [a,b,c], [a*c,b*c])[k] | |
| assert equal_polynomial_ideals(minors(matrix,k), expected, (a,b,c)) | |
| def test_univariate_determinantal_orders(k,order): | |
| t=sp.symbols('t') | |
| matrix=sp.diag(1,t**2,t**3) | |
| polynomials=[sp.Poly(x,t) for x in minors(matrix,k) if x!=0] | |
| actual=min(min(monomial[0] for monomial,coefficient in p.terms()) for p in polynomials) | |
| assert actual==order | |
| def test_four_channel_quadrics_and_carriers(): | |
| x,y,z=sp.symbols('x y z') | |
| pairs=[x*(z-y), y*(z-x), z*(y-x)] | |
| quadrics=[x*y-x*z,x*y-y*z] | |
| assert equal_polynomial_ideals(pairs,quadrics,(x,y,z)) | |
| carriers=[x*x-x*y,y*y-x*y,z*z-x*y,x*y] | |
| t=sp.symbols('t') | |
| branches=[(t,0,0),(0,t,0),(0,0,t),(t,t,t)] | |
| restrictions=sp.Matrix([[sp.expand(f.subs(dict(zip((x,y,z),branch)), simultaneous=True)) | |
| for f in carriers] for branch in branches]) | |
| assert restrictions==t**2*sp.eye(4) | |