libmat

Crates.iolibmat
lib.rslibmat
version0.2.0
sourcesrc
created_at2021-06-19 23:58:20.302631
updated_at2021-06-29 14:25:39.455922
descriptionThis library provides tools for linear algebra.
homepage
repositoryhttps://github.com/wiebecommajonas/libmat
max_upload_size
id412244
size53,116
Jonas Wiebe (wiebecommajonas)

documentation

README

libmat

Crates.io License Downloads

This library provides tools for linear algebra. For a full documentation, please visit docs.rs.

Usage

To use this library, add this to your Cargo.toml:

[dependencies]
libmat = "0.2.0"

And this to your crate root:

extern crate libmat;

Example

This is a short example, for more examples check the documentation.

use libmat::mat::{Matrix, Vector};
use libmat::{matrix, vector}; // macros

let vec_a = vector![1,0,0];
let vec_b = vector![0,1,0];
let vec_c = vector![0,0,1];

// Are the vectors perpendicular to each other?
assert_eq!(&vec_a * &vec_b, 0);
assert_eq!(&vec_a * &vec_c, 0);
assert_eq!(&vec_c * &vec_b, 0);

let mat_a = Matrix::<u32>::one(3);
let mat_b = matrix!{
    1, 2, 3;
    3, 2, 1;
    2, 1, 3;
};

// Are the matrices invertible?
assert_ne!(mat_a.det(), 0);
assert_ne!(mat_b.det(), 0);

Changes

A full changelog is available in CHANGELOG.md

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 36

cargo fmt