matrix2d 0.0.2 copy "matrix2d: ^0.0.2" to clipboard
matrix2d: ^0.0.2 copied to clipboard

outdated

A numpy-like package for mathematical 2d array functions and manipulations for dart

example/example.dart

import 'package:matrix2d/matrix2d.dart';

void main() {
  Matrix2d m2d = Matrix2d();
  List list = [
    [1, 2],
    [1, 2]
  ];
  // Shape
  var shape = m2d.shape(list);
  print(shape);

  // flatten
  var flat = m2d.flatten(list);
  print(flat);

  // transpose
  var transpose = m2d.transpose(list);
  print(transpose);

  // addition
  var add = m2d.addition([
    [1, 1],
    [1, 1]
  ], [
    [2, 2],
    [2, 2]
  ]);
  print(add);

  // subtration
  var sub = m2d.subtraction([
    [1, 1],
    [1, 1]
  ], [
    [2, 2],
    [2, 2]
  ]);
  print(sub);

  // division

  var div = m2d.division([
    [1, 1],
    [1, 1]
  ], [
    [2, 0],
    [2, 2]
  ]);
  print(div);

  // dot operation

  var dot = m2d.dot([
    [1, 2],
    [3, 4]
  ], [
    [11, 12],
    [13, 14]
  ]);
  print(dot);

  // arange

  var arange = m2d.arange(10);
  print(arange);

  // zeros

  var zeros = m2d.zeros(2, 2);
  print(zeros);

  //ones

  var ones = m2d.ones(3, 3);
  print(ones);

  //sum

  var sum = m2d.sum([
    [2, 2],
    [2, 2]
  ]);
  print(sum);

  // reshape
  var reshape = m2d.reshape([
    [0, 1, 2, 3, 4, 5, 6, 7]
  ], 4, 2);
  print(reshape);

  // linspace
  var linspace = m2d.linspace(2, 3, 5);
  print(linspace);

  // diagonal
  var arr = [
    [1, 1, 1],
    [2, 2, 2],
    [3, 3, 3]
  ];
  var diagonal = m2d.diagonal(arr);
  print(diagonal);

  //fill
  var fill = m2d.fill(3, 3, 'matrix2d');
  print(fill);

  // compare object
  var compare = m2d.compareobject(arr, '>', 2);
  print(compare);
}
41
likes
0
pub points
87%
popularity

Publisher

verified publishern4ze3m.site

A numpy-like package for mathematical 2d array functions and manipulations for dart

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

statistical_dart

More

Packages that depend on matrix2d