rethinking design of tensor.

This commit is contained in:
Jordan Hewitt
2024-12-13 09:45:59 -08:00
parent 1162ca9cf9
commit 859f540f4a
2 changed files with 18 additions and 0 deletions

View File

@ -5,6 +5,10 @@ import 'package:collection/collection.dart';
class Tensor extends DelegatingList<DelegatingList<double>> {
Tensor(super.base);
factory Tensor.fromList(List<List<double>> lst) {
return Tensor(DelegatingList(lst.map((e) => DelegatingList(e)).toList()));
}
Tensor each(Function(double, int, int) f) {
Tensor other = Tensor([]);
for (int j = 0; j < length; ++j) {