Comparing version 2.0.0 to 2.0.1
@@ -47,2 +47,3 @@ /** | ||
this.length = this.rows * this.cols; | ||
this._cache = null; | ||
@@ -522,3 +523,6 @@ var setInitial = opt_setInitial === undefined ? true : opt_setInitial; | ||
var matrixOfMinors = new Matrix(numRows, numCols); | ||
// By using a cache, only the first call to invert will cause a memory increase. | ||
var cache = this._cache || (this._cache = {}); | ||
var matrixOfMinors = cache.matrixOfMinors || (cache.matrixOfMinors = new Matrix(numRows, numCols, false)); | ||
var matrix = cache.tempMatrix || (cache.tempMatrix = new Matrix(this.rows, this.cols, false)); | ||
@@ -533,7 +537,6 @@ // Loop through each number in the matrix | ||
// we remove the first row and the column where the number is. | ||
var matrix = new Matrix(this.rows, this.cols, false); | ||
var newData = this.getData(); | ||
newData = removeRow(newData, row, this.cols); | ||
newData = removeColumn(newData, col, this.cols); | ||
matrix.setData(newData, matrix.rows - 1, matrix.cols - 1); | ||
matrix.setData(newData, this.rows - 1, this.cols - 1); | ||
@@ -625,2 +628,6 @@ // Set the determinant in the correct position in the matrix of minors. | ||
// By using a cache, only the first call to the method will cause a memory increase. | ||
var cache = this._cache || (this._cache = {}); | ||
var matrix = cache.tempMatrix || (cache.tempMatrix = new Matrix(this.rows, this.cols, false)); | ||
// Loop through each number for the first row | ||
@@ -632,7 +639,6 @@ for (var col = 0; col < cols; col++) { | ||
// we remove the first row and the column where the number is. | ||
var matrix = new Matrix(this.rows, this.cols, false); | ||
var newData = this.getData(); | ||
newData = removeRow(newData, 0, this.cols); | ||
newData = removeColumn(newData, col, this.cols); | ||
matrix.setData(newData, matrix.rows - 1, matrix.cols - 1); | ||
matrix.setData(newData, this.rows - 1, this.cols - 1); | ||
@@ -639,0 +645,0 @@ result += (col % 2 ? -1 : 1) * this[col] * matrix.getDeterminant(); |
{ | ||
"name": "matrixmath", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Johannes Koggdal <johannes@koggdal.com>", | ||
@@ -5,0 +5,0 @@ "description": "Library for working with mathematical matrices.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53654
1111