Skip to main content

MaxSimElement

Trait MaxSimElement 

Source
pub trait MaxSimElement:
    Sealed
    + Sized
    + Copy
    + Send
    + Sync
    + 'static {
    type Score: Copy + Default + PartialEq + Debug;

    const NO_MATCH: Self::Score;

    // Required method
    fn build<E: Erase<Self>>(
        isa: MaxSimIsa,
        query: MatRef<'_, Standard<Self>>,
        erase: E,
    ) -> Result<E::Output, BuildMaxSimError>;
}
Expand description

Scalar element types accepted by build_max_sim.

Sealed: external crates cannot add impls. Quantized representations (PQ, SQ, packed sub-byte) are intentionally excluded — they need codebook/scale state that MatRef<'_, Standard<Self>> can’t carry.

Required Associated Constants§

Source

const NO_MATCH: Self::Score

Score written for every query row when the document set is empty.

Required Associated Types§

Source

type Score: Copy + Default + PartialEq + Debug

Score produced per query row: f32 for floating-point elements, i32 for i8 where the inner product is exact.

Required Methods§

Source

fn build<E: Erase<Self>>( isa: MaxSimIsa, query: MatRef<'_, Standard<Self>>, erase: E, ) -> Result<E::Output, BuildMaxSimError>

Build the concrete kernel for this element type and hand it to erase.erase(...).

§Errors

Returns BuildMaxSimError::NotSupported when the requested ISA cannot run on this build (e.g. AVX-512 unavailable; aarch64 on x86_64), and BuildMaxSimError::DimTooLarge when an i8 query has more than 131_071 dimensions, beyond which i32 scores could overflow.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MaxSimElement for f16

Source§

const NO_MATCH: f32 = f32::MAX

Source§

type Score = f32

Source§

fn build<E: Erase<f16>>( isa: MaxSimIsa, query: MatRef<'_, Standard<f16>>, erase: E, ) -> Result<E::Output, BuildMaxSimError>

Source§

impl MaxSimElement for f32

Source§

const NO_MATCH: f32 = f32::MAX

Source§

type Score = f32

Source§

fn build<E: Erase<f32>>( isa: MaxSimIsa, query: MatRef<'_, Standard<f32>>, erase: E, ) -> Result<E::Output, BuildMaxSimError>

Source§

impl MaxSimElement for i8

Source§

const NO_MATCH: i32 = i32::MAX

Source§

type Score = i32

Source§

fn build<E: Erase<i8>>( isa: MaxSimIsa, query: MatRef<'_, Standard<i8>>, erase: E, ) -> Result<E::Output, BuildMaxSimError>

Implementors§