vectors

Build Status Downloads Version License

Synopsis

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

Motivation

Many machine-learning algorithms work by calculating the dot product of vectors in high-dimensional vector spaces.

Getting Started

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

Then add …

```rust

[macrouse(densevec, 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

```rust

[macrouse(densevec, sparse_vec)]

extern crate vectors;

use std::iter::FromIterator;

use vectors::{SparseVector, DenseVector, Dot};

fn main() { let sparse1 = sparsevec![(0, 0.1), (2, 0.2), (4, 0.3), (6, 0.4)]; let sparse2 = sparsevec![(0, 0.2), (3, 0.4), (5, 0.2), (6, 0.6)]; let dot = sparse1.dot(&sparse2); println!("{:?}", dot);

let dense1 = densevec![0.0, 1.0, 2.0, 4.0, 6.0]; let dense2 = densevec![0.2, 3.0, 0.0, 1.5, 6.0]; let dot = dense1.dot(&dense2); 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.