Comparing version
@@ -0,1 +1,12 @@ | ||
## [6.1.2](https://github.com/mljs/matrix/compare/v6.1.1...v6.1.2) (2019-06-29) | ||
### Bug Fixes | ||
* use more Float64Array in decompositions ([0bd8f1b](https://github.com/mljs/matrix/commit/0bd8f1b)) | ||
* **Matrix:** use Float64Array to improve performance ([9dfe983](https://github.com/mljs/matrix/commit/9dfe983)) | ||
* **SVD:** use Float64Array to avoid deopt ([85acd13](https://github.com/mljs/matrix/commit/85acd13)) | ||
## [6.1.1](https://github.com/mljs/matrix/compare/v6.1.0...v6.1.1) (2019-06-28) | ||
@@ -2,0 +13,0 @@ |
{ | ||
"name": "ml-matrix", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "Matrix manipulation and computation library", | ||
@@ -67,3 +67,3 @@ "main": "matrix.js", | ||
"pretty-hrtime": "^1.0.3", | ||
"rollup": "^1.16.2", | ||
"rollup": "^1.16.3", | ||
"typedoc": "^0.14.2" | ||
@@ -70,0 +70,0 @@ }, |
@@ -17,4 +17,4 @@ import Matrix from '../matrix'; | ||
var V = new Matrix(n, n); | ||
var d = new Array(n); | ||
var e = new Array(n); | ||
var d = new Float64Array(n); | ||
var e = new Float64Array(n); | ||
var value = matrix; | ||
@@ -40,3 +40,3 @@ var i, j; | ||
var H = new Matrix(n, n); | ||
var ort = new Array(n); | ||
var ort = new Float64Array(n); | ||
for (j = 0; j < n; j++) { | ||
@@ -58,7 +58,7 @@ for (i = 0; i < n; i++) { | ||
get realEigenvalues() { | ||
return this.d; | ||
return Array.from(this.d); | ||
} | ||
get imaginaryEigenvalues() { | ||
return this.e; | ||
return Array.from(this.e); | ||
} | ||
@@ -65,0 +65,0 @@ |
@@ -11,3 +11,3 @@ import Matrix from '../matrix'; | ||
var columns = lu.columns; | ||
var pivotVector = new Array(rows); | ||
var pivotVector = new Float64Array(rows); | ||
var pivotSign = 1; | ||
@@ -21,3 +21,3 @@ var i, j, k, p, s, t, v; | ||
LUcolj = new Array(rows); | ||
LUcolj = new Float64Array(rows); | ||
@@ -171,4 +171,4 @@ for (j = 0; j < columns; j++) { | ||
get pivotPermutationVector() { | ||
return this.pivotVector.slice(); | ||
return Array.from(this.pivotVector); | ||
} | ||
} |
@@ -13,3 +13,3 @@ import Matrix from '../matrix'; | ||
var n = value.columns; | ||
var rdiag = new Array(n); | ||
var rdiag = new Float64Array(n); | ||
var i, j, k, s; | ||
@@ -16,0 +16,0 @@ |
@@ -46,10 +46,10 @@ import Matrix from '../matrix'; | ||
var ni = Math.min(m + 1, n); | ||
var s = new Array(ni); | ||
var s = new Float64Array(ni); | ||
var U = new Matrix(m, nu); | ||
var V = new Matrix(n, n); | ||
var e = new Array(n); | ||
var work = new Array(m); | ||
var e = new Float64Array(n); | ||
var work = new Float64Array(m); | ||
var si = new Array(ni); | ||
var si = new Float64Array(ni); | ||
for (let i = 0; i < ni; i++) si[i] = i; | ||
@@ -506,3 +506,3 @@ | ||
get diagonal() { | ||
return this.s; | ||
return Array.from(this.s); | ||
} | ||
@@ -509,0 +509,0 @@ |
import Matrix from './matrix'; | ||
import SingularValueDecomposition from './dc/svd'; | ||
// function used by rowsDependencies | ||
function xrange(n, exception) { | ||
@@ -15,3 +14,2 @@ var range = []; | ||
// function used by rowsDependencies | ||
function dependenciesOneRow( | ||
@@ -18,0 +16,0 @@ error, |
@@ -759,8 +759,2 @@ import rescale from 'ml-array-rescale'; | ||
other = Matrix.checkMatrix(other); | ||
if (this.columns !== other.rows) { | ||
// eslint-disable-next-line no-console | ||
console.warn( | ||
'Number of columns of left matrix are not equal to number of rows of right matrix.' | ||
); | ||
} | ||
@@ -773,3 +767,3 @@ var m = this.rows; | ||
var Bcolj = new Array(n); | ||
var Bcolj = new Float64Array(n); | ||
for (var j = 0; j < p; j++) { | ||
@@ -1439,6 +1433,3 @@ for (var k = 0; k < n; k++) { | ||
for (let i = 0; i < nRows; i++) { | ||
this.data.push([]); | ||
for (let j = 0; j < nColumns; j++) { | ||
this.data[i].push(0); | ||
} | ||
this.data.push(new Float64Array(nColumns)); | ||
} | ||
@@ -1463,3 +1454,3 @@ } else { | ||
} | ||
this.data.push(arrayData[i].slice()); | ||
this.data.push(Float64Array.from(arrayData[i])); | ||
} | ||
@@ -1501,3 +1492,3 @@ } else { | ||
checkRowIndex(this, index, true); | ||
array = checkRowVector(this, array, true); | ||
array = Float64Array.from(checkRowVector(this, array, true)); | ||
this.data.splice(index, 0, array); | ||
@@ -1514,3 +1505,10 @@ this.rows += 1; | ||
for (var i = 0; i < this.rows; i++) { | ||
this.data[i].splice(index, 1); | ||
const newRow = new Float64Array(this.columns - 1); | ||
for (let j = 0; j < index; j++) { | ||
newRow[j] = this.data[i][j]; | ||
} | ||
for (let j = index + 1; j < this.columns; j++) { | ||
newRow[j - 1] = this.data[i][j]; | ||
} | ||
this.data[i] = newRow; | ||
} | ||
@@ -1529,3 +1527,12 @@ this.columns -= 1; | ||
for (var i = 0; i < this.rows; i++) { | ||
this.data[i].splice(index, 0, array[i]); | ||
const newRow = new Float64Array(this.columns + 1); | ||
let j = 0; | ||
for (; j < index; j++) { | ||
newRow[j] = this.data[i][j]; | ||
} | ||
newRow[j++] = array[i]; | ||
for (; j < this.columns + 1; j++) { | ||
newRow[j] = this.data[i][j - 1]; | ||
} | ||
this.data[i] = newRow; | ||
} | ||
@@ -1532,0 +1539,0 @@ this.columns += 1; |
@@ -133,10 +133,2 @@ /** | ||
export function getRange(from, to) { | ||
var arr = new Array(to - from + 1); | ||
for (var i = 0; i < arr.length; i++) { | ||
arr[i] = from + i; | ||
} | ||
return arr; | ||
} | ||
export function newArray(length, value = 0) { | ||
@@ -143,0 +135,0 @@ var array = []; |
@@ -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 { 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'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
309067
0.36%9878
0.03%