"""
QuarterBit PyTorch Backend
==========================

Usage:
    from quarterbit import Axiom
    optimizer = Axiom(model.parameters(), lr=1e-3)

Copyright (c) 2026 Clouthier Simulation Labs. All rights reserved.
"""

# Try to use fused kernel as default
_ULTRA_AVAILABLE = False
try:
    from .ultra import AxiomUltra, AxiomGradComp, AxiomActCP, load_ultra_libs
    _libs = load_ultra_libs()
    if 'ultra' in _libs:
        Axiom = AxiomUltra
        _ULTRA_AVAILABLE = True
        __all__ = ['Axiom', 'AxiomUltra', 'AxiomGradComp', 'AxiomActCP', 'is_ultra_enabled']
    else:
        from .optim import Axiom
        __all__ = ['Axiom', 'AxiomGradComp', 'AxiomActCP', 'is_ultra_enabled']
except ImportError:
    from .optim import Axiom
    __all__ = ['Axiom', 'is_ultra_enabled']


def is_ultra_enabled() -> bool:
    """Check if AXIOM is using the fused kernel."""
    return _ULTRA_AVAILABLE
