Trait custos_math::Gemm

source ·
pub trait Gemm<T, LS: Shape = (), RS: Shape = (), OS: Shape = (), D: Device = Self>: Device {
    // Required method
    fn gemm(
        &self,
        lhs: &Matrix<'_, T, D, LS>,
        rhs: &Matrix<'_, T, D, RS>
    ) -> Matrix<'_, T, Self, OS>;
}
Expand description

Matrix multiplication. Uses provided device.

Example

use custos::{CPU, Read};
use custos_math::{Matrix, Gemm};

let device = CPU::new();

let a = Matrix::from((&device, (2, 3), [1., 2., 3., 4., 5., 6.,]));
let b = Matrix::from((&device, (3, 2), [6., 5., 4., 3., 2., 1.,]));

let c: Matrix = device.gemm(&a, &b);

assert_eq!(c.read(), vec![20., 14., 56., 41.,]);

Required Methods§

source

fn gemm( &self, lhs: &Matrix<'_, T, D, LS>, rhs: &Matrix<'_, T, D, RS> ) -> Matrix<'_, T, Self, OS>

Implementors§

source§

impl<T, D, LS, RS, OS> Gemm<T, LS, RS, OS, D> for CPUwhere T: GenericBlas + Default + Copy, D: MainMemory, LS: Shape, RS: Shape, OS: Shape,

source§

impl<T: CDatatype> Gemm<T, (), (), (), OpenCL> for OpenCL

source§

impl<T: GenericBlas> Gemm<T, (), (), (), CUDA> for CUDA