Crates.io | rustrix |
lib.rs | rustrix |
version | 0.2.0 |
source | src |
created_at | 2024-01-21 06:52:30.168222 |
updated_at | 2024-08-07 12:17:43.569006 |
description | Supports macro and basic operations for matrix. |
homepage | |
repository | https://github.com/mk0218/rustrix |
max_upload_size | |
id | 1107392 |
size | 12,265 |
Supports macro and basic operations for matrix.
use rustrix::*;
let m = mx![
1, 2, 3;
4, 5, 6;
];
let (rows, cols, init) = (2, 3, 1);
let m1 = mx!(rows, cols; init);
let m2 = mx![
1, 1, 1;
1, 1, 1;
];
assert_eq!(m1, m2)
use rustrix::*;
let m = mx!(2, 3; 2) + mx!(2, 3; 3);
use rustrix::*;
let m = mx!(2, 3; 4) - mx!(2, 3; 1);
use rustrix::*;
let m1 = mx![
1, 1;
2, 2;
];
let m2 = mx![
1, 1, 1, 1;
2, 2, 2, 2;
];
let m = m1 * m2;
use rustrix::*;
let m1 = mx![
1, 2;
3, 4;
5, 6;
];
let m2 = m1.tp();
let m3 = m1.transpose();
use rustrix::*;
let m1 = mx![
1, 2, 3;
4, 5, 6;
];
let m2 = m1.mul_scalar(2);