Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ml-matrix

Package Overview
Dependencies
Maintainers
7
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-matrix - npm Package Compare versions

Comparing version 5.2.1 to 5.3.0

15

History.md

@@ -0,1 +1,16 @@

# [5.3.0](https://github.com/mljs/matrix/compare/v5.2.1...v5.3.0) (2019-03-23)
### Bug Fixes
* add isEchelonForm and isReducedEchelonForm to typings ([690edd1](https://github.com/mljs/matrix/commit/690edd1))
* correct matrix.d.ts file. ([#86](https://github.com/mljs/matrix/issues/86)) ([ebb273c](https://github.com/mljs/matrix/commit/ebb273c))
### Features
* add isEchelonForm and isReducedEchelonForm ([#84](https://github.com/mljs/matrix/issues/84)) ([dee2a94](https://github.com/mljs/matrix/commit/dee2a94))
## [5.2.1](https://github.com/mljs/matrix/compare/v5.2.0...v5.2.1) (2019-01-07)

@@ -2,0 +17,0 @@

16

matrix.d.ts

@@ -67,7 +67,11 @@ declare module 'ml-matrix' {

}
class Matrix {
export class Matrix {
readonly size: number;
readonly rows: number;
readonly columns: number;
constructor(nRows: number, nColumns: number);
constructor(data: number[][]);
constructor(otherMatrix: Matrix);
static from1DArray(

@@ -99,2 +103,3 @@ newRows: number,

static isMatrix(value: any): value is Matrix;
apply(callback: Function): Matrix;

@@ -108,8 +113,11 @@ to1DArray(): number[];

isSymmetric(): boolean;
isEchelonForm(): boolean;
isReducedEchelonForm(): boolean;
set(rowIndex: number, columnIndex: number, value: number): Matrix;
get(rowIndex: number, columnIndex: number): number;
repeat(rowRep: number, colRep: number): Matrix;
fill(value: number): Matrix;
fill(value: number): this;
neg(): Matrix;
negate(): Matrix;
addRow(index: number, array: number[] | Matrix): this;
getRow(index: number): number[];

@@ -119,2 +127,3 @@ getRowVector(index: number): Matrix;

swapRows(row1: number, row2: number): Matrix;
addColumn(index: number, array: number[] | Matrix): this;
getColumn(index: number): number[];

@@ -207,3 +216,3 @@ getColumnVector(index: number): Matrix;

determinant(): number;
pseudoInverse(threshold: number): Matrix;
pseudoInverse(threshold?: number): Matrix;
clone(): Matrix;

@@ -321,3 +330,2 @@

export default Matrix;
export { Matrix };

@@ -324,0 +332,0 @@ class SingularValueDecomposition {

{
"name": "ml-matrix",
"version": "5.2.1",
"version": "5.3.0",
"description": "Matrix manipulation and computation library",

@@ -55,13 +55,13 @@ "main": "matrix.js",

"benchmark": "^2.1.4",
"csv-parse": "^4.2.0",
"eslint": "^5.10.0",
"eslint-config-cheminfo": "^1.19.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"jest": "^23.6.0",
"csv-parse": "^4.3.4",
"eslint": "^5.15.3",
"eslint-config-cheminfo": "^1.20.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"jest": "^24.5.0",
"jest-matcher-deep-close-to": "^1.3.0",
"mathjs": "^5.4.0",
"mathjs": "^5.8.0",
"numeric": "^1.2.6",
"pretty-hrtime": "^1.0.3",
"rollup": "^0.67.4"
"rollup": "^1.7.0"
},

@@ -68,0 +68,0 @@ "dependencies": {

@@ -0,0 +0,0 @@ # ml-matrix

@@ -347,2 +347,63 @@ import rescale from 'ml-array-rescale';

/**
* @return true if the matrix is in echelon form
*/
isEchelonForm() {
let i = 0;
let j = 0;
let previousColumn = -1;
let isEchelonForm = true;
let checked = false;
while ((i < this.rows) && (isEchelonForm)) {
j = 0;
checked = false;
while ((j < this.columns) && (checked === false)) {
if (this.get(i, j) === 0) {
j++;
} else if ((this.get(i, j) === 1) && (j > previousColumn)) {
checked = true;
previousColumn = j;
} else {
isEchelonForm = false;
checked = true;
}
}
i++;
}
return isEchelonForm;
}
/**
* @return true if the matrix is in reduced echelon form
*/
isReducedEchelonForm() {
let i = 0;
let j = 0;
let previousColumn = -1;
let isReducedEchelonForm = true;
let checked = false;
while ((i < this.rows) && (isReducedEchelonForm)) {
j = 0;
checked = false;
while ((j < this.columns) && (checked === false)) {
if (this.get(i, j) === 0) {
j++;
} else if ((this.get(i, j) === 1) && (j > previousColumn)) {
checked = true;
previousColumn = j;
} else {
isReducedEchelonForm = false;
checked = true;
}
}
for (let k = j + 1; k < this.rows; k++) {
if (this.get(i, k) !== 0) {
isReducedEchelonForm = false;
}
}
i++;
}
return isReducedEchelonForm;
}
/**
* Sets a given element of the matrix. mat.set(3,4,1) is equivalent to mat[3][4]=1

@@ -349,0 +410,0 @@ * @abstract

@@ -0,0 +0,0 @@ import { Matrix, WrapperMatrix2D } from '../index';

@@ -0,0 +0,0 @@ import { Matrix, WrapperMatrix2D } from '../index';

@@ -0,0 +0,0 @@ import { Matrix, WrapperMatrix2D } from '../index';

@@ -0,0 +0,0 @@ import { Matrix, WrapperMatrix2D } from '../index';

@@ -0,0 +0,0 @@ import { Matrix, WrapperMatrix2D } from '../index';

@@ -0,0 +0,0 @@ export function hypotenuse(a, b) {

@@ -0,0 +0,0 @@ import LuDecomposition from './dc/lu';

@@ -0,0 +0,0 @@ export { default, default as Matrix } from './matrix';

@@ -0,0 +0,0 @@ import max from 'ml-array-max';

@@ -0,0 +0,0 @@ import AbstractMatrix from './abstractMatrix';

@@ -0,0 +0,0 @@ import Matrix from './matrix';

@@ -0,0 +0,0 @@ import AbstractMatrix from '../abstractMatrix';

@@ -0,0 +0,0 @@ import BaseView from './base';

@@ -0,0 +0,0 @@ import { checkColumnIndices } from '../util';

@@ -0,0 +0,0 @@ import BaseView from './base';

@@ -0,0 +0,0 @@ import BaseView from './base';

@@ -0,0 +0,0 @@ import BaseView from './base';

@@ -0,0 +0,0 @@ import { checkRowIndices } from '../util';

@@ -0,0 +0,0 @@ import { checkIndices } from '../util';

@@ -0,0 +0,0 @@ import { checkRange } from '../util';

@@ -0,0 +0,0 @@ import BaseView from './base';

@@ -0,0 +0,0 @@ import WrapperMatrix1D from './WrapperMatrix1D';

@@ -0,0 +0,0 @@ import AbstractMatrix from '../abstractMatrix';

@@ -0,0 +0,0 @@ import AbstractMatrix from '../abstractMatrix';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc