Struct Matrix

Source
pub struct Matrix<const N: usize, const M: usize, Array, T>(pub Array, pub PhantomData<T>)
where
    Array: Into<[T; { _ }]> + Index<usize>;
Expand description

Matrix M[N x M]

Tuple Fields§

§0: Array§1: PhantomData<T>

Implementations§

Source§

impl<const N: usize, const M: usize, Array, T> Matrix<N, M, Array, T>
where Array: Into<[T; { _ }]> + Index<usize>,

Source

pub fn new(array: Array) -> Self

generate Matrix

Examples found in repository?
examples/main.rs (lines 9-12)
7fn main() {
8    // A + B in stack
9    let left = Matrix::<2, 3, _, i32>::new([
10        1, 2, 3, //
11        4, 5, 6,
12    ]);
13    let right = Matrix::<2, 3, _, i32>::new([
14        1, 2, 3, //
15        4, 5, 6,
16    ]);
17    assert_eq!(
18        left + right,
19        Matrix::<2, 3, _, i32>::new([
20            2, 4, 6, //
21            8, 10, 12
22        ])
23    );
24
25    // A + B in heap
26    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
27        1, 2, 3, //
28        4, 5, 6,
29    ])));
30    let right = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
31        1, 2, 3, //
32        4, 5, 6,
33    ])));
34    assert_eq!(
35        left + right,
36        Matrix::<2, 3, _, i32>::new([
37            2, 4, 6, //
38            8, 10, 12
39        ])
40    );
41
42    // A in heap + B in stack
43    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
44        1, 2, 3, //
45        4, 5, 6,
46    ])));
47    let right = Matrix::<2, 3, _, i32>::new([
48        1, 2, 3, //
49        4, 5, 6,
50    ]);
51    assert_eq!(
52        left + right,
53        Matrix::<2, 3, _, i32>::new([
54            2, 4, 6, //
55            8, 10, 12
56        ])
57    );
58
59    // A * B
60    let left = Matrix::<2, 3, _, u32>::new([
61        3, 7, 2, //
62        2, 4, 3,
63    ]);
64    let right = Matrix::<3, 3, _, u32>::new([
65        2, 1, 4, //
66        9, 2, 7, //
67        8, 3, 2,
68    ]);
69    assert_eq!(
70        left * right,
71        Matrix::<2, 3, _, u32>::new([
72            85, 23, 65, //
73            64, 19, 42
74        ])
75    );
76
77    // LU decomposition
78    let matrix = Matrix::<10, 10, _, f64>::new([
79        3.4, 5.3, 2.4, 4.7, 7.89, 3.2, 3.5, 2.1324, 3.0, 3.4, //
80        1.4, 5.4, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
81        2.4, 5.5, 2.4, 4.7, 7.89, 3.2, 2.5, 2.1324, 3.0, 3.4, //
82        3.4, 5.6, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
83        3.4, 5.9, 2.4, 4.7, 7.89, 3.2, 5.5, 2.1324, 3.0, 3.4, //
84        5.4, 4.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
85        6.4, 3.3, 2.4, 4.7, 7.89, 3.2, 7.5, 2.1324, 3.0, 3.4, //
86        7.4, 1.3, 2.4, 4.7, 7.89, 3.2, 9.5, 2.1324, 3.0, 3.4, //
87        8.4, 2.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
88        9.4, 3.3, 2.4, 4.7, 7.89, 3.2, 1.5, 2.1324, 3.0, 3.4, //
89    ]);
90    let (l, u) = matrix.lu_decomposition();
91    let diff = matrix - l * u;
92    diff.map::<_, _, [(); 10 * 10]>(|e| assert!(e.abs() < 1e-10));
93
94    // Solve Ax = b with Gaussian elimination
95    //
96    // 2a + 2b - 4c + 5d = 16
97    //  a +  b +  c +  d = 10
98    // -a + 2b - 3c -  d = -2
99    //  a + 2b + 3c - 4d = -2
100    //
101    // (a, b, c, d) = (1, 2, 3, 4)
102    let a = Matrix::<4, 4, _, f64>::new([
103        2.0, 3.0, -4.0, 5.0, //
104        1.0, 1.0, 1.0, 1.0, //
105        -1.0, 2.0, -3.0, 1.0, //
106        1.0, 2.0, 3.0, -4.0,
107    ]);
108    let b = Matrix::<4, 1, _, f64>::new([
109        16.0, //
110        10.0, //
111        -2.0, //
112        -2.0,
113    ]);
114    let x = solve_eqn(a, b);
115    assert!((1.0 - x.0[0]).abs() < 1e-10);
116    assert!((2.0 - x.0[1]).abs() < 1e-10);
117    assert!((3.0 - x.0[2]).abs() < 1e-10);
118    assert!((4.0 - x.0[3]).abs() < 1e-10);
119}
Source§

