compile
Compilation of ZX graphs into JAX-compatible data structures.
CompiledScalarGraphs
Bases: Module
flowchart TD
tsim.compile.compile.CompiledScalarGraphs[CompiledScalarGraphs]
click tsim.compile.compile.CompiledScalarGraphs href "" "tsim.compile.compile.CompiledScalarGraphs"
JAX-compatible compiled representation of a list of scalar ZX graphs.
The scalar for each graph is a product of four term families, multiplied by a per-graph ScalarPrefactor (global phase, floatfactor, 2^power2, optional approximate complex floatfactor). All arrays are static-shaped so the whole struct can be traced under jax.jit.
compile_scalar_graphs
compile_scalar_graphs(
g_list: list[BaseGraph], params: list[str]
) -> CompiledScalarGraphs
Compile ZX-graph list into JAX-compatible structure for fast evaluation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
g_list | list[BaseGraph] | List of ZX-graphs to compile (must be scalar graphs with no vertices) | required |
params | list[str] | List of parameter names used by this circuit. Each parameter will correspond to columns in the jax.Arrays of the compiled circuit. | required |
Returns:
| Type | Description |
|---|---|
CompiledScalarGraphs | CompiledScalarGraphs with all data in static-shaped JAX arrays |
Source code in src/tsim/compile/compile.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |