Files
lucidia-core/core/vectors.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

51 lines
1.6 KiB
Python

"""Vector mathematics helpers for Lucidia core."""
from __future__ import annotations
from dataclasses import dataclass
import math
@dataclass(frozen=True)
class Vector3:
"""Simple three dimensional vector with basic operations.
The class implements common arithmetic needed across Lucidia projects
without pulling in heavy numerical dependencies. Only operations that are
unambiguous for 3D vectors are provided. Instances are immutable so they
can be safely shared.
"""
x: float
y: float
z: float
def __add__(self, other: "Vector3") -> "Vector3":
"""Return the element-wise sum of two vectors."""
return Vector3(self.x + other.x, self.y + other.y, self.z + other.z)
def __sub__(self, other: "Vector3") -> "Vector3":
"""Return the element-wise difference of two vectors."""
return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
def __mul__(self, scalar: float) -> "Vector3":
"""Return the vector scaled by ``scalar``."""
return Vector3(self.x * scalar, self.y * scalar, self.z * scalar)
__rmul__ = __mul__
def dot(self, other: "Vector3") -> float:
"""Return the dot product with ``other``."""
return self.x * other.x + self.y * other.y + self.z * other.z
def norm(self) -> float:
"""Return the Euclidean norm of the vector."""
return math.sqrt(self.dot(self))
def as_tuple(self) -> tuple[float, float, float]:
"""Return the vector components as a tuple."""
return (self.x, self.y, self.z)
__all__ = ["Vector3"]