impl<const N: usize, const M: usize, Slice, T> Matrix<N, M, Slice, T>
where Slice: Into<[T; { _ }]> + Index<usize, Output = T>, T: Clone,

Source

pub fn map<U, F, Array>(self, f: F) -> Matrix<N, M, Array, U>
where F: Fn(T) -> U, U: Copy, Array: Into<[U; { _ }]> + Index<usize> + From<[U; { _ }]>,

Apply f to all value

§Examples
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use dntk_matrix::matrix::Matrix;

let matrix = Matrix::<4, 3, _, u32>::new([
   1, 2, 3, //
   4, 5, 6, //
   7, 8, 9, //
   10, 11, 12,
]);
assert_eq!(
   matrix.clone().map::<_, _, [u32; 4 * 3]>(|e| 2 * e),
   matrix * 2
)
Examples found in repository?
examples/main.rs (line 92)
7fn main() {
8    // A + B in stack
9    let left = Matrix::<2, 3, _, i32>::new([
10        1, 2, 3, //
11        4, 5, 6,
12    ]);
13    let right = Matrix::<2, 3, _, i32>::new([
14        1, 2, 3, //
15        4, 5, 6,
16    ]);
17    assert_eq!(
18        left + right,
19        Matrix::<2, 3, _, i32>::new([
20            2, 4, 6, //
21            8, 10, 12
22        ])
23    );
24
25    // A + B in heap
26    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
27        1, 2, 3, //
28        4, 5, 6,
29    ])));
30    let right = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
31        1, 2, 3, //
32        4, 5, 6,
33    ])));
34    assert_eq!(
35        left + right,
36        Matrix::<2, 3, _, i32>::new([
37            2, 4, 6, //
38            8, 10, 12
39        ])
40    );
41
42    // A in heap + B in stack
43    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
44        1, 2, 3, //
45        4, 5, 6,
46    ])));
47    let right = Matrix::<2, 3, _, i32>::new([
48        1, 2, 3, //
49        4, 5, 6,
50    ]);
51    assert_eq!(
52        left + right,
53        Matrix::<2, 3, _, i32>::new([
54            2, 4, 6, //
55            8, 10, 12
56        ])
57    );
58
59    // A * B
60    let left = Matrix::<2, 3, _, u32>::new([
61        3, 7, 2, //
62        2, 4, 3,
63    ]);
64    let right = Matrix::<3, 3, _, u32>::new([
65        2, 1, 4, //
66        9, 2, 7, //
67        8, 3, 2,
68    ]);
69    assert_eq!(
70        left * right,
71        Matrix::<2, 3, _, u32>::new([
72            85, 23, 65, //
73            64, 19, 42
74        ])
75    );
76
77    // LU decomposition
78    let matrix = Matrix::<10, 10, _, f64>::new([
79        3.4, 5.3, 2.4, 4.7, 7.89, 3.2, 3.5, 2.1324, 3.0, 3.4, //
80        1.4, 5.4, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
81        2.4, 5.5, 2.4, 4.7, 7.89, 3.2, 2.5, 2.1324, 3.0, 3.4, //
82        3.4, 5.6, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
83        3.4, 5.9, 2.4, 4.7, 7.89, 3.2, 5.5, 2.1324, 3.0, 3.4, //
84        5.4, 4.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
85        6.4, 3.3, 2.4, 4.7, 7.89, 3.2, 7.5, 2.1324, 3.0, 3.4, //
86        7.4, 1.3, 2.4, 4.7, 7.89, 3.2, 9.5, 2.1324, 3.0, 3.4, //
87        8.4, 2.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
88        9.4, 3.3, 2.4, 4.7, 7.89, 3.2, 1.5, 2.1324, 3.0, 3.4, //
89    ]);
90    let (l, u) = matrix.lu_decomposition();
91    let diff = matrix - l * u;
92    diff.map::<_, _, [(); 10 * 10]>(|e| assert!(e.abs() < 1e-10));
93
94    // Solve Ax = b with Gaussian elimination
95    //
96    // 2a + 2b - 4c + 5d = 16
97    //  a +  b +  c +  d = 10
98    // -a + 2b - 3c -  d = -2
99    //  a + 2b + 3c - 4d = -2
100    //
101    // (a, b, c, d) = (1, 2, 3, 4)
102    let a = Matrix::<4, 4, _, f64>::new([
103        2.0, 3.0, -4.0, 5.0, //
104        1.0, 1.0, 1.0, 1.0, //
105        -1.0, 2.0, -3.0, 1.0, //
106        1.0, 2.0, 3.0, -4.0,
107    ]);
108    let b = Matrix::<4, 1, _, f64>::new([
109        16.0, //
110        10.0, //
111        -2.0, //
112        -2.0,
113    ]);
114    let x = solve_eqn(a, b);
115    assert!((1.0 - x.0[0]).abs() < 1e-10);
116    assert!((2.0 - x.0[1]).abs() < 1e-10);
117    assert!((3.0 - x.0[2]).abs() < 1e-10);
118    assert!((4.0 - x.0[3]).abs() < 1e-10);
119}
Source§

