gauss_jordan 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

Gauss Jordan #

A simple package for finding Gaussian-Jordan style elimination of matrices.

Takes in a matrix and returns the Reduced Row Echelon Form. This package has no dependencies and only contains one simple method.

Example #

 List<List<double>> matrix = [
                               [3.0, 0.0, -1.0, 0.0, 0.0],
                               [8.0, 0.0, 0.0, -2.0, 0.0],
                               [0.0, 2.0, -2.0, -1.0, 0.0]
                               ];
   print(GaussJordan.solve(matrix).toString());

prints

[[1.0, 0.0, 0.0, -0.25, 0.0], [0.0, 1.0, 0.0, -1.25, 0.0], [0.0, 0.0, 1.0, -0.75, 0.0]]

Full Example #

import "package:gauss_jordan/gauss_jordan.dart";
import 'dart:io';


main(List<String> arguments) {

  print("Enter matrix rows:");
  int rowSize = int.parse(stdin.readLineSync());
  List<List<double>> matrix = List<List<double>>();
  String input = "";
  
  /*Formats input into List<List<double>>
    Example input: 
    2 (matrix rows)
    2.0 0.0 -1.0 0.0
    0.0 2.0 -1.0 0.0
  */ 
  for(int i = 0; i < rowSize; i++){
    String input = stdin.readLineSync();
    List<String> rowString = input.split(" ");
    List<double> rows =  List<double>();
    rowString.forEach((r){
      rows.add(double.parse(r));
    });
    matrix.add(rows);

  }

  List<List<double>> rref = GaussJordan.solve(matrix);
  print(rref.toString());

}

Installation #

Add GaussJordan as a dependency to your dart project.

dependencies:
  gauss_jordan: 1.0.2

and at the top of your dart file add:

import 'package:gauss_jordan/gauss_jordan.dart';

I apologize for any spaghetti code

1.0.2 #

  • Fixed even more errors

1.0.1 #

  • Fixed small errors

1.0.0 #

  • Initial release

example/example.dart

import "package:gauss_jordan/gauss_jordan.dart";
import 'dart:io';


main(List<String> arguments) {

  print("Enter matrix rows:");
  int rowSize = int.parse(stdin.readLineSync());
  List<List<double>> matrix = List<List<double>>();
  String input = "";

  for(int i = 0; i < rowSize; i++){
    String input = stdin.readLineSync();
    List<String> rowString = input.split(" ");
    List<double> rows =  List<double>();
    rowString.forEach((r){
      rows.add(double.parse(r));
    });
    matrix.add(rows);

  }

  List<List<double>> rref = GaussJordan.solve(matrix);
  print(rref.toString());

}

Use this package as a library

1. Depend on it

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


dependencies:
  gauss_jordan: ^1.0.2

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:gauss_jordan/gauss_jordan.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

4 out of 4 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0