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 6.9.0 to 6.10.0

12

matrix.d.ts

@@ -489,2 +489,8 @@ type MaybeMatrix = AbstractMatrix | ArrayLike<ArrayLike<number>>;

/**
* Returns the maximum value by the given dimension.
* @param by - max by 'row' or 'column'.
*/
max(by: MatrixDimension): number[];
/**
* Returns the index of the maximum value.

@@ -500,2 +506,8 @@ */

/**
* Returns the minimum value by the given dimension.
* @param by - min by 'row' or 'column'.
*/
min(by: MatrixDimension): number[];
/**
* Returns the index of the minimum value.

@@ -502,0 +514,0 @@ */

21

package.json
{
"name": "ml-matrix",
"version": "6.9.0",
"version": "6.10.0",
"description": "Matrix manipulation and computation library",

@@ -27,5 +27,2 @@ "main": "matrix.js",

},
"jest": {
"testEnvironment": "node"
},
"repository": {

@@ -59,17 +56,17 @@ "type": "git",

"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^13.1.3",
"@babel/plugin-transform-modules-commonjs": "^7.17.9",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"benchmark": "^2.1.4",
"csv-parse": "^5.0.4",
"eslint": "^8.10.0",
"eslint-config-cheminfo": "^7.2.2",
"eslint": "^8.13.0",
"eslint-config-cheminfo": "^7.3.0",
"jest": "^27.5.1",
"jest-matcher-deep-close-to": "^3.0.2",
"mathjs": "^10.1.1",
"mathjs": "^10.5.0",
"ml-dataset-iris": "^1.2.1",
"numeric": "^1.2.6",
"prettier": "^2.5.1",
"prettier": "^2.6.2",
"pretty-hrtime": "^1.0.3",
"rollup": "^2.68.0",
"rollup": "^2.70.2",
"rollup-plugin-terser": "^7.0.2"

@@ -76,0 +73,0 @@ },

@@ -565,15 +565,43 @@ import { isAnyArray } from 'is-any-array';

max() {
max(by) {
if (this.isEmpty()) {
return NaN;
}
let v = this.get(0, 0);
for (let i = 0; i < this.rows; i++) {
for (let j = 0; j < this.columns; j++) {
if (this.get(i, j) > v) {
v = this.get(i, j);
switch (by) {
case 'row': {
const max = new Array(this.rows).fill(Number.NEGATIVE_INFINITY);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) > max[row]) {
max[row] = this.get(row, column);
}
}
}
return max;
}
case 'column': {
const max = new Array(this.columns).fill(Number.NEGATIVE_INFINITY);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) > max[column]) {
max[column] = this.get(row, column);
}
}
}
return max;
}
case undefined: {
let max = this.get(0, 0);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) > max) {
max = this.get(row, column);
}
}
}
return max;
}
default:
throw new Error(`invalid option: ${by}`);
}
return v;
}

@@ -597,15 +625,44 @@

min() {
min(by) {
if (this.isEmpty()) {
return NaN;
}
let v = this.get(0, 0);
for (let i = 0; i < this.rows; i++) {
for (let j = 0; j < this.columns; j++) {
if (this.get(i, j) < v) {
v = this.get(i, j);
switch (by) {
case 'row': {
const min = new Array(this.rows).fill(Number.POSITIVE_INFINITY);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) < min[row]) {
min[row] = this.get(row, column);
}
}
}
return min;
}
case 'column': {
const min = new Array(this.columns).fill(Number.POSITIVE_INFINITY);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) < min[column]) {
min[column] = this.get(row, column);
}
}
}
return min;
}
case undefined: {
let min = this.get(0, 0);
for (let row = 0; row < this.rows; row++) {
for (let column = 0; column < this.columns; column++) {
if (this.get(row, column) < min) {
min = this.get(row, column);
}
}
}
return min;
}
default:
throw new Error(`invalid option: ${by}`);
}
return v;
}

@@ -612,0 +669,0 @@

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

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