ArrowSpaceBuilder

Struct ArrowSpaceBuilder 

Source
pub struct ArrowSpaceBuilder {
    pub prebuilt_spectral: bool,
    pub sampling: Option<SamplerType>,
    /* private fields */
}

Fields§

§prebuilt_spectral: bool§sampling: Option<SamplerType>

Implementations§

Source§

impl ArrowSpaceBuilder

Source

pub fn new() -> Self

Source

pub fn with_lambda_graph( self, eps: f64, k: usize, topk: usize, p: f64, sigma_override: Option<f64>, ) -> Self

Use this to pass λτ-graph parameters. If not called, use defaults Configure the base λτ-graph to be built from the provided data matrix:

  • eps: threshold for |Δλ| on items
  • k: optional cap on neighbors per item
  • p: weight kernel exponent
  • sigma_override: optional scale σ for the kernel (default = eps)
Source

pub fn with_synthesis(self, tau_mode: TauMode) -> Self

Optional: override the default tau policy or tau for synthetic index.

Source

pub fn with_normalisation(self, normalise: bool) -> Self

Source

pub fn with_spectral(self, compute_spectral: bool) -> Self

Optional define if building spectral matrix at building time This is expensive as requires twice laplacian computation use only on limited dataset for analysis, exploration and data QA

Source

pub fn with_sparsity_check(self, sparsity_check: bool) -> Self

Source

pub fn with_inline_sampling(self, sampling: Option<SamplerType>) -> Self

Source

pub fn with_dims_reduction(self, enable: bool, eps: Option<f64>) -> Self

Source

pub fn with_seed(self, seed: u64) -> Self

Set a custom seed for deterministic clustering. Enable sequential (deterministic) clustering. This ensures reproducible results at the cost of parallelization.

Source

pub fn build(self, rows: Vec<Vec<f64>>) -> (ArrowSpace, GraphLaplacian)

Build the ArrowSpace and the selected Laplacian (if any).

Priority order for graph selection:

  1. prebuilt Laplacian (if provided)
  2. hypergraph clique/normalized (if provided)
  3. fallback: λτ-graph-from-data (with_lambda_graph config or defaults)

Behavior:

  • If fallback (#3) is selected, synthetic lambdas are always computed using TauMode::Median unless with_synthesis was called, in which case the provided tau_mode and alpha are used.
  • If prebuilt or hypergraph graph is selected, standard Rayleigh lambdas are computed unless with_synthesis was called, in which case synthetic lambdas are computed on that graph.
Source§

impl ArrowSpaceBuilder

Trait Implementations§

Source§

impl ClusteringHeuristic for ArrowSpaceBuilder

Source§

fn compute_optimal_k( &self, rows: &[Vec<f64>], n: usize, f: usize, seed_override: Option<u64>, ) -> (usize, f64, usize)
where Self: Sync,

Compute optimal number of clusters K, squared-distance threshold radius, and estimated intrinsic dimension from NxF data matrix.
Source§

fn step1_bounds( &self, rows: &[Vec<f64>], n: usize, f: usize, base_seed: u64, ) -> (usize, usize, usize)

Source§

fn estimate_intrinsic_dimension( &self, rows: &[Vec<f64>], n: usize, f: usize, base_seed: u64, ) -> usize

Estimate intrinsic dimension via Two-NN ratio method (DETERMINISTIC).
Source§

fn step2_calinski_harabasz( &self, rows: &[Vec<f64>], k_min: usize, k_max: usize, base_seed: u64, ) -> usize
where Self: Sync,

Source§

fn calinski_harabasz_score( &self, rows: &[Vec<f64>], assignments: &[usize], k: usize, ) -> f64

Calinski-Harabasz index (parallelized).
Source§

fn compute_threshold_from_pilot( &self, rows: &[Vec<f64>], k: usize, base_seed: u64, ) -> f64

Source§

impl Default for ArrowSpaceBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ArrowSpaceBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Format ArrowSpaceBuilder as comma-separated key=value pairs (cookie-style).

Output format: “key1=value1, key2=value2, …” This format can be parsed into a HashMap<String, String> using cookie parsers or simple string splitting.

§Example
let builder = ArrowSpaceBuilder::new()
    .with_synthesis(TauMode::Median);

let config_string = builder.to_string();
println!("{}", config_string);

// Parse back to HashMap
let config_map: HashMap<String, String> = parse_builder_config(&config_string);
Source§

impl EnergyMapsBuilder for ArrowSpaceBuilder

Source§

fn build_energy( &mut self, rows: Vec<Vec<f64>>, energy_params: EnergyParams, ) -> (ArrowSpace, GraphLaplacian)

Build an ArrowSpace index using the energy-only pipeline (no cosine similarity).

This method constructs a graph-based index where edges are weighted purely by energy features: node lambda (Rayleigh quotient), dispersion (edge concentration), and Dirichlet smoothness. The pipeline completely removes cosine similarity dependence from both construction and search.

§Pipeline Stages
  1. Clustering & Projection: Runs incremental clustering with optional JL dimensionality reduction to produce a compact centroid representation.

  2. Optical Compression (optional): If energy_params.optical_tokens is set, applies 2D spatial binning with low-activation pooling inspired by DeepSeek-OCR to further compress centroids while preserving structural information.

  3. Bootstrap Laplacian L₀: Builds an initial Euclidean kNN Laplacian over centroids in the (possibly projected) feature space using neutral distance metrics.

  4. Diffusion & Sub-Centroid Generation: Applies heat-flow diffusion over L₀ to smooth the centroid manifold, then splits high-dispersion nodes along local gradients to generate sub-centroids that better capture local geometry.

  5. Energy Laplacian Construction: Builds the final graph where edge weights are computed from energy distances: d = w_λ·|Δλ| + w_G·|ΔG| + w_D·Dirichlet(Δfeatures), using parallel candidate pruning and symmetric kNN with DashMap for efficiency.

  6. Taumode Lambda Computation: Computes per-item Rayleigh quotients (lambdas) over the energy graph using the selected synthesis mode (Mean/Median/Max), enabling energy-aware ranking during search.

2x/3x slower than build(...)

Source§

fn build_energy_laplacian( &self, sub_centroids: &DenseMatrix<f64>, energy_params: &EnergyParams, ) -> (GraphLaplacian, Vec<f64>, Vec<f64>)

Build energy-distance kNN Laplacian with parallel symmetrization. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V