LazyBinaryOperation class
Lazy element-wise binary operation between two arrays.
Defers element-wise operations between two NDArrays until needed. Both arrays must have the same shape.
Example:
var arr1 = NDArray([[1, 2], [3, 4]]);
var arr2 = NDArray([[5, 6], [7, 8]]);
var lazyAdd = LazyBinaryOperation(arr1, arr2, (a, b) => a + b);
// Access single element (only computes that element)
var val = lazyAdd.compute([0, 0]); // 6 (1 + 5)
// Materialize the entire result
var result = lazyAdd.materialize();
// [[6, 8], [10, 12]]
- Inheritance
-
- Object
- LazyOperation
- LazyBinaryOperation
Constructors
- LazyBinaryOperation(NDArray left, NDArray right, dynamic operation(dynamic, dynamic))
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- left → NDArray
-
final
- operation → dynamic Function(dynamic, dynamic)
-
final
- right → NDArray
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → Shape
-
Shape of the result
no setteroverride
Methods
-
compute(
List< int> indices) → dynamic -
Compute value at specific indices
override
-
materialize(
) → NDArray -
Materialize the entire operation into an NDArray
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
optimize(
) → LazyOperation -
Optimize the operation (e.g., fusion)
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited