pub struct MatRef<'a, T: Repr> { /* private fields */ }Expand description
Implementations§
Source§impl<'a, T: Repr> MatRef<'a, T>
impl<'a, T: Repr> MatRef<'a, T>
Sourcepub fn new<U>(repr: T, data: &'a [U]) -> Result<Self, T::Error>where
T: NewRef<U>,
pub fn new<U>(repr: T, data: &'a [U]) -> Result<Self, T::Error>where
T: NewRef<U>,
Construct a new MatRef over data.
Sourcepub fn num_vectors(&self) -> usize
pub fn num_vectors(&self) -> usize
Returns the number of rows (vectors) in the matrix.
Sourcepub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
pub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
Returns an immutable reference to the i-th row, or None if out of bounds.
Sourcepub fn to_owned(&self) -> Mat<T>where
T: NewCloned,
pub fn to_owned(&self) -> Mat<T>where
T: NewCloned,
Return a Mat with the same contents as self.
Sourcepub unsafe fn from_raw_parts(repr: T, ptr: NonNull<u8>) -> Self
pub unsafe fn from_raw_parts(repr: T, ptr: NonNull<u8>) -> Self
Construct a new MatRef over the raw pointer and representation without performing
any validity checks.
§Safety
Argument ptr must point to memory compatible with Repr::layout and pass any
validity checks required by T.
Sourcepub fn as_raw_ptr(&self) -> *const u8
pub fn as_raw_ptr(&self) -> *const u8
Return the base pointer for the MatRef.
Trait Implementations§
Source§impl<'a, 'b, const NBITS: usize, T> CompressInto<MatRef<'a, Standard<T>>, MatMut<'b, MinMaxMeta<NBITS>>> for MinMaxQuantizer
impl<'a, 'b, const NBITS: usize, T> CompressInto<MatRef<'a, Standard<T>>, MatMut<'b, MinMaxMeta<NBITS>>> for MinMaxQuantizer
Source§fn compress_into(
&self,
from: MatRef<'a, Standard<T>>,
to: MatMut<'b, MinMaxMeta<NBITS>>,
) -> Result<(), Self::Error>
fn compress_into( &self, from: MatRef<'a, Standard<T>>, to: MatMut<'b, MinMaxMeta<NBITS>>, ) -> Result<(), Self::Error>
Compress a multi-vector of full-precision vectors into a multi-vector of MinMax quantized vectors.
This method iterates row by row over the input matrix, quantizing each full-precision vector into the corresponding row of the output MinMax matrix.
§Error
Returns InputContainsNaN error if any input vector contains NaN.
§Panics
Panics if:
from.num_vectors() != to.num_vectors(): The input and output must have the same number of vectors.from.vector_dim() != self.dim(): Each input vector must have the same dimensionality as the quantizer.- The output intrinsic dimension doesn’t match
self.output_dim().
Source§type Error = InputContainsNaN
type Error = InputContainsNaN
Source§impl<const NBITS: usize> DistanceFunctionMut<QueryMatRef<'_, MinMaxMeta<NBITS>>, MatRef<'_, MinMaxMeta<NBITS>>> for MaxSim<'_>where
Unsigned: Representation<NBITS>,
InnerProduct: for<'x, 'y> PureDistanceFunction<BitSlice<'x, NBITS, Unsigned>, BitSlice<'y, NBITS, Unsigned>, MathematicalResult<u32>>,
impl<const NBITS: usize> DistanceFunctionMut<QueryMatRef<'_, MinMaxMeta<NBITS>>, MatRef<'_, MinMaxMeta<NBITS>>> for MaxSim<'_>where
Unsigned: Representation<NBITS>,
InnerProduct: for<'x, 'y> PureDistanceFunction<BitSlice<'x, NBITS, Unsigned>, BitSlice<'y, NBITS, Unsigned>, MathematicalResult<u32>>,
Source§fn evaluate(
&mut self,
query: QueryMatRef<'_, MinMaxMeta<NBITS>>,
doc: MatRef<'_, MinMaxMeta<NBITS>>,
)
fn evaluate( &mut self, query: QueryMatRef<'_, MinMaxMeta<NBITS>>, doc: MatRef<'_, MinMaxMeta<NBITS>>, )
Source§impl<T: Copy> DistanceFunctionMut<QueryMatRef<'_, Standard<T>>, MatRef<'_, Standard<T>>, Result<(), MaxSimError>> for MaxSim<'_>
impl<T: Copy> DistanceFunctionMut<QueryMatRef<'_, Standard<T>>, MatRef<'_, Standard<T>>, Result<(), MaxSimError>> for MaxSim<'_>
Source§fn evaluate(
&mut self,
query: QueryMatRef<'_, Standard<T>>,
doc: MatRef<'_, Standard<T>>,
) -> Result<(), MaxSimError>
fn evaluate( &mut self, query: QueryMatRef<'_, Standard<T>>, doc: MatRef<'_, Standard<T>>, ) -> Result<(), MaxSimError>
Source§impl<const NBITS: usize> PureDistanceFunction<QueryMatRef<'_, MinMaxMeta<NBITS>>, MatRef<'_, MinMaxMeta<NBITS>>> for Chamferwhere
Unsigned: Representation<NBITS>,
InnerProduct: for<'a, 'b> PureDistanceFunction<BitSlice<'a, NBITS, Unsigned>, BitSlice<'b, NBITS, Unsigned>, MathematicalResult<u32>>,
impl<const NBITS: usize> PureDistanceFunction<QueryMatRef<'_, MinMaxMeta<NBITS>>, MatRef<'_, MinMaxMeta<NBITS>>> for Chamferwhere
Unsigned: Representation<NBITS>,
InnerProduct: for<'a, 'b> PureDistanceFunction<BitSlice<'a, NBITS, Unsigned>, BitSlice<'b, NBITS, Unsigned>, MathematicalResult<u32>>,
fn evaluate( query: QueryMatRef<'_, MinMaxMeta<NBITS>>, doc: MatRef<'_, MinMaxMeta<NBITS>>, ) -> f32
Source§impl<T: Copy> PureDistanceFunction<QueryMatRef<'_, Standard<T>>, MatRef<'_, Standard<T>>> for Chamfer
impl<T: Copy> PureDistanceFunction<QueryMatRef<'_, Standard<T>>, MatRef<'_, Standard<T>>> for Chamfer
impl<'a, T: Copy + Repr> Copy for MatRef<'a, T>
impl<T> Send for MatRef<'_, T>
impl<T> Sync for MatRef<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MatRef<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for MatRef<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Unpin for MatRef<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for MatRef<'a, T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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