Files
lucidia-core/quantum_engine/device.py
Alexa Louise 6afdb4b148 Initial extraction from blackroad-prism-console
Lucidia Core - AI reasoning engines for specialized domains:
- Physicist (867 lines) - energy modeling, force calculations
- Mathematician (760 lines) - symbolic computation, proofs
- Geologist (654 lines) - terrain modeling, stratigraphy
- Engineer (599 lines) - structural analysis, optimization
- Painter (583 lines) - visual generation, graphics
- Chemist (569 lines) - molecular analysis, reactions
- Analyst (505 lines) - pattern recognition, insights
- Plus: architect, researcher, mediator, speaker, poet, navigator

Features:
- FastAPI wrapper with REST endpoints for each agent
- CLI with `lucidia list`, `lucidia run`, `lucidia api`
- Codex YAML configurations for agent personalities
- Quantum engine extensions

12,512 lines of Python across 91 files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 08:00:53 -06:00

33 lines
1004 B
Python

"""Device wrapper around the active quantum backend."""
from __future__ import annotations
from .backends import get_backend
from .policy import guard_env, set_seed
class Device:
"""Lightweight wrapper providing deterministic setup and QASM export."""
def __init__(
self,
n_wires: int,
bsz: int = 1,
device: str = "cpu",
seed: int | None = None,
backend: str | None = None,
) -> None:
guard_env()
set_seed(seed)
self.backend = get_backend(backend)
self.qdev = self.backend.create_device(n_wires=n_wires, bsz=bsz, device=device)
def qasm(self) -> str:
"""Return a QASM-like string of the executed operations."""
exporter = self.backend.qasm_exporter
if exporter is not None:
return exporter(self.qdev)
if hasattr(self.qdev, "qasm"):
return self.qdev.qasm()
raise RuntimeError(f"Backend {self.backend.name!r} does not support QASM export")