impl<const N: usize, const M: usize, T: Copy> Matrix<N, M, [T; { _ }], T>
where [T; { _ }]: Into<[T; { _ }]> + Index<usize, Output = T>,

Source

pub fn transpose(self) -> Matrix<M, N, [T; { _ }], T>

A^t

§Examples
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use dntk_matrix::matrix::Matrix;

let matrix = Matrix::<4, 3, _, u32>::new([
    1, 2, 3, //
    4, 5, 6, //
    7, 8, 9, //
    10, 11, 12
]);
assert_eq!(
    matrix.transpose(),
    Matrix::<3, 4, _, u32>::new([
        1, 4, 7, 10, //
        2, 5, 8, 11, //
        3, 6, 9, 12
    ])
);
Source§

impl<const N: usize, Slice, F: Float> Matrix<N, N, Slice, F>
where Slice: Into<[F; { _ }]> + From<[F; { _ }]> + Index<usize, Output = F> + IndexMut<usize, Output = F> + Clone,

Source

pub fn lu_decomposition(&self) -> (Self, Self)

LU decomposition

§Examples
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use dntk_matrix::matrix::Matrix;

let matrix = Matrix::<4, 4, _, f64>::new([
    2.0, 3.0, -4.0, 5.0, //
    1.0, 1.0, 1.0, 1.0, //
    -1.0, 2.0, -3.0, 1.0, //
    1.0, 2.0, 3.0, -4.0,
]);
let (l, u) = matrix.lu_decomposition();

assert_eq!(l * u, matrix);
Examples found in repository?
examples/main.rs (line 90)
7fn main() {
8    // A + B in stack
9    let left = Matrix::<2, 3, _, i32>::new([
10        1, 2, 3, //
11        4, 5, 6,
12    ]);
13    let right = Matrix::<2, 3, _, i32>::new([
14        1, 2, 3, //
15        4, 5, 6,
16    ]);
17    assert_eq!(
18        left + right,
19        Matrix::<2, 3, _, i32>::new([
20            2, 4, 6, //
21            8, 10, 12
22        ])
23    );
24
25    // A + B in heap
26    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
27        1, 2, 3, //
28        4, 5, 6,
29    ])));
30    let right = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
31        1, 2, 3, //
32        4, 5, 6,
33    ])));
34    assert_eq!(
35        left + right,
36        Matrix::<2, 3, _, i32>::new([
37            2, 4, 6, //
38            8, 10, 12
39        ])
40    );
41
42    // A in heap + B in stack
43    let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
44        1, 2, 3, //
45        4, 5, 6,
46    ])));
47    let right = Matrix::<2, 3, _, i32>::new([
48        1, 2, 3, //
49        4, 5, 6,
50    ]);
51    assert_eq!(
52        left + right,
53        Matrix::<2, 3, _, i32>::new([
54            2, 4, 6, //
55            8, 10, 12
56        ])
57    );
58
59    // A * B
60    let left = Matrix::<2, 3, _, u32>::new([
61        3, 7, 2, //
62        2, 4, 3,
63    ]);
64    let right = Matrix::<3, 3, _, u32>::new([
65        2, 1, 4, //
66        9, 2, 7, //
67        8, 3, 2,
68    ]);
69    assert_eq!(
70        left * right,
71        Matrix::<2, 3, _, u32>::new([
72            85, 23, 65, //
73            64, 19, 42
74        ])
75    );
76
77    // LU decomposition
78    let matrix = Matrix::<10, 10, _, f64>::new([
79        3.4, 5.3, 2.4, 4.7, 7.89, 3.2, 3.5, 2.1324, 3.0, 3.4, //
80        1.4, 5.4, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
81        2.4, 5.5, 2.4, 4.7, 7.89, 3.2, 2.5, 2.1324, 3.0, 3.4, //
82        3.4, 5.6, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
83        3.4, 5.9, 2.4, 4.7, 7.89, 3.2, 5.5, 2.1324, 3.0, 3.4, //
84        5.4, 4.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
85        6.4, 3.3, 2.4, 4.7, 7.89, 3.2, 7.5, 2.1324, 3.0, 3.4, //
86        7.4, 1.3, 2.4, 4.7, 7.89, 3.2, 9.5, 2.1324, 3.0, 3.4, //
87        8.4, 2.3, 2.4, 4.7, 7.89, 3.2, 4.5, 2.1324, 3.0, 3.4, //
88        9.4, 3.3, 2.4, 4.7, 7.89, 3.2, 1.5, 2.1324, 3.0, 3.4, //
89    ]);
90    let (l, u) = matrix.lu_decomposition();
91    let diff = matrix - l * u;
92    diff.map::<_, _, [(); 10 * 10]>(|e| assert!(e.abs() < 1e-10));
93
94    // Solve Ax = b with Gaussian elimination
95    //
96    // 2a + 2b - 4c + 5d = 16
97    //  a +  b +  c +  d = 10
98    // -a + 2b - 3c -  d = -2
99    //  a + 2b + 3c - 4d = -2
100    //
101    // (a, b, c, d) = (1, 2, 3, 4)
102    let a = Matrix::<4, 4, _, f64>::new([
103        2.0, 3.0, -4.0, 5.0, //
104        1.0, 1.0, 1.0, 1.0, //
105        -1.0, 2.0, -3.0, 1.0, //
106        1.0, 2.0, 3.0, -4.0,
107    ]);
108    let b = Matrix::<4, 1, _, f64>::new([
109        16.0, //
110        10.0, //
111        -2.0, //
112        -2.0,
113    ]);
114    let x = solve_eqn(a, b);
115    assert!((1.0 - x.0[0]).abs() < 1e-10);
116    assert!((2.0 - x.0[1]).abs() < 1e-10);
117    assert!((3.0 - x.0[2]).abs() < 1e-10);
118    assert!((4.0 - x.0[3]).abs() < 1e-10);
119}

