Skip to content

Commit

Permalink
documentation corrected, examples for Matrix.row and Matrix.column co…
Browse files Browse the repository at this point in the history
…nstructors usage added
  • Loading branch information
gyrdym committed Nov 5, 2019
1 parent 4370b86 commit 191da24
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
35 changes: 35 additions & 0 deletions README.md
Expand Up @@ -36,6 +36,8 @@
- [Creation of diagonal matrix](#creation-of-diagonal-matrix)
- [Creation of scalar matrix](#creation-of-scalar-matrix)
- [Creation of identity matrix](#creation-of-identity-matrix)
- [Creation of column matrix](#creation-of-column-matrix)
- [Creation of row matrix](#creation-of-row-matrix)
- [Sum of a matrix and another matrix](#sum-of-a-matrix-and-another-matrix)
- [Sum of a matrix and a scalar](#sum-of-a-matrix-and-a-scalar)
- [Multiplication of a matrix and a vector](#multiplication-of-a-matrix-and-a-vector)
Expand Down Expand Up @@ -379,6 +381,39 @@ Matrix 5 x 5:
(0.0, 0.0, 0.0, 0.0, 1.0)
```

#### Creation of column matrix
````dart
final matrix = Matrix.column([1, 2, 3, 4, 5]);
print(matrix);
````

The output:

```
Matrix 5 x 1:
(1.0)
(2.0)
(3.0)
(4.0)
(5.0)
```

#### Creation of row matrix

````dart
final matrix = Matrix.row([1, 2, 3, 4, 5]);
print(matrix);
````

The output:

```
Matrix 1 x 5:
(1.0, 2.0, 3.0, 4.0, 5.0)
```

#### Sum of a matrix and another matrix
````Dart
import 'package:ml_linalg/linalg.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/matrix.dart
Expand Up @@ -158,7 +158,7 @@ abstract class Matrix implements Iterable<Iterable<double>> {
}
}

/// Creates a matrix, consisting of just one row (aka row vector)
/// Creates a matrix, consisting of just one row (aka `Row matrix`)
///
/// ````dart
/// final matrix = Matrix.row([1, 2, 3, 4, 5]);
Expand All @@ -182,7 +182,7 @@ abstract class Matrix implements Iterable<Iterable<double>> {
}
}

/// Creates a matrix, consisting of just one column (aka column vector)
/// Creates a matrix, consisting of just one column (aka `Column matrix`)
///
/// ````dart
/// final matrix = Matrix.column([1, 2, 3, 4, 5]);
Expand Down Expand Up @@ -292,7 +292,7 @@ abstract class Matrix implements Iterable<Iterable<double>> {

/// Tries to convert the matrix to a vector.
///
/// It fails, if the [columnsNum] and [rowsNum] are greater than `1`
/// It fails, if both [columnsNum] and [rowsNum] are greater than `1`
Vector toVector();

/// Returns max value of the matrix
Expand Down

0 comments on commit 191da24

Please sign in to comment.