{{ message }}

# renggli / dart-data

A fast and space efficient library to deal with data in Dart, Flutter and the web.

## Files

Failed to load latest commit information.
Type
Name
Commit time

# Dart Data

Dart Data is a fast and space efficient library to deal with data in Dart, Flutter and the web. As of today this mostly includes data structures and algorithms for vectors and matrices, but at some point might also include graphs and other mathematical structures.

This library is open source, stable and well tested. Development happens on GitHub. Feel free to report issues or create a pull-request there. General questions are best asked on StackOverflow.

The package is hosted on dart packages. Up-to-date class documentation is created with every release.

## Tutorial

Below are step by step instructions of how to use this library. More elaborate examples are included with the examples.

### Installation

Follow the installation instructions on dart packages.

Import the packages into your Dart code using:

```import 'package:data/matrix.dart';
import 'package:data/vector.dart';
import 'package:data/type.dart';```

### How to solve a linear equation?

Solve 'A * x = b', where 'A' is a matrix and 'b' a vector:

```final a = Matrix<double>.fromRows(DataType.float64, [
[2, 1, 1],
[1, 3, 2],
[1, 0, 0],
]);
final b = Vector<double>.fromList(DataType.float64, [4, 5, 6]);
final x = a.solve(b.columnMatrix).column(0);
print(x.format(valuePrinter: Printer.fixed()); // prints '6 15 -23'```

### How to find the eigenvalues of a matrix?

Find the eigenvalues of a matrix 'A':

```final a = Matrix<double>.fromRows(DataType.float64, [
[1, 0, 0, -1],
[0, -1, 0, 0],
[0, 0, 1, -1],
[-1, 0, -1, 0],
]);
final decomposition = a.eigenvalue;
final eigenvalues = Vector<double>.fromList(
DataType.float64, decomposition.realEigenvalues);
print(eigenvalues.format(valuePrinter: Printer.fixed(precision: 1))); // prints '-1.0 -1.0 1.0 2.0'```

## Misc

The matrix decomposition algorithms are a direct port of the JAMA: A Java Matrix Package, that is released under public domain.

A fast and space efficient library to deal with data in Dart, Flutter and the web.