Matrix<T> class
abstract
A matrix.
Implementations
Example
import 'package:calc/calc.dart';
void main() {
final matrix = Float32Matrix.fromRows([
[1.0, 2.0],
[3.0, 4.0],
]);
}
- Inheritance
- Implementers
Constructors
-
Matrix(TensorShape tensorShape, List<
T> _data)
Properties
-
elements
→ List<
T> -
Returns elements as a list.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
no setter
- isScalar → bool
-
Tells whether the tensor is a scalar.
no setterinherited
- isSquare → bool
-
no setter
- 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.
final
- width → int
-
no setter
Methods
-
clamp(
T lowerLimit, T upperLimit) → Tensor< T> -
Calculates square of each element.
inherited
-
diagonalVector(
) → Float32Vector - Gets diagonal vector.
-
getFlat(
int index) → T -
inherited
-
getXY(
int x, int y) → T - Gets matrix element.
-
matrixMul(
Matrix< T> right) → Matrix<T> - Computes matrix product.
-
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 by1/s
.inherited -
sq(
) → Tensor< T> -
Calculates square of each element.
inherited
-
sqrt(
) → Tensor< T> -
Calculates square root of each element.
inherited
-
toBuilder(
{bool copy = true}) → TensorBuilder< T> -
Constructs a TensorBuilder that has this tensor.
inherited
-
toScalar(
) → T -
Returns a scalar when the tensor has only a single element;
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transpose(
) → Matrix< T> - Computes transpose.
Operators
-
operator *(
Tensor< T> right) → Matrix<T> -
Calculates element-wise product.
override
-
operator +(
Tensor< T> right) → Matrix<T> -
Calculates element-wise sum.
override
-
operator -(
Tensor< T> right) → Matrix<T> -
Calculates element-wise difference.
override
-
operator /(
Tensor< T> right) → Matrix<T> -
Calculates element-wise fraction.
override
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator unary-(
) → Tensor< T> -
Calculates
scale(-1.0)
.inherited