#dense #sparse #linear-algebra #vector-space

no-std vectors

Sparse & dense vectors for use in high dimensional vector spaces

2 unstable releases

Uses old Rust 2015

0.3.0 May 12, 2018
0.1.0 Feb 18, 2017

#702 in Math

Download history 15/week @ 2023-11-10 15/week @ 2023-11-17 16/week @ 2023-11-24 13/week @ 2023-12-01 15/week @ 2023-12-08 15/week @ 2023-12-15 15/week @ 2023-12-22 8/week @ 2023-12-29 18/week @ 2024-01-05 16/week @ 2024-01-12 13/week @ 2024-01-19 12/week @ 2024-01-26 6/week @ 2024-02-02 18/week @ 2024-02-09 39/week @ 2024-02-16 67/week @ 2024-02-23

132 downloads per month
Used in sann

MPL-2.0 license

92KB
2.5K SLoC

vectors

Build Status Downloads Version License

Synopsis

Sparse & dense vectors for use in high dimensional vector spaces.

Motivation

Many machine-learning algorithms make use of vectors in high-dimensional vector spaces.

The vectors provides efficient implementations for the following representations:

Dense Sparse
Heap
Stack

Getting Started

Add the most recent version of vectors to your dependencies in your project's Cargo.toml.

Then add …

#[macro_use(dense_vec, sparse_vec)]
extern crate vectors;

… to your crate's root file (e.g. lib.rs, main.rs).

Once that's done you're ready to play!

Example

extern crate vectors;

use vectors::Vector;
use vectors::heap::{SparseVector, DenseVector};

fn main() {
  let sparse_1 = SparseVector::from(vec![(0, 0.1), (2, 0.2), (4, 0.3), (6, 0.4)]);
  let sparse_2 = SparseVector::from(vec![(0, 0.2), (3, 0.4), (5, 0.2), (6, 0.6)]);
  let dot = sparse_1.dot(&sparse_2);
  println!("{:?}", dot);

  let dense_1 = DenseVector::from(vec![0.0, 1.0, 2.0, 4.0, 6.0]);
  let dense_2 = DenseVector::from(vec![0.2, 3.0, 0.0, 1.5, 6.0]);
  let dot = dense_1.dot(&dense_2);
  println!("{:?}", dot);
}

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.

Dependencies

~430KB