pub trait AssignOps<T, S: Shape = (), D: Device = Self>: Device {
// Required methods
fn add_assign(
&self,
lhs: &mut Buffer<'_, T, Self, S>,
rhs: &Buffer<'_, T, D, S>,
);
fn sub_assign(
&self,
lhs: &mut Buffer<'_, T, Self, S>,
rhs: &Buffer<'_, T, D, S>,
);
fn mul_assign(
&self,
lhs: &mut Buffer<'_, T, Self, S>,
rhs: &Buffer<'_, T, D, S>,
);
}Expand description
Assignment operations
§Examples
use custos::{CPU, Read};
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], lhs.read());
device.sub_assign(&mut lhs, &rhs);
assert_eq!(vec![3, 5, 4, 1], lhs.read());Required Methods§
Sourcefn add_assign(
&self,
lhs: &mut Buffer<'_, T, Self, S>,
rhs: &Buffer<'_, T, D, S>,
)
fn add_assign( &self, lhs: &mut Buffer<'_, T, Self, S>, rhs: &Buffer<'_, T, D, S>, )
Add assign
§Examples
use custos::{CPU, Read};
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], lhs.read());
device.sub_assign(&mut lhs, &rhs);
assert_eq!(vec![3, 5, 4, 1], lhs.read());fn sub_assign( &self, lhs: &mut Buffer<'_, T, Self, S>, rhs: &Buffer<'_, T, D, S>, )
fn mul_assign( &self, lhs: &mut Buffer<'_, T, Self, S>, rhs: &Buffer<'_, T, D, S>, )
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.