Skip to main content

ComputeView

Trait ComputeView 

Source
pub trait ComputeView {
    type Element;
    type Arch: SimdArch;
    type Backend;

    // Required method
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Top-level trait abstracting over dense, masked, sparse, tiled, and bitboard backends.

Sealed via the SimdArch bound (which requires crate::private::Sealed). All implementations in this workspace are registered here; external crates cannot implement ComputeView without also implementing SimdArch (which is sealed).

§Examples

Query the length of a dense SimdView through the ComputeView facade:

use hermes_simd_core::compute::ComputeView;
use hermes_simd_core::view::SimdView;
use hermes_simd_intrinsics::Scalar;
use hermes_simd_core::align::Unaligned;
use hermes_simd_core::execution::Unmasked;

let data = [1.0_f32; 16];
let view: SimdView<'_, f32, Scalar, Unaligned, Unmasked, &[f32]> =
    SimdView::new(&data).unwrap();
assert_eq!(view.len(), 16);
assert!(!view.is_empty());

Required Associated Types§

Source

type Element

Scalar element type of the view (e.g. f32, f64, u64).

Source

type Arch: SimdArch

SIMD architecture ZST marker.

Source

type Backend

Backend/format/execution mode selection marker.

  • Dense SimdView: Mode (e.g. Unmasked, Masked)
  • SparseView: Format (e.g. Csr, SellP<4>)
  • BitBoardView: Backend (e.g. KoggeStone)

Required Methods§

Source

fn len(&self) -> usize

Returns the logical size of the view.

  • SimdView: element count
  • SparseView: row count (nrows())
  • BitBoardView: board element count

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the view contains no elements.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<'a, Backend, Arch, Ref> ComputeView for BitBoardView<'a, Backend, Arch, Ref>
where Arch: SimdArch, Ref: 'a,

Source§

type Element = u64

Source§

type Arch = Arch

Source§

type Backend = Backend

Source§

impl<'a, T, Arch, Align, Mode, Ref> ComputeView for SimdView<'a, T, Arch, Align, Mode, Ref>
where Arch: SimdArch, Align: Alignment, Mode: ExecutionMode, Ref: 'a,

Source§

type Element = T

Source§

type Arch = Arch

Source§

type Backend = Mode

Source§

impl<'a, T, Format, Arch> ComputeView for SparseView<'a, T, Format, Arch>
where Format: SparseFormat, Arch: SimdArch,

Source§

type Element = T

Source§

type Arch = Arch

Source§

type Backend = Format