package spurs
A lightweight native sparse matrix library
Install
Dune Dependency
Authors
Maintainers
Sources
spurs-0.1.1.tbz
sha256=c59be7af57a6902941cfa3d446fb83e4cb58876fc7208008d1ae38a1d4e189cc
sha512=86bd6e099ac1441e4fecd2ce59fdc878d437dc0f7f4d2bd21a08fac675a99355b745a009d1040104ef106220ede8aa10f71e7ca85c982d2ddc7bc5e76aa69166
doc/README.html
spurs
Rust's sprs crate is a sparse linear algebra library for Rust. This is a lightweight, natively implemented port of sprs
to OCaml, which will (eventually) support all the same functionality.
The documentation can be found here!
Installation
opam install spurs
Quickstart Guide
wip, here's a snippet:
open Spurs
open Spurs.Csmat
open Spurs.Ops
let () =
let a =
[|
[| 0.; 0.; 2.; 0.; 0. |];
[| 0.; 1.; 2.; 0.; 0. |];
[| 0.; 0.; 2.; 0.; 0. |];
[| 0.; 0.; 0.; 4.; 0. |];
|]
|> csr_from_dense
in
let b =
[|
[| 0.; 0.; 2. |];
[| 0.; 1.; 2. |];
[| 0.; 0.; 2. |];
[| 0.; 0.; 0. |];
[| 0.; 0.; 0. |];
|]
|> csc_from_dense
in
let c = a *@ b in
print_float_matrix c;
print_matrix (to_dense c)
Prints:
{ Csmat.storage = Csmat.CSR; nrows = 4; ncols = 3; indptr = [0, 1, 3, 4, 4];
indices = [2, 1, 2, 2]; data = [4, 1, 6, 4] }
[
[0.00; 0.00; 4.00];
[0.00; 1.00; 6.00];
[0.00; 0.00; 4.00];
[0.00; 0.00; 0.00];
]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page