LocalAhsSimulator¶
from cascaqit import LocalAhsSimulator
LocalAhsSimulator ¶
LocalAhsSimulator(
target: TargetSpec | None = None,
seed: int | None = None,
time_steps: int = 400,
created_at: str | None = None,
)
Small AHS reference simulator using state-vector evolution with fixed-step RK4. Its current kernel supports at most 4 active atoms. A target specification allowing more atoms does not increase that limit. time_steps defaults to 400; increase it to check convergence independently of sampling shots.
With target=None, global controls use the conservative mock target; local detuning or local Rabi controls select the local_ahs target. Seed controls sampling, and created_at can fix result timestamps. The target is used only for local constraint checks.
from cascaqit import AHSProgram, AtomRegister, LocalAhsSimulator, Waveform
program = AHSProgram(AtomRegister.line(count=1, spacing=5.0))
program.drive(rabi=Waveform.constant(0.0, duration=1.0),
detuning=Waveform.constant(0.0, duration=1.0),
phase=Waveform.constant(0.0, duration=1.0, value_unit="rad"))
program.measure()
result = LocalAhsSimulator(seed=7).run(program, shots=32)
assert result.counts == {"0": 32}
Use LocalBackend for larger jobs with resource planning.
run ¶
run(
program: ProgramIR | _ProgramLike | _BuilderLike,
*,
shots: int = 1000,
config: SimulatorConfigIR | None = None,
) -> ResultIR
Synchronously accept ProgramIR or an exportable wrapper/builder and return ResultIR. Target validation precedes evolution and sampling. If config is supplied, its complete SimulatorConfigIR replaces defaults from shots and the constructor seed. shots=0 returns no sampled counts. Target-validation failures return error diagnostics with an empty result; export, algorithm-selection and kernel-size failures can also raise exceptions.