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>
27 lines
503 B
Python
27 lines
503 B
Python
"""Utility metrics for quantum circuits."""
|
|
from __future__ import annotations
|
|
|
|
import torch
|
|
|
|
|
|
def expval(qdev) -> torch.Tensor:
|
|
return qdev.measure_all()
|
|
|
|
|
|
def kl_div(p: torch.Tensor, q: torch.Tensor) -> torch.Tensor:
|
|
p = p + 1e-9
|
|
q = q + 1e-9
|
|
return torch.sum(p * (torch.log(p) - torch.log(q)), dim=-1)
|
|
|
|
|
|
def energy(values: torch.Tensor) -> torch.Tensor:
|
|
return values.sum(dim=-1)
|
|
|
|
|
|
def depth(qdev) -> int:
|
|
return len(qdev.ops)
|
|
|
|
|
|
def two_qubit_count(qdev) -> int:
|
|
return 0
|