Provides an immutable implementation for matrices of real numbers in Dart, based on Java's JAMA package.
Example:
// Instantiates the following matrix:
//
// 1.0 2.0 3.0
// 4.0 5.0 6.0
//
var matrix = new Matrix([
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0]
]);
var transpose = matrix.transpose;
var product = matrix * transpose;
For a complete overview of the operations available, have a look at the API documentation for the Matrix class.
BREAKING: removes GenericMatrix
class. This felt like a really
overengineered solution and required some leakiness with regards to the
immutability. The core of this library is now much less complex. If you were
using GenericMatrix
, please open an issue.
BREAKING: removes Matrix.withValues
. Was only necessary to support the
GenericMatrix
construct.
BREAKING: removes Matrix.withValuesTranspose
. Was only necessary to support
the GenericMatrix
construct.
BREAKING: removes fromFloat32List
constructor. Use fromList
instead.
BREAKING: removes []
operator from matrix class. Use Matrix.rowAt
instead.
BREAKING: replaces Matrix
's default constructor. The default constructor now
takes a list of lists:
var matrix = new Matrix([
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
[7.0, 8.0, 9.0]
]);
Each list represents a row in the matrix. All row lists must of of equal length.
The Matrix
class' default constructor behaved identically to the fromList
constructor. The simplest way to fix existing code that used the default
constructor is to run a "replace all" for new Matrix(
with
new Matrix.fromList(
.
This release includes some sweeping breaking changes. However, I feel these changes address most of the issues I had with the library in its prior state.
Changes the rowEnd
and colEnd
indices for subMatrix
from being inclusive
to being exclusive. This matches conventions in the Dart standard library.
This means that the rowEnd
and colEnd
indices need to be incremented by
one, e.g.:
matrix.subMatrix(0, 2, 0, 2);
Becomes:
matrix.subMatrix(0, 3, 0, 3);
Adds autogenerated implementation using Float64List
for better precision.
BC break: as of this version, the matrix implementation uses a Float32List
for
value memory. This should constitute a significant performance boost, but also
means that matrices now need to be instantiated with double
values and can
no longer be instantiated with int
values:
var matrix = new Matrix([1, 2, 3,
4, 5, 6], 3);
// Needs to be replaced with:
var matrix = new Matrix([1.0, 2.0, 3.0,
4.0, 5.0, 6.0], 3);
BC break: the brackets operator []
implementation was removed from
GenericMatrix
and added to Matrix
. It's now up to a subclass of
GenericMatrix
whether or not to implement the []
operator and to decide
what the return type should be:
class ColumnVector extends GenericMatrix<ColumnVector, RowVector> {
...
num operator [](int index) => valueAt(index, 0);
}
Adds a brackets []
operator to matrices. This allows you to get the value at
a specific position in the matrix:
var matrix = new Matrix([1, 2, 3,
4, 5, 6], 3);
print(matrix[1][2]); // 6
Rows and columns are zero indexed, so [0][0]
is the top left value.
Also adds a custom equality ==
operator, which will find 2 matrices to be
equal if their dimensions are equal and they contain the same values.
var matrix1 = new Matrix([1, 2, 3,
4, 5, 6], 3);
var matrix2 = new Matrix([1, 2, 3,
4, 5, 6], 3);
print(matrix1 == matrix2); // true
It does not check the matrix object types, so an instance of a custom subclass
of GenericMatrix
may still be equal to an instance of Matrix
if the
dimensions and values match.
Add this to your package's pubspec.yaml file:
dependencies:
rl_matrix: ^0.6.5
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:rl_matrix/rl_matrix.dart';
Version  Uploaded  Documentation  Archive 

0.6.5  Jun 29, 2017  
0.6.4  Dec 1, 2016  
0.6.3  Dec 1, 2016  
0.6.2  Aug 15, 2016  
0.6.1  Aug 4, 2016  
0.6.0  Aug 3, 2016  
0.5.4  Jul 31, 2016  
0.5.3  Jun 29, 2016  
0.5.2  May 7, 2016  
0.5.1  May 3, 2016 
Popularity:
Describes how popular the package is relative to other packages.
[more]

11

Health:
Code health derived from static analysis.
[more]



Maintenance:
Reflects how tidy and uptodate the package is.
[more]



Overall:
Weighted score of the above.
[more]

6

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in pubspec.yaml
.
The SDK constraint in pubspec.yaml
doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart2#migration.
Make sure dartdoc
successfully runs on your package's source files. (10 points)
Dependencies were not resolved.
Package  Constraint  Resolved  Available 

Direct dependencies  
Dart SDK  >=1.19.0 <2.0.0 