Crates.io | vector_operations |
lib.rs | vector_operations |
version | 1.1.0 |
source | src |
created_at | 2024-11-07 11:24:59.74376 |
updated_at | 2024-11-07 12:18:12.743413 |
description | A collection of vector operations for Rust. |
homepage | |
repository | https://github.com/Kai-Smith/vector_operations |
max_upload_size | |
id | 1439685 |
size | 7,029 |
This is a collection of vector operations for Rust.
To use this crate, add the following to your Cargo.toml
file:
[dependencies]
vector_operations = "0.1.0"
Then, add this to your crate root:
use vector_operations::*;
let a = vec![1, 2, 3];
let b = vec![4, 5, 6];
let c = add(a, b);
assert_eq!(c, vec![5, 7, 9]);
let a = vec![1, 2, 3];
let b = vec![4, 5, 6];
let c = sub(a, b);
assert_eq!(c, vec![-3, -3, -3]);
let a = vec![1, 2, 3];
let b = 2;
let c = scale(a, b);
assert_eq!(c, vec![2, 4, 6]);
let a = vec![
vec![1, 2, 3],
vec![4, 5, 6],
vec![7, 8, 9],
];
let b = vec![1, 2, 3];
let c = mat_vec_mul(a, b);
assert_eq!(c, vec![30, 36, 42]);