pub trait AssignOps<T> {
    fn add_assign(&self, lhs: &mut Buffer<'_, T>, rhs: &Buffer<'_, T>);
    fn sub_assign(&self, lhs: &mut Buffer<'_, T>, rhs: &Buffer<'_, T>);
}
Expand description

Assignment operations

Examples

use custos::{CPU, VecRead};
use custos_math::{Matrix, AssignOps};

let device = CPU::new();
let mut lhs = Matrix::from((&device, 2, 2, [3, 5, 4, 1]));
let rhs = Matrix::from((&device, 2, 2, [1, 8, 6, 2]));

device.add_assign(&mut lhs, &rhs);
assert_eq!(vec![4, 13, 10, 3], device.read(lhs.as_buf()));

device.sub_assign(&mut lhs, &rhs);
assert_eq!(vec![3, 5, 4, 1], device.read(lhs.as_buf()));

Required Methods

Add assign

Examples
use custos::{CPU, VecRead};
use custos_math::{Matrix, AssignOps};

let device = CPU::new();
let mut lhs = Matrix::from((&device, 2, 2, [3, 5, 4, 1]));
let rhs = Matrix::from((&device, 2, 2, [1, 8, 6, 2]));

device.add_assign(&mut lhs, &rhs);
assert_eq!(vec![4, 13, 10, 3], device.read(lhs.as_buf()));

device.sub_assign(&mut lhs, &rhs);
assert_eq!(vec![3, 5, 4, 1], device.read(lhs.as_buf()));

Implementations on Foreign Types

Implementors