smart_arrays_numerics 2.0.3 copy "smart_arrays_numerics: ^2.0.3" to clipboard
smart_arrays_numerics: ^2.0.3 copied to clipboard

outdated

This package provides a number of useful calculation functions for one- and two-dimensional arrays such as multiply, transpose, invert, sum, clone, create.

example/example.dart

// Copyright (c) 2019, Dr. Bruno Guigas. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:smart_arrays_numerics/smart_arrays_numerics.dart';

/// Demonstrates matrix inversion, diagonal, transpose.
main() {
  Numerics nu = Numerics();
  final List<List<double>> mat = [
    [1, 1, 1, 0],
    [0, 3, 1, 2],
    [2, 3, 1, 0],
    [1, 0, 2, 1]
  ];

  List<List<double>> inverse, identity;

  try {
    inverse = nu.invMatrix(mat); // invert
    identity = nu.dotMM(mat, inverse); // product must give identity
    print("inverse=$inverse");
    print("identity=$identity");
    print("diagonal inverse=${nu.getDiag(inverse)}");
  } catch (e) {
    print("not invertible: $mat");
  }

  final List<List<double>> mat2 = [
    [1, 1, 1],
    [0, 3, 1],
    [2, 3, 1],
    [1, 0, 2]
  ];

  List<List<double>> transposed = nu.transpose(mat2);
  print("transposed=$transposed");
  print("diagonal transposed=${nu.getDiag(transposed)}");
}
0
likes
0
pub points
17%
popularity

Publisher

verified publisherhiveright.tech

This package provides a number of useful calculation functions for one- and two-dimensional arrays such as multiply, transpose, invert, sum, clone, create.

Homepage

License

unknown (LICENSE)

Dependencies

build_runner, build_web_compilers, pedantic

More

Packages that depend on smart_arrays_numerics