Crate metal_matrix

Crate metal_matrix 

Source
Expand description

§Metal Matrix

A high-performance linear algebra library with Metal GPU acceleration.

This library provides GPU-accelerated matrix operations using Apple’s Metal framework. It’s designed for efficient computation of common linear algebra operations like matrix multiplication, addition, subtraction, transposition, and scalar multiplication.

§Features

  • GPU-accelerated matrix operations
  • Clean, ergonomic API
  • Support for vectors as 1D matrices
  • CPU fallback implementations
  • Comprehensive error handling

§Example

use metal_matrix::{MetalContext, Matrix, matrix_multiply};
use anyhow::Result;

fn main() -> Result<()> {
    // Initialize Metal context
    let context = MetalContext::new()?;
     
    // Create matrices
    let mut a = Matrix::new(3, 2);
    let mut b = Matrix::new(2, 4);
     
    // Fill matrices with data
    // ...
     
    // Multiply matrices
    let result = matrix_multiply(&context, &a, &b)?;
     
    Ok(())
}

Re-exports§

pub use matrix::Matrix;
pub use metal_context::MetalContext;
pub use operations::*;

Modules§

kernels
Metal kernel definitions and paths
matrix
Matrix data structure and methods
metal_context
Metal context and device management
operations
Matrix operations implementation