Trait Implementations§

Source§

impl<const N: usize, const M: usize, Lhs, Rhs, T> Add<Matrix<N, M, Rhs, T>> for Matrix<N, M, Lhs, T>

Source§

fn add(self, other: Matrix<N, M, Rhs, T>) -> Self::Output

A + B

§Examples
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use dntk_matrix::matrix::Matrix;
use dntk_matrix::heap::Heaped;

let left = Matrix::<2, 3, _, i32>::new([
    1, 2, 3, //
    4, 5, 6,
]);
let right = Matrix::<2, 3, _, i32>::new([
    1, 2, 3, //
    4, 5, 6,
]);
assert_eq!(
    left + right,
    Matrix::<2, 3, _, i32>::new([
        2, 4, 6, //
        8, 10, 12
    ])
);

let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
    1, 2, 3, //
    4, 5, 6,
])));
let right = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
    1, 2, 3, //
    4, 5, 6,
])));
assert_eq!(
    left + right,
    Matrix::<2, 3, _, i32>::new([
        2, 4, 6, //
        8, 10, 12
    ])
);

let left = Matrix::<2, 3, _, _>::new(Heaped::<2, 3, i32>::new(Box::new([
    1, 2, 3, //
    4, 5, 6,
])));
let right = Matrix::<2, 3, _, i32>::new([
    1, 2, 3, //
    4, 5, 6,
]);
assert_eq!(
    left + right,
    Matrix::<2, 3, _, i32>::new([
        2, 4, 6, //
        8, 10, 12
    ])
);
Source§

type Output = Matrix<N, M, Lhs, T>

The resulting type after applying the + operator.
Source§

impl<const N: usize, const M: usize, Lhs, T> Add<T> for Matrix<N, M, Lhs, T>

Source§

fn add(self, other: T) -> Self::Output

A + k

Source§

type Output = Matrix<N, M, Lhs, T>

The resulting type after applying the + operator.
Source§

impl<const N: usize, const M: usize, Array, T: Clone> Clone for Matrix<N, M, Array, T>
where Array: Into<[T; { _ }]> + Index<usize> + Clone,

Source§

fn clone(&self) -> Matrix<N, M, Array, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize, const M: usize, Array, T: Debug> Debug for Matrix<N, M, Array, T>
where Array: Into<[T; { _ }]> + Index<usize> + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, const M: usize, Array, T> Display for Matrix<N, M, Array, T>
where T: Display + Copy + Zero + PartialOrd, Array: Into<[T; { _ }]> + Index<usize, Output = T>,

