Float32Matrix class

Floating-point matrix that stores elements in Float32List.

Example

import 'package:calc/calc.dart';

void main() {
  final matrix = Matrixf.fromRows([
    [1.0, 2.0],
    [3.0, 4.0],
  ]);
}
Inheritance
Mixed in types

Constructors

Float32Matrix.filled(int width, int height, [double value = 0.0])
Constructs matrix with the given width and height.
factory
Float32Matrix.fromColumns(Iterable<List<double>> columns)
Constructs a matrix from columns.
factory
Float32Matrix.fromColumnVector(Iterable<double> elements)
Constructs a matrix from a column vector.
factory
Float32Matrix.fromDiagonal(Iterable<double> diagonal)
Constructs a matrix from the diagonal value.
factory
Float32Matrix.fromRows(Iterable<List<double>> rows)
Constructs a matrix from rows.
factory
Float32Matrix.fromRowVector(Iterable<double> elements)
Constructs a matrix from a row vector.
factory
Float32Matrix.withFloat32List(Float32List rows, {required int width})
Constructs a matrix that uses the given Float32List for storing rows.
factory

Properties

elements List<double>
Returns elements as a list.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height int
no setterinherited
isScalar bool
Tells whether the tensor is a scalar.
no setterinherited
isSquare bool
no setterinherited
isZero bool
Tells whether all elements are zero.
no setterinherited
length int
Returns number of elements in the tensor.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tensorShape TensorShape
Returns shape of the tensor.
finalinherited
width int
no setterinherited

Methods

clamp(double lowerLimit, double upperLimit) Tensor<double>
Calculates square of each element.
inherited
diagonalVector() Float32Vector
Gets diagonal vector.
inherited
getFlat(int index) double
inherited
getXY(int x, int y) double
Gets matrix element.
inherited
matrixMul(Matrix<double> right) Float32Matrix
Computes matrix product.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(num s) Tensor
Multiplies every element by scalar s.
inherited
scaleInverse(num s) Tensor
Divides every element is divided by scalar s. This may be numerically more accurate than multiplying by 1/s.
inherited
sq() Tensor<double>
Calculates square of each element.
inherited
sqrt() Tensor<double>
Calculates square root of each element.
inherited
toBuilder({bool copy = true}) Float32TensorBuilder
Constructs a TensorBuilder that has this tensor.
override
toScalar() double
Returns a scalar when the tensor has only a single element;
inherited
toString() String
A string representation of this object.
override
transpose() Matrix<double>
Computes transpose.
inherited

Operators

operator *(Tensor<double> right) Matrix<double>
Calculates element-wise product.
inherited
operator +(Tensor<double> right) Matrix<double>
Calculates element-wise sum.
inherited
operator -(Tensor<double> right) Matrix<double>
Calculates element-wise difference.
inherited
operator /(Tensor<double> right) Matrix<double>
Calculates element-wise fraction.
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator unary-() Tensor<double>
Calculates scale(-1.0).
inherited