hybrid_wml_simulator
¶
Hybrid wave-matrix Lindbladization simulator.
HybridWMLSimulator
¶
Bases: ProductFormulaSimulator
Simulate open-system dynamics with hybrid wave-matrix Lindbladization.
Each of the num_steps samples one term. The weight of a Hamiltonian
eigenvalue λ is |λ|, and the weight of a Lindblad L is
||L||_F^2. Their sum is c. A sampled eigenvalue prepares its
eigenvector on a program register and applies exp(-i sgn(λ) SWAP Δ) on
that register and the term's qubits, with Δ = c t / num_steps, then
resets the program register. A sampled Lindblad applies
exp(-i J_L sqrt(τ)) on one ancilla and the Lindblad's qubits, with
τ = c t / (num_steps ||L||_F^2), then resets the ancilla. One seeded
sequence is frozen into the circuit and reused for every shot.
Counts come from circuit_backend. Omitting it uses Aer.
The shot count is that backend's shots attribute. Before the measurement,
each system qubit is rotated into its letter of basis (default all Z).
The ancilla and the program register are not measured. Bit i of a counts
key is system qubit i. Read those counts with :meth:measure.
With workers greater than 1, that backend is pickled into each worker process.
Each time point starts from initial_state. The term sequence and the shot
sampler are a pure function of seed and the time index, so workers=1
and a larger pool return the same counts. workers=1 (the default) runs
the points serially, in tlist order. progress(index, total) may run
in completion order when workers is greater than 1. A job from start()
counts each finished time point in completed_steps.
Source code in shadowsim/simulators/hybrid_wml_simulator.py
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 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
__init__
¶
__init__(
hamiltonians: list[LocalHamiltonian],
lindblads: list[LocalOperator],
initial_state: State,
*,
num_qubits: int,
total_time: float,
time_steps: int,
num_steps: int,
verbose: bool = False,
seed: int | None = None,
progress: ProgressCallback | None = None,
workers: int = 1,
circuit_backend: CircuitBackend | None = None,
basis: str | None = None,
) -> None
Initialize a hybrid WML simulator for the given model.
Raises:
-
TypeError–An operator has the wrong type, or
seedorworkershas the wrong type. -
ValueError–workersornum_stepsis not positive,total_timeis negative,basisis malformed, the backend has no shot budget, an operator does not act on the register, or every sampling weight is zero.
Source code in shadowsim/simulators/hybrid_wml_simulator.py
metrics_circuit
¶
metrics_circuit() -> Program
Return the program executed at the final time, including measurement.