Source§

fn fmt(&self, dest: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, const M: usize, Array, T> Index<usize> for Matrix<N, M, Array, T>
where Array: Into<[T; { _ }]> + Index<usize, Output = T>,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<const N: usize, const M: usize, const L: usize, Rhs, T> Mul<Matrix<M, L, Rhs, T>> for Matrix<N, M, [T; { _ }], T>
where [T; { _ }]: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, Rhs: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, T: AddAssign + Mul<Output = T> + Copy + Zero,

Source§

fn mul(self, other: Matrix<M, L, Rhs, T>) -> Self::Output

A * B

§Examples
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use dntk_matrix::matrix::Matrix;
use dntk_matrix::heap::Heaped;

let left = Matrix::<2, 3, _, i32>::new([
    3, 7, 2, //
    2, 4, 3,
]);
let right = Matrix::<3, 3, _, i32>::new([
    2, 1, 4, //
    9, 2, 7, //
    8, 3, 2
]);
assert_eq!(
    left * right,
    Matrix::<2, 3, _, i32>::new([
        85, 23, 65, //
        64, 19, 42
    ])
);
Source§

type Output = Matrix<N, L, [T; { _ }], T>

The resulting type after applying the * operator.
Source§

impl<const N: usize, const M: usize, const L: usize, Rhs, T> Mul<Matrix<M, L, Rhs, T>> for Matrix<N, M, Heaped<N, M, T>, T>
where [T; { _ }]:, Heaped<N, M, T>: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, Rhs: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, T: AddAssign + Mul<Output = T> + Copy + Zero,

Source§

fn mul(self, other: Matrix<M, L, Rhs, T>) -> Self::Output

A * B

Source§

type Output = Matrix<N, L, Heaped<N, L, T>, T>

The resulting type after applying the * operator.
Source§

impl<const N: usize, const M: usize, Lhs, T> Mul<T> for Matrix<N, M, Lhs, T>

Source§

fn mul(self, other: T) -> Self::Output

A * k

Source§

type Output = Matrix<N, M, Lhs, T>

The resulting type after applying the * operator.
Source§

impl<const N: usize, const M: usize, Slice, T> Neg for Matrix<N, M, Slice, T>
where Slice: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T> + IndexMut<usize, Output = T>, T: Neg<Output = T> + Copy,

Source§

fn neg(self) -> Self::Output

  • A
Source§

type Output = Matrix<N, M, Slice, T>

The resulting type after applying the - operator.
Source§

impl<const N: usize, const M: usize, Lhs, Rhs, T> PartialEq<Matrix<N, M, Rhs, T>> for Matrix<N, M, Lhs, T>
where Lhs: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, Rhs: Into<[T; { _ }]> + From<[T; { _ }]> + Index<usize, Output = T>, T: PartialEq,

Source§

fn eq(&self, other: &Matrix<N, M, Rhs, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize, const M: usize, Lhs, Rhs, T> Sub<Matrix<N, M, Rhs, T>> for Matrix<N, M, Lhs, T>

Source§

fn sub(self, other: Matrix<N, M, Rhs, T>) -> Self::Output

A - B

Source§

type Output = Matrix<N, M, Lhs, T>

The resulting type after applying the - operator.
Source§

impl<const N: usize, const M: usize, Lhs, T> Sub<T> for Matrix<N, M, Lhs, T>

Source§

fn sub(self, other: T) -> Self::Output

A - k

Source§

type Output = Matrix<N, M, Lhs, T>

The resulting type after applying the - operator.

Auto Trait Implementations§

§

impl<const N: usize, const M: usize, Array, T> Freeze for Matrix<N, M, Array, T>
where Array: Freeze,

§

impl<const N: usize, const M: usize, Array, T> RefUnwindSafe for Matrix<N, M, Array, T>
where Array: RefUnwindSafe, T: RefUnwindSafe,

§

impl<const N: usize, const M: usize, Array, T> Send for Matrix<N, M, Array, T>
where Array: Send, T: Send,

§

impl<const N: usize, const M: usize, Array, T> Sync for Matrix<N, M, Array, T>
where Array: Sync, T: Sync,

§

impl<const N: usize, const M: usize, Array, T> Unpin for Matrix<N, M, Array, T>
where Array: Unpin, T: Unpin,

§

impl<const N: usize, const M: usize, Array, T> UnwindSafe for Matrix<N, M, Array, T>
where Array: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.