#![no_std]
#![warn(missing_docs)]
#[cfg(feature = "std")]
extern crate std;
extern crate alloc;
use alloc::vec::Vec;
use core::mem::align_of;
pub mod types;
pub mod micronet;
pub mod projection;
pub mod integration;
#[cfg(feature = "wasm")]
pub mod wasm_bindings;
pub use types::{RootVector, RootSpace, CartanMatrix};
pub use micronet::{MicroNet, AgentState, AgentType};
pub use projection::{project_to_root, embed_from_root};
pub use integration::RuvFannBridge;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const DEFAULT_ROOT_DIMS: usize = 32;
pub const ROOT_DIM: usize = 32;
#[derive(Debug)]
pub enum Error {
InvalidInput,
ComputationError,
ResourceExhausted,
}
pub type Result<T> = core::result::Result<T, Error>;
pub trait AttentionMechanism {
fn apply_attention(&self, input: &RootVector) -> Result<RootVector>;
}
pub mod prelude {
pub use crate::{RootVector, MicroNet, AgentState, AgentType, Result, Error, ROOT_DIM, AttentionMechanism};
}
pub const SIMD_ALIGN: usize = 16;
#[cfg(feature = "std")]
pub fn initialize() -> Result<(), &'static str> {
Ok(())
}
pub fn check_simd_support() -> bool {
let has_simd = cfg!(any(
target_feature = "sse2",
target_feature = "avx",
target_feature = "avx2",
target_feature = "simd128"
));
has_simd && align_of::<RootVector>() >= SIMD_ALIGN
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_simd_alignment() {
assert!(align_of::<RootVector>() >= SIMD_ALIGN);
}
#[test]
fn test_version() {
assert!(!VERSION.is_empty());
}
}