# [−][src]Crate sparse21

Solving large systems of linear equations using sparse matrix methods. ```let mut m = sparse21::Matrix::from_entries(vec![
(0, 0, 1.0),
(0, 1, 1.0),
(0, 2, 1.0),
(1, 1, 2.0),
(1, 2, 5.0),
(2, 0, 2.0),
(2, 1, 5.0),
(2, 2, -1.0),
]);

let soln = m.solve(vec![6.0, -4.0, 27.0]);
// => vec![5.0, 3.0, -2.0]```

Sparse methods are primarily valuable for systems in which the number of non-zero entries is substantially less than the overall size of the matrix. Such situations are common in physical systems, including electronic circuit simulation. All elements of a sparse matrix are assumed to be zero-valued unless indicated otherwise.

## Usage

Sparse21 exposes two primary data structures:

• `Matrix` represents an `f64`-valued sparse matrix
• `System` represents a system of linear equations of the form `Ax=b`, including a `Matrix` (A) and right-hand-side `Vec` (b).

Once matrices and systems have been created, their primary public method is `solve`, which returns a (dense) `Vec` solution-vector.

## Structs

 Matrix Sparse Matrix System Sparse Matrix System