Skip to main content

DpMatrix

Struct DpMatrix 

Source
pub struct DpMatrix { /* private fields */ }
Expand description

SIMD-accelerated DP matrix

This matches the C++ SSEMatrix structure with the following layout:

  • Elements (cells) are packed into SSE register vectors
  • Vectors are packed into quartets (E, F, H, TMP)
  • Quartets are packed into columns

The layout is optimized for SIMD operations:

Column 0:     Column 1:     Column 2:
+----+----+  +----+----+  +----+----+
| E0 | H0 |  | E1 | H1 |  | E2 | H2 |
+----+----+  +----+----+  +----+----+
| F0 | TMP|  | F1 | TMP|  | F2 | TMP|
+----+----+  +----+----+  +----+----+

Implementations§

Source§

impl DpMatrix

Source

pub fn new() -> Self

Create a new DP matrix

Source

pub fn init(&mut self, nrow: usize, ncol: usize, nvecperrow: usize)

Initialize the matrix with the given dimensions

§Arguments
  • nrow - Number of rows (query characters + 1)
  • ncol - Number of columns (reference characters + 1)
  • nvecperrow - Number of vectors per row
Source

pub fn is_initialized(&self) -> bool

Check if the matrix is initialized

Source

pub fn clear(&mut self)

Clear the matrix

Source

pub fn ptr(&mut self) -> *mut u8

Get the matrix buffer as a pointer

Source

pub fn as_slice(&self) -> &[u8]

Get the matrix buffer as a slice

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Get the matrix buffer as a mutable slice

Source

pub fn evec_ptr(&self, row: usize, col: usize) -> usize

Get a pointer to the E vector at the given row and column

This matches the C++ evec() method.

Source

pub fn fvec_ptr(&self, row: usize, col: usize) -> usize

Get a pointer to the F vector at the given row and column

This matches the C++ fvec() method.

Source

pub fn hvec_ptr(&self, row: usize, col: usize) -> usize

Get a pointer to the H vector at the given row and column

This matches the C++ hvec() method.

Source

pub fn tmpvec_ptr(&self, row: usize, col: usize) -> usize

Get a pointer to the TMP vector at the given row and column

This matches the C++ tmpvec() method.

Source

pub fn nvecrow(&self) -> usize

Get the number of vector rows

Source

pub fn nveccol(&self) -> usize

Get the number of vector columns

Source

pub fn rowstride(&self) -> usize

Get the row stride in vectors

Source

pub fn colstride(&self) -> usize

Get the column stride in vectors

Source

pub fn size_bytes(&self) -> usize

Get the total size of the matrix in bytes

Trait Implementations§

Source§

impl Default for DpMatrix

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.