toaster_linear 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 40

Toaster Linear Algebra Library #

Provides rudimentary Linear Algebra Matrices and Functions

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'package:toaster_linear/toaster_linear.dart';

void main() {
  /// Initialize Matrices using List of Lists
  Matrix m1 = Matrix([
    [2.0, 4.0],
    [6.0, 8.0]
  ]);

  /// Create a 2x3 matrix with default fill value of 0.0
  /// [0.0, 0.0, 0.0],
  /// [0.0, 0.0, 0.0]
  Matrix m2 = Matrix.fill(2, 3);

  /// Create a 2x3 matrix with 4.0 as fill
  /// [4.0, 4.0, 4.0],
  /// [4.0, 4.0, 4.0]
  Matrix m3 = Matrix.fill(2, 3, 4.0);

  /// You can add matrices of the same size
  assert(m3 + m2 == m3);
  m3 += m2;

  /// You can subtract matrices of the same size
  assert(m3 - m2 == m3);
  m3 -= m2;

  /// You can multiply matrices
  m1 *= m2.transpose();

  /// You can scale matrices
  m1 *= 3;

  /// You can transpose matrices
  Matrix m4 = m1.transpose();

  print(m3);
  print(m4);
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • Initial version, created by Stagehand

example/example.dart

import 'package:toaster_linear/toaster_linear.dart';

void main() {
  /// Initialize Matrices using List of Lists
  Matrix m1 = Matrix([
    [2.0, 4.0],
    [6.0, 8.0]
  ]);

  /// Create a 2x3 matrix with default fill value of 0.0
  /// [0.0, 0.0, 0.0],
  /// [0.0, 0.0, 0.0]
  Matrix m2 = Matrix.fill(2, 3);

  /// Create a 2x3 matrix with 4.0 as fill
  /// [4.0, 4.0, 4.0],
  /// [4.0, 4.0, 4.0]
  Matrix m3 = Matrix.fill(2, 3, 4.0);

  /// You can add matrices of the same size
  assert(m3 + m2 == m3);
  m3 += m2;

  /// You can subtract matrices of the same size
  assert(m3 - m2 == m3);
  m3 -= m2;

  /// You can multiply matrices
  m1 *= m2.transpose();

  /// You can scale matrices
  m1 *= 3;

  /// You can transpose matrices
  Matrix m4 = m1.transpose();

  print(m3);
  print(m4);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  toaster_linear: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:toaster_linear/toaster_linear.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
56
Overall:
Weighted score of the above. [more]
40
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:toaster_linear/toaster_linear.dart.

Health suggestions

Fix lib/src/toaster_linear_base.dart. (-1.99 points)

Analysis of lib/src/toaster_linear_base.dart reported 4 hints:

line 30 col 10: Don't type annotate initializing formals.

line 81 col 7: DO use curly braces for all flow control structures.

line 87 col 7: DO use curly braces for all flow control structures.

line 142 col 7: DO use curly braces for all flow control structures.

Fix lib/toaster_linear.dart. (-0.50 points)

Analysis of lib/toaster_linear.dart reported 1 hint:

line 5 col 9: Name libraries using lowercase_with_underscores.

Maintenance suggestions

Package is getting outdated. (-23.84 points)

The package was last published 64 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
Dev dependencies
test ^1.0.0