#tensor #contraction #sparse-array #networking

spenso

A tensor (n-dim array) network, iterating, and contraction (using automatic abstract index matching) library

5 unstable releases

0.4.1 Oct 26, 2024
0.4.0 Oct 25, 2024
0.3.0 Jul 12, 2024
0.2.0 May 24, 2024
0.1.1 May 20, 2024

#593 in Data structures

Download history 4/week @ 2024-09-16 42/week @ 2024-09-30 8/week @ 2024-10-07 207/week @ 2024-10-21 48/week @ 2024-10-28 1/week @ 2024-11-18 66/week @ 2024-12-02

67 downloads per month

MIT/Apache and maybe LGPL-3.0+

2.5MB
20K SLoC

logo

Documentation crates.io Build Status codecov

Spenso

Spenso is a rust library for working with arbitrary dimensional arrays, commonly called tensors. It provides both sparse (spensors) and dense (densors) tensors.

It supports any type as element, and provides iterators along specified dimensions (called fibers)


lib.rs:

Contains all the tooling for working with arbitrary rank tensors, symbolically, numerically, and parametrically.

It includes special support for a minkowski metric, and a way to add any custom diagonal (sign based) metric.

All tensor types make use of a tensor structure type, either the minimum Vec of Slots or a more complete (but slightly more computationally heavy) HistoryStructure. Data is then added, to make parametric, or fully numeric tensors. If no data is added, some TensorStructures behave like symbolic tensors: namely HistoryStructure and SymbolicTensor

There are two main types of data tensors, DenseTensor and SparseTensor. They each implement a different type of storage for data.

All types of tensors can be contracted together using the Contract trait. This can be done manually, or using a TensorNetwork and specifying a contraction algorithm.

Several Enums are defined to be able to store heterogenous tensors. Namely

Dependencies

~10–22MB
~348K SLoC