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
-
ceil(
) → Tensor< T> -
Calculates
x.ceil()
for each element.inherited -
clamp(
T lowerLimit, T upperLimit) → Tensor< T> -
Calculates
x.clamp(lowerLimit, upperLimit)
for each element.inherited -
cos(
) → Tensor< T> -
Calculates
cos(x)
for each element.inherited -
diagonalVector(
) → Float32Vector - Gets diagonal vector.
-
div(
Tensor< T> right, {bool noNan = false}) → Tensor<T> -
Calculates element-wise fraction.
inherited
-
divScalar(
num right, {bool noNan = false, bool swapArguments = false}) → Tensor< T> -
Calculates element-wise fraction.
inherited
-
exp(
) → Tensor< T> -
Calculates
exp(x)
for each element.inherited -
floor(
) → Tensor< T> -
Calculates
x.floor()
for each element.inherited -
getFlat(
int index) → T -
inherited
-
getXY(
int x, int y) → T - Gets matrix element.
-
log(
) → Tensor< T> -
Calculates
log(x)
for each element.inherited -
matrixMul(
Matrix< T> right) → Matrix<T> - Computes matrix product.
-
max(
Tensor< T> right) → Tensor<T> -
Calculates element-wise maximum.
inherited
-
min(
Tensor< T> right) → Tensor<T> -
Calculates element-wise minimum.
inherited
-
mulScalar(
num s) → Tensor -
Multiplies tensor elements with a scalar.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pow(
Tensor< T> right) → Tensor<T> -
Calculates element-wise power.
inherited
-
scale(
num s) → Tensor -
inherited
-
scaleInverse(
num s) → Tensor -
inherited
-
sin(
) → Tensor< T> -
Calculates
sin(x)
for each element.inherited -
sq(
) → Tensor< T> -
Calculates
x * x
(square) for each element.inherited -
sqrt(
) → Tensor< T> -
Calculates
sqrt(x)
(square root) for each element.inherited -
tan(
) → Tensor< T> -
Calculates
tan(x)
for 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> -
A shorthand for div.
override
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator unary-(
) → Tensor< T> -
Calculates
scale(-1.0)
.inherited