Skip to content

Naive BLA&DSP Subprogram Implementation #39

@Mitchelldscott

Description

@Mitchelldscott

This issue covers the implementation of a "naive", pure Rust backend for the API traits defined in #38.

The primary goal is to provide a reference implementation that is no_std compatible, memory-safe, and heap-free. This backend will serve as the foundation for embedded systems use cases and act as a correctness baseline for other, more optimized backends. ⚙️

Tasks & Acceptance Criteria
A pull request resolving this issue should deliver the following:

  • 1. Create no_std Static Storage Types:
  • Implement StaticVec<T, const N: usize> and StaticMat<T, const M: usize, const N: usize>.
  • These types must use const generics for compile-time sizing.
  • They should be simple wrappers around arrays (e.g., pub struct StaticVec<T, const N: usize>([T; N]);).
  • They must derive common traits like Copy, Clone, Debug, PartialEq.
  • 2. Implement Base Storage Traits:
  • Implement the Vector trait for StaticVec.
  • Implement the Matrix trait for StaticMat.
  • 3. Implement BLAS Level 1 Traits for StaticVec:
  • impl Axpy for StaticVec
  • impl Dot for StaticVec
  • impl Nrm2 for StaticVec
  • impl Asum for StaticVec
  • impl Scal for StaticVec
  • 4. Implement BLAS Level 2 & 3 Traits for StaticMat:
  • impl Gemv for StaticMat (Matrix-Vector multiplication)
  • impl Gemm for StaticMat (Matrix-Matrix multiplication)

[ ] 5. Implement DSP Trait for StaticVec:

  • impl Conv for StaticVec (1D Convolution)

Implementation Guidelines

  • no_std Compatibility: The entire module must be able to compile under #![no_std]. Avoid any dependency that requires the standard library or an allocator.
  • 100% Safe Rust: This reference implementation must not use any unsafe code blocks. Correctness and safety are the top priorities.
  • Correctness over Performance: The goal here is a straightforward, easy-to-verify implementation. Performance optimizations (like SIMD) will be handled in separate, specialized backends.
  • Testing: Every implemented trait method must have a corresponding unit test to validate its correctness with known inputs and outputs. For example, test matrix multiplication with an identity matrix. Add tests for edge cases like zero-sized vectors/matrices if the design supports them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions