Struct Matrix

Source
pub struct Matrix { /* private fields */ }
Expand description

A matrix structure.

Implementations§

Source§

impl Matrix

Source

pub fn new(row_count: usize, col_count: usize) -> Self

Creates a matrix with the number of rows and the number of columns.

Source

pub fn new_with_elems(row_count: usize, col_count: usize, elems: &[f32]) -> Self

Creates a matrix with the number of rows, the number of columns, and the elements.

Examples found in repository?
examples/mul.rs (line 21)
13fn create_matrix(n: usize, m: usize) -> Matrix
14{
15    let mut elems: Vec<f32> = vec![0.0f32; n * m];
16    for i in 0..n {
17        for j in 0..m {
18            elems[m * i + j] = (m * i + j) as f32;
19        }
20    }
21    Matrix::new_with_elems(n, m, elems.as_slice())
22}
More examples
Hide additional examples
examples/mul_bt.rs (line 21)
13fn create_matrix(n: usize, m: usize) -> Matrix
14{
15    let mut elems: Vec<f32> = vec![0.0f32; n * m];
16    for i in 0..n {
17        for j in 0..m {
18            elems[m * i + j] = (m * i + j) as f32;
19        }
20    }
21    Matrix::new_with_elems(n, m, elems.as_slice())
22}
examples/mad.rs (line 26)
13fn create_matrix(n: usize, m: usize, is_scalar: bool) -> Matrix
14{
15    let mut elems: Vec<f32> = vec![0.0f32; n * m];
16    let scalar = if is_scalar {
17        (n * m) as f32
18    } else {
19        1.0f32
20    };
21    for i in 0..n {
22        for j in 0..m {
23            elems[m * i + j] = ((m * i + j) as f32) * scalar;
24        }
25    }
26    Matrix::new_with_elems(n, m, elems.as_slice())
27}
Source

pub fn new_with_elem_vecs(elem_vecs: &[Vec<f32>]) -> Self

Creates a matrix with the vector of rows.

Source

pub fn row_count(&self) -> usize

Returns the number of matrix rows.

Examples found in repository?
examples/simple.rs (line 24)
10fn main()
11{
12    let a = matrix![
13        [1.0, 2.0, 3.0],
14        [4.0, 5.0, 6.0],
15        [7.0, 8.0, 9.0]
16    ];
17    let b = matrix![
18        [1.0, 4.0, 7.0],
19        [2.0, 5.0, 8.0],
20        [3.0, 6.0, 9.0]
21    ];
22    let c = a * b;
23    let elems = c.elems();
24    for i in 0..c.row_count() {
25        for j in 0..c.col_count() {
26            print!("\t{}", elems[i * c.col_count() + j]);
27        }
28        println!("");
29    }
30}
Source

pub fn col_count(&self) -> usize

Returns the number of matrix columns.

Examples found in repository?
examples/simple.rs (line 25)
10fn main()
11{
12    let a = matrix![
13        [1.0, 2.0, 3.0],
14        [4.0, 5.0, 6.0],
15        [7.0, 8.0, 9.0]
16    ];
17    let b = matrix![
18        [1.0, 4.0, 7.0],
19        [2.0, 5.0, 8.0],
20        [3.0, 6.0, 9.0]
21    ];
22    let c = a * b;
23    let elems = c.elems();
24    for i in 0..c.row_count() {
25        for j in 0..c.col_count() {
26            print!("\t{}", elems[i * c.col_count() + j]);
27        }
28        println!("");
29    }
30}
Source

pub fn is_transposed(&self) -> bool

Returns true if the matrix is transposed, otherwise false.

This method indeed returns the transpose flag of matrix that is changed by transpose.

Source

pub fn elems(&self) -> Vec<f32>

Returns the matrix elements.

Examples found in repository?
examples/simple.rs (line 23)
10fn main()
11{
12    let a = matrix![
13        [1.0, 2.0, 3.0],
14        [4.0, 5.0, 6.0],
15        [7.0, 8.0, 9.0]
16    ];
17    let b = matrix![
18        [1.0, 4.0, 7.0],
19        [2.0, 5.0, 8.0],
20        [3.0, 6.0, 9.0]
21    ];
22    let c = a * b;
23    let elems = c.elems();
24    for i in 0..c.row_count() {
25        for j in 0..c.col_count() {
26            print!("\t{}", elems[i * c.col_count() + j]);
27        }
28        println!("");
29    }
30}
More examples
Hide additional examples
examples/mul.rs (line 76)
24fn main()
25{
26    let args: Vec<String> = env::args().collect();
27    let n: usize = match args.get(1) {
28        Some(s) => {
29            match s.parse::<usize>() {
30                Ok(tmp_n) => tmp_n,
31                Err(err) => {
32                    eprintln!("{}", err);
33                    exit(1);
34                },
35            }
36        },
37        None => 100,
38    };
39    let m: usize = match args.get(2) {
40        Some(s) => {
41            match s.parse::<usize>() {
42                Ok(tmp_m) => tmp_m,
43                Err(err) => {
44                    eprintln!("{}", err);
45                    exit(1);
46                },
47            }
48        },
49        None => 100,
50    };
51    let l: usize = match args.get(3) {
52        Some(s) => {
53            match s.parse::<usize>() {
54                Ok(tmp_l) => tmp_l,
55                Err(err) => {
56                    eprintln!("{}", err);
57                    exit(1);
58                },
59            }
60        },
61        None => 100,
62    };
63    let frontend = match Frontend::new() {
64        Ok(tmp_frontend) => tmp_frontend,
65        Err(err) => {
66            eprintln!("{}", err);
67            exit(1);
68        },
69    };
70    println!("backend: {}", frontend.backend().name());
71    let a = create_matrix(n, l);
72    let b = create_matrix(l, m);
73    let now = Instant::now();
74    let c = a * b;
75    let duration = now.elapsed();
76    let elems = c.elems();
77    let sum = elems.iter().fold(0.0f32, |x, y| x + y);
78    println!("sum: {}", sum);
79    println!("time: {}.{:06}", duration.as_secs(), duration.as_micros() % 1000000);
80    match finalize_default_backend() {
81        Ok(()) => (),
82        Err(err) => {
83            eprintln!("{}", err);
84            exit(1);
85        },
86    }
87}
examples/mul_bt.rs (line 76)
24fn main()
25{
26    let args: Vec<String> = env::args().collect();
27    let n: usize = match args.get(1) {
28        Some(s) => {
29            match s.parse::<usize>() {
30                Ok(tmp_n) => tmp_n,
31                Err(err) => {
32                    eprintln!("{}", err);
33                    exit(1);
34                },
35            }
36        },
37        None => 100,
38    };
39    let m: usize = match args.get(2) {
40        Some(s) => {
41            match s.parse::<usize>() {
42                Ok(tmp_m) => tmp_m,
43                Err(err) => {
44                    eprintln!("{}", err);
45                    exit(1);
46                },
47            }
48        },
49        None => 100,
50    };
51    let l: usize = match args.get(3) {
52        Some(s) => {
53            match s.parse::<usize>() {
54                Ok(tmp_l) => tmp_l,
55                Err(err) => {
56                    eprintln!("{}", err);
57                    exit(1);
58                },
59            }
60        },
61        None => 100,
62    };
63    let frontend = match Frontend::new() {
64        Ok(tmp_frontend) => tmp_frontend,
65        Err(err) => {
66            eprintln!("{}", err);
67            exit(1);
68        },
69    };
70    println!("backend: {}", frontend.backend().name());
71    let a = create_matrix(n, l);
72    let b = create_matrix(m, l);
73    let now = Instant::now();
74    let c = a * b.transpose();
75    let duration = now.elapsed();
76    let elems = c.elems();
77    let sum = elems.iter().fold(0.0f32, |x, y| x + y);
78    println!("sum: {}", sum);
79    println!("time: {}.{:06}", duration.as_secs(), duration.as_micros() % 1000000);
80    match finalize_default_backend() {
81        Ok(()) => (),
82        Err(err) => {
83            eprintln!("{}", err);
84            exit(1);
85        },
86    }
87}
examples/mad.rs (line 82)
29fn main()
30{
31    let args: Vec<String> = env::args().collect();
32    let n: usize = match args.get(1) {
33        Some(s) => {
34            match s.parse::<usize>() {
35                Ok(tmp_n) => tmp_n,
36                Err(err) => {
37                    eprintln!("{}", err);
38                    exit(1);
39                },
40            }
41        },
42        None => 100,
43    };
44    let m: usize = match args.get(2) {
45        Some(s) => {
46            match s.parse::<usize>() {
47                Ok(tmp_m) => tmp_m,
48                Err(err) => {
49                    eprintln!("{}", err);
50                    exit(1);
51                },
52            }
53        },
54        None => 100,
55    };
56    let l: usize = match args.get(3) {
57        Some(s) => {
58            match s.parse::<usize>() {
59                Ok(tmp_l) => tmp_l,
60                Err(err) => {
61                    eprintln!("{}", err);
62                    exit(1);
63                },
64            }
65        },
66        None => 100,
67    };
68    let frontend = match Frontend::new() {
69        Ok(tmp_frontend) => tmp_frontend,
70        Err(err) => {
71            eprintln!("{}", err);
72            exit(1);
73        },
74    };
75    println!("backend: {}", frontend.backend().name());
76    let a = create_matrix(n, l, false);
77    let b = create_matrix(l, m, false);
78    let c = create_matrix(n, m, true);
79    let now = Instant::now();
80    let d = a * b + c;
81    let duration = now.elapsed();
82    let elems = d.elems();
83    let sum = elems.iter().fold(0.0f32, |x, y| x + y);
84    println!("sum: {}", sum);
85    println!("time: {}.{:06}", duration.as_secs(), duration.as_micros() % 1000000);
86    match finalize_default_backend() {
87        Ok(()) => (),
88        Err(err) => {
89            eprintln!("{}", err);
90            exit(1);
91        },
92    }
93}
Source

pub fn copy(&self) -> Self

Creates a matrix copy.

This method indeed copies the matrix array to a new matrix array.

Source

pub fn transpose(&self) -> Self

Transposes the matrix (AT).

This method doesn’t indeed transpose the matrix but changes the transpose flag and exchanges the number of matrix rows with the number of matrix columns.

§Examples
let a = matrix![
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0]
];
let b = a.transpose();
assert_eq!(3, b.row_count());
assert_eq!(2, b.col_count());
assert_eq!(true, b.is_transposed());
assert_eq!(a.elems(), b.elems());
let c = b.transpose();
assert_eq!(2, c.row_count());
assert_eq!(3, c.col_count());
assert_eq!(false, c.is_transposed());
assert_eq!(a.elems(), c.elems());
Examples found in repository?
examples/mul_bt.rs (line 74)
24fn main()
25{
26    let args: Vec<String> = env::args().collect();
27    let n: usize = match args.get(1) {
28        Some(s) => {
29            match s.parse::<usize>() {
30                Ok(tmp_n) => tmp_n,
31                Err(err) => {
32                    eprintln!("{}", err);
33                    exit(1);
34                },
35            }
36        },
37        None => 100,
38    };
39    let m: usize = match args.get(2) {
40        Some(s) => {
41            match s.parse::<usize>() {
42                Ok(tmp_m) => tmp_m,
43                Err(err) => {
44                    eprintln!("{}", err);
45                    exit(1);
46                },
47            }
48        },
49        None => 100,
50    };
51    let l: usize = match args.get(3) {
52        Some(s) => {
53            match s.parse::<usize>() {
54                Ok(tmp_l) => tmp_l,
55                Err(err) => {
56                    eprintln!("{}", err);
57                    exit(1);
58                },
59            }
60        },
61        None => 100,
62    };
63    let frontend = match Frontend::new() {
64        Ok(tmp_frontend) => tmp_frontend,
65        Err(err) => {
66            eprintln!("{}", err);
67            exit(1);
68        },
69    };
70    println!("backend: {}", frontend.backend().name());
71    let a = create_matrix(n, l);
72    let b = create_matrix(m, l);
73    let now = Instant::now();
74    let c = a * b.transpose();
75    let duration = now.elapsed();
76    let elems = c.elems();
77    let sum = elems.iter().fold(0.0f32, |x, y| x + y);
78    println!("sum: {}", sum);
79    println!("time: {}.{:06}", duration.as_secs(), duration.as_micros() % 1000000);
80    match finalize_default_backend() {
81        Ok(()) => (),
82        Err(err) => {
83            eprintln!("{}", err);
84            exit(1);
85        },
86    }
87}
Source

pub fn t(&self) -> Self

See transpose.

Source

pub fn really_transpose(&self) -> Self

Indeed transposes the matrix (AT).

This method indeed transposes the matrix without changing the transpose flag.

§Examples
let a = matrix![
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0]
];
let b = a.really_transpose();
assert_eq!(3, b.row_count());
assert_eq!(2, b.col_count());
assert_eq!(false, b.is_transposed());
assert_eq!(vec![1.0, 4.0, 2.0, 5.0, 3.0, 6.0], b.elems());
Source

pub fn rt(&self) -> Self

Source

pub fn mul_elems(&self, b: &Self) -> Self

Multiplies the matrix elements by the b matrix elements (aij·bij).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = matrix![
    [5.0, 6.0],
    [7.0, 8.0]
];
let c = a.mul_elems(&b);
assert_eq!(vec![1.0 * 5.0, 2.0 * 6.0, 3.0 * 7.0, 4.0 * 8.0], c.elems());
Source

pub fn div_elems(&self, b: &Self) -> Self

Divides the matrix elements by the b matrix elements (aijbij).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = matrix![
    [5.0, 6.0],
    [7.0, 8.0]
];
let c = a.div_elems(&b);
let elems = c.elems();
assert!((1.0 / 5.0 - elems[0]).abs() < 0.001);
assert!((2.0 / 6.0 - elems[1]).abs() < 0.001);
assert!((3.0 / 7.0 - elems[2]).abs() < 0.001);
assert!((4.0 / 8.0 - elems[3]).abs() < 0.001);
Source

pub fn rsub(&self, b: f32) -> Self

Subtracts the matrix from the scalar (b-A).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.rsub(10.5);
assert_eq!(vec![10.5 - 1.0, 10.5 - 2.0, 10.5 - 3.0, 10.5 - 4.0], b.elems());
Source

pub fn rdiv(&self, b: f32) -> Self

Divides the scalar by the matrix elements (baij).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.rdiv(10.5);
let elems = b.elems();
assert!((10.5 / 1.0 - elems[0]).abs() < 0.001);
assert!((10.5 / 2.0 - elems[1]).abs() < 0.001);
assert!((10.5 / 3.0 - elems[2]).abs() < 0.001);
assert!((10.5 / 4.0 - elems[3]).abs() < 0.001);
Source

pub fn sigmoid(&self) -> Self

Calculates sigmoid function for the matrix (sigmoid(A)).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.sigmoid();
let elems = b.elems();
assert!((1.0 / (1.0 + (-1.0f32).exp()) - elems[0]).abs() < 0.001);
assert!((1.0 / (1.0 + (-2.0f32).exp()) - elems[1]).abs() < 0.001);
assert!((1.0 / (1.0 + (-3.0f32).exp()) - elems[2]).abs() < 0.001);
assert!((1.0 / (1.0 + (-4.0f32).exp()) - elems[3]).abs() < 0.001);
Source

pub fn tanh(&self) -> Self

Calculates hiperbolic tangent function for the matrix (tanh(A)).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.tanh();
let elems = b.elems();
assert!((1.0f32.tanh() - elems[0]).abs() < 0.001);
assert!((2.0f32.tanh() - elems[1]).abs() < 0.001);
assert!((3.0f32.tanh() - elems[2]).abs() < 0.001);
assert!((4.0f32.tanh() - elems[3]).abs() < 0.001);
Source

pub fn swish(&self) -> Self

Calculates swish function for the matrix (swish(A)).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.swish();
let elems = b.elems();
assert!((1.0 / (1.0 + (-1.0f32).exp()) - elems[0]).abs() < 0.001);
assert!((2.0 / (1.0 + (-2.0f32).exp()) - elems[1]).abs() < 0.001);
assert!((3.0 / (1.0 + (-3.0f32).exp()) - elems[2]).abs() < 0.001);
assert!((4.0 / (1.0 + (-4.0f32).exp()) - elems[3]).abs() < 0.001);
Source

pub fn softmax(&self) -> Self

Calculates softmax function for the matrix (softmax(A)).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.softmax();
let elems = b.elems();
let sum1 = 1.0f32.exp() + 3.0f32.exp();
let sum2 = 2.0f32.exp() + 4.0f32.exp();
assert!((1.0f32.exp() / sum1 - elems[0]).abs() < 0.001);
assert!((2.0f32.exp() / sum2 - elems[1]).abs() < 0.001);
assert!((3.0f32.exp() / sum1 - elems[2]).abs() < 0.001);
assert!((4.0f32.exp() / sum2 - elems[3]).abs() < 0.001);
Source

pub fn sqrt(&self) -> Self

Calculates square root of the matrix (A).

§Examples
let a = matrix![
    [1.0, 2.0],
    [3.0, 4.0]
];
let b = a.sqrt();
let elems = b.elems();
assert!((1.0f32.sqrt() - elems[0]).abs() < 0.001);
assert!((2.0f32.sqrt() - elems[1]).abs() < 0.001);
assert!((3.0f32.sqrt() - elems[2]).abs() < 0.001);
assert!((4.0f32.sqrt() - elems[3]).abs() < 0.001);
Source

pub fn repeat(&self, n: usize) -> Self

Repeats the vector as column or a row.

§Examples
let a = matrix![
    [1.0],
    [2.0]
];
let b = a.repeat(3);
assert_eq!(vec![1.0, 1.0, 1.0, 2.0, 2.0, 2.0], b.elems());
let c = matrix![[1.0, 2.0, 3.0]];
let d = c.repeat(2);
assert_eq!(vec![1.0, 2.0, 3.0, 1.0, 2.0, 3.0], d.elems());

Trait Implementations§

Source§

impl Add<&Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Matrix) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&Matrix> for Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Matrix) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &f32) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &f32) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Matrix) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f32) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f32) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<&Matrix> for Matrix

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl AddAssign<&f32> for Matrix

Source§

fn add_assign(&mut self, rhs: &f32)

Performs the += operation. Read more
Source§

impl AddAssign<f32> for Matrix

Source§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
Source§

impl AddAssign for Matrix

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Matrix

Source§

fn clone(&self) -> Matrix

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 Debug for Matrix

Source§

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

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

impl Div<&f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &f32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &f32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<&f32> for Matrix

Source§

fn div_assign(&mut self, rhs: &f32)

Performs the /= operation. Read more
Source§

impl DivAssign<f32> for Matrix

Source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
Source§

impl Mul<&Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Matrix) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&Matrix> for Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Matrix) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &f32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &f32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&Matrix> for Matrix

Source§

fn mul_assign(&mut self, rhs: &Self)

Performs the *= operation. Read more
Source§

impl MulAssign<&f32> for Matrix

Source§

fn mul_assign(&mut self, rhs: &f32)

Performs the *= operation. Read more
Source§

impl MulAssign<f32> for Matrix

Source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
Source§

impl MulAssign for Matrix

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Sub<&Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Matrix) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<&Matrix> for Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Matrix) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<&f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &f32) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<&f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &f32) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Matrix> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Matrix) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<f32> for &Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<f32> for Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<&Matrix> for Matrix

Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl SubAssign<&f32> for Matrix

Source§

fn sub_assign(&mut self, rhs: &f32)

Performs the -= operation. Read more
Source§

impl SubAssign<f32> for Matrix

Source§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
Source§

impl SubAssign for Matrix

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl Freeze for Matrix

§

impl RefUnwindSafe for Matrix

§

impl Send for Matrix

§

impl Sync for Matrix

§

impl Unpin for Matrix

§

impl UnwindSafe for Matrix

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, 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.