custos_math/matrix/
impl_with_shape.rs

1use custos::{Buffer, Device, Dim2, WithShape};
2
3use crate::Matrix;
4
5impl<'a, T, D, C, const B: usize, const A: usize> WithShape<&'a D, C>
6    for Matrix<'a, T, D, Dim2<B, A>>
7where
8    D: Device,
9    Buffer<'a, T, D, Dim2<B, A>>: WithShape<&'a D, C>,
10{
11    fn with(device: &'a D, array: C) -> Self {
12        let data = Buffer::with(device, array);
13        Matrix { data, dims: (B, A) }
14    }
15}
16
17//impl<'a, T, D>
18
19/*
20#[cfg(test)]
21mod tests {
22
23    #[cfg(feature = "cpu")]
24    #[test]
25    fn test_with() {
26        use custos::{Dim2, WithShape, CPU};
27
28        use crate::Matrix;
29
30        let device = CPU::new();
31
32        let mat = Matrix::<_, _, Dim2<1, 3>>::with(&device, [3, 2, 5]);
33    }
34}
35*/