| """ |
| FLEighConduit — Quick Smoke Test |
| Run this cell to verify the conduit is working. |
| |
| To install the geolip-core repo simply install the geolip-svae repo, which will install it automatically. |
| |
| Run this as code cell 0. |
| |
| !pip install "git+https://github.com/AbstractEyes/geolip-svae.git" |
| """ |
| import torch |
| from geolip_core.linalg import FLEighConduit, verify_parity |
|
|
| |
| B, n = 32, 4 |
| A = torch.randn(B, n, n, device='cuda') |
| A = (A + A.transpose(-1, -2)) / 2 |
|
|
| |
| solver = FLEighConduit().cuda() |
| packet = solver(A) |
|
|
| print("=" * 60) |
| print("FLEighConduit — Smoke Test") |
| print("=" * 60) |
| print(f" Input: ({B}, {n}, {n})") |
| print(f" eigenvalues: {packet.eigenvalues.shape}") |
| print(f" eigenvectors: {packet.eigenvectors.shape}") |
| print(f" char_coeffs: {packet.char_coeffs.shape}") |
| print(f" friction: {packet.friction.shape}") |
| print(f" settle: {packet.settle.shape}") |
| print(f" extraction_order: {packet.extraction_order.shape}") |
| print(f" refinement_resid: {packet.refinement_residual.shape}") |
| print() |
|
|
| |
| print("Sample patch 0:") |
| print(f" eigenvalues: {packet.eigenvalues[0].tolist()}") |
| print(f" friction: {[f'{v:.2f}' for v in packet.friction[0].tolist()]}") |
| print(f" settle: {packet.settle[0].tolist()}") |
| print(f" refine resid: {packet.refinement_residual[0].item():.2e}") |
| print() |
|
|
| |
| print("Friction stats (all patches):") |
| print(f" mean: {[f'{v:.2f}' for v in packet.friction.mean(0).tolist()]}") |
| print(f" std: {[f'{v:.2f}' for v in packet.friction.std(0).tolist()]}") |
| print(f" min: {[f'{v:.2f}' for v in packet.friction.min(0).values.tolist()]}") |
| print(f" max: {[f'{v:.2f}' for v in packet.friction.max(0).values.tolist()]}") |
| print() |
|
|
| |
| print(f"Parity with FLEigh: {verify_parity(A)}") |
| print("=" * 60) |