#tensor #contraction #index #indices #dense #sparse #iterator

spenso

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

3 unstable releases

0.2.0 May 24, 2024
0.1.1 May 20, 2024
0.1.0 May 20, 2024

#430 in Network programming

Download history 395/week @ 2024-05-20 17/week @ 2024-05-27 17/week @ 2024-06-03

429 downloads per month

MIT/Apache and maybe LGPL-3.0+

350KB
9K SLoC

logo

Documentation crates.io Build Status

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

~5–20MB
~293K SLoC