linear-sum-assignment
Advanced tools
Comparing version 1.0.5 to 1.0.7
@@ -1,10 +0,10 @@ | ||
import { xSequentialFill } from 'ml-spectra-processing'; | ||
import { xSequentialFillFromTo } from 'ml-spectra-processing'; | ||
export function getShortestPath(options) { | ||
let { currUnAssCol, dualVariableForColumns, dualVariableForRows, rowAssignments, columnAssignments, matrix, } = options; | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
let pred = new Float64Array(nbRows); | ||
let scannedColumns = new Float64Array(nbColumns); | ||
let scannedRows = new Float64Array(nbRows); | ||
let rows2Scan = Array.from(xSequentialFill({ from: 0, to: nbRows - 1 })); | ||
const { currUnAssCol, dualVariableForColumns, dualVariableForRows, rowAssignments, columnAssignments, matrix, } = options; | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
const pred = new Float64Array(nbRows); | ||
const scannedColumns = new Float64Array(nbColumns); | ||
const scannedRows = new Float64Array(nbRows); | ||
const rows2Scan = Array.from(xSequentialFillFromTo({ from: 0, to: nbRows - 1, size: nbRows })); | ||
let numRows2Scan = nbRows; | ||
@@ -14,3 +14,3 @@ let sink = -1; | ||
let curColumn = currUnAssCol; | ||
let shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
const shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
while (sink === -1) { | ||
@@ -21,4 +21,4 @@ scannedColumns[curColumn] = 1; | ||
for (let curRowScan = 0; curRowScan < numRows2Scan; curRowScan++) { | ||
let curRow = rows2Scan[curRowScan]; | ||
let reducedCost = delta + | ||
const curRow = rows2Scan[curRowScan]; | ||
const reducedCost = delta + | ||
matrix.get(curRow, curColumn) - | ||
@@ -39,3 +39,3 @@ dualVariableForColumns[curColumn] - | ||
} | ||
let closestRow = rows2Scan[closestRowScan]; | ||
const closestRow = rows2Scan[closestRowScan]; | ||
scannedRows[closestRow] = 1; | ||
@@ -73,2 +73,2 @@ numRows2Scan -= 1; | ||
} | ||
//# sourceM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ENBQUM7SUFDSCxDQUFDO0lBQ0Qsc0JBQXNCLENBQUMsWUFBWSxDQUFDLElBQUksS0FBSyxDQUFDO0lBRTlDLEtBQUssSUFBSSxHQUFHLEdBQUcsQ0FBQyxFQUFFLEdBQUcsR0FBRyxTQUFTLEVBQUUsR0FBRyxFQUFFLEVBQUUsQ0FBQztRQUN6QyxJQUFJLGNBQWMsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDO1lBQUUsU0FBUztRQUN4QyxJQUFJLEdBQUcsS0FBSyxZQUFZO1lBQUUsU0FBUztRQUNuQyxzQkFBc0IsQ0FBQyxHQUFHLENBQUM7WUFDekIsS0FBSyxHQUFHLGdCQUFnQixDQUFDLGlCQUFpQixDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFDckQsQ0FBQztJQUNELEtBQUssSUFBSSxHQUFHLEdBQUcsQ0FBQyxFQUFFLEdBQUcsR0FBRyxNQUFNLEVBQUUsR0FBRyxFQUFFLEVBQUUsQ0FBQztRQUN0QyxJQUFJLFdBQVcsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDO1lBQUUsU0FBUztRQUNyQyxtQkFBbUIsQ0FBQyxHQUFHLENBQUMsSUFBSSxLQUFLLEdBQUcsZ0JBQWdCLENBQUMsR0FBRyxDQUFDLENBQUM7SUFDNUQsQ0FBQztJQUVELE9BQU87UUFDTCxJQUFJO1FBQ0osSUFBSTtRQUNKLHNCQUFzQjtRQUN0QixtQkFBbUI7S0FDcEIsQ0FBQztBQUNKLENBQUMifQ== |
@@ -19,5 +19,5 @@ import { Matrix } from 'ml-matrix'; | ||
} | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
let matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
const matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
matrix = matrix.subtract(matrixDelta); | ||
@@ -31,3 +31,3 @@ if (maximaze) | ||
for (let currUnAssCol = 0; currUnAssCol < nbColumns; currUnAssCol++) { | ||
let currentAugmenting = getShortestPath({ | ||
const currentAugmenting = getShortestPath({ | ||
matrix, | ||
@@ -40,3 +40,3 @@ currUnAssCol, | ||
}); | ||
let { sink, pred } = currentAugmenting; | ||
const { sink, pred } = currentAugmenting; | ||
if (sink === -1) { | ||
@@ -56,3 +56,3 @@ return { | ||
rowAssignments[j] = i; | ||
let h = columnAssignments[i]; | ||
const h = columnAssignments[i]; | ||
columnAssignments[i] = j; | ||
@@ -84,2 +84,2 @@ j = h; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUVuQyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFVcEQ7OztHQUdHO0FBRUgsTUFBTSxVQUFVLG1CQUFtQjtBQUNqQzs7R0FFRztBQUNILEtBQTZCLEVBQzdCLFVBQW1CLEVBQUU7SUFFckIsTUFBTSxFQUFFLFFBQVEsR0FBRyxJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUM7SUFFcEMsSUFBSSxNQUFNLEdBQUcsTUFBTSxDQUFDLFdBQVcsQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUN2QyxJQUFJLE9BQU8sR0FBRyxLQUFLLENBQUM7SUFDcEIsSUFBSSxNQUFNLENBQUMsT0FBTyxHQUFHLE1BQU0sQ0FBQyxJQUFJLEVBQUU7UUFDaEMsT0FBTyxHQUFHLElBQUksQ0FBQztRQUNmLE1BQU0sR0FBRyxNQUFNLENBQUMsU0FBUyxFQUFFLENBQUM7S0FDN0I7SUFFRCxJQUFJLE1BQU0sR0FBRyxNQUFNLENBQ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QU0sR0FBRyxDQUFDLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFBRSxNQUFNLEVBQUUsRUFBRSxDQUFDO1FBQ2xELElBQUksSUFBSSxNQUFNLENBQUMsR0FBRyxDQUFDLGlCQUFpQixDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQ3hELENBQUM7SUFFRCxJQUFJLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxJQUFJLEdBQUcsV0FBVyxHQUFHLFNBQVMsQ0FBQztJQUU1RCxJQUFJLE9BQU8sRUFBRSxDQUFDO1FBQ1osQ0FBQyxpQkFBaUIsRUFBRSxjQUFjLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO1FBQzFFLENBQUMsc0JBQXNCLEVBQUUsbUJBQW1CLENBQUMsR0FBRztZQUM5QyxtQkFBbUI7WUFDbkIsc0JBQXNCO1NBQ3ZCLENBQUM7SUFDSixDQUFDO0lBRUQsT0FBTztRQUNMLGNBQWM7UUFDZCxpQkFBaUI7UUFDakIsSUFBSTtRQUNKLHNCQUFzQjtRQUN0QixtQkFBbUI7S0FDcEIsQ0FBQztBQUNKLENBQUMifQ== |
@@ -6,9 +6,9 @@ "use strict"; | ||
function getShortestPath(options) { | ||
let { currUnAssCol, dualVariableForColumns, dualVariableForRows, rowAssignments, columnAssignments, matrix, } = options; | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
let pred = new Float64Array(nbRows); | ||
let scannedColumns = new Float64Array(nbColumns); | ||
let scannedRows = new Float64Array(nbRows); | ||
let rows2Scan = Array.from((0, ml_spectra_processing_1.xSequentialFill)({ from: 0, to: nbRows - 1 })); | ||
const { currUnAssCol, dualVariableForColumns, dualVariableForRows, rowAssignments, columnAssignments, matrix, } = options; | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
const pred = new Float64Array(nbRows); | ||
const scannedColumns = new Float64Array(nbColumns); | ||
const scannedRows = new Float64Array(nbRows); | ||
const rows2Scan = Array.from((0, ml_spectra_processing_1.xSequentialFillFromTo)({ from: 0, to: nbRows - 1, size: nbRows })); | ||
let numRows2Scan = nbRows; | ||
@@ -18,3 +18,3 @@ let sink = -1; | ||
let curColumn = currUnAssCol; | ||
let shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
const shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
while (sink === -1) { | ||
@@ -25,4 +25,4 @@ scannedColumns[curColumn] = 1; | ||
for (let curRowScan = 0; curRowScan < numRows2Scan; curRowScan++) { | ||
let curRow = rows2Scan[curRowScan]; | ||
let reducedCost = delta + | ||
const curRow = rows2Scan[curRowScan]; | ||
const reducedCost = delta + | ||
matrix.get(curRow, curColumn) - | ||
@@ -43,3 +43,3 @@ dualVariableForColumns[curColumn] - | ||
} | ||
let closestRow = rows2Scan[closestRowScan]; | ||
const closestRow = rows2Scan[closestRowScan]; | ||
scannedRows[closestRow] = 1; | ||
@@ -78,2 +78,2 @@ numRows2Scan -= 1; | ||
exports.getShortestPath = getShortestPath; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0U2hvcnRlc3RQYXRoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2dldFNob3J0ZXN0UGF0aC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxpRUFBd0Q7QUFXeEQsU0FBZ0IsZUFBZSxDQUFDLE9BQStCO0lBQzdELElBQUksRUFDRixZQUFZLEVBQ1osc0JBQXNCLEVBQ3RCLG1CQUFtQixFQUNuQixjQUFjLEVBQ2QsaUJBQWlCLEVBQ2pCLE1BQU0sR0FDUCxHQUFHLE9BQU8sQ0FBQztJQUVaLElBQUksT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JQUNyRCxDQUFDO0lBQ0QsS0FBSyxJQUFJLEdBQUcsR0FBRyxDQUFDLEVBQUUsR0FBRyxHQUFHLE1BQU0sRUFBRSxHQUFHLEVBQUUsRUFBRSxDQUFDO1FBQ3RDLElBQUksV0FBVyxDQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUM7WUFBRSxTQUFTO1FBQ3JDLG1CQUFtQixDQUFDLEdBQUcsQ0FBQyxJQUFJLEtBQUssR0FBRyxnQkFBZ0IsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQsT0FBTztRQUNMLElBQUk7UUFDSixJQUFJO1FBQ0osc0JBQXNCO1FBQ3RCLG1CQUFtQjtLQUNwQixDQUFDO0FBQ0osQ0FBQztBQWxGRCwwQ0FrRkMifQ== |
@@ -22,5 +22,5 @@ "use strict"; | ||
} | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
let matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
const matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
matrix = matrix.subtract(matrixDelta); | ||
@@ -34,3 +34,3 @@ if (maximaze) | ||
for (let currUnAssCol = 0; currUnAssCol < nbColumns; currUnAssCol++) { | ||
let currentAugmenting = (0, getShortestPath_1.getShortestPath)({ | ||
const currentAugmenting = (0, getShortestPath_1.getShortestPath)({ | ||
matrix, | ||
@@ -43,3 +43,3 @@ currUnAssCol, | ||
}); | ||
let { sink, pred } = currentAugmenting; | ||
const { sink, pred } = currentAugmenting; | ||
if (sink === -1) { | ||
@@ -59,3 +59,3 @@ return { | ||
rowAssignments[j] = i; | ||
let h = columnAssignments[i]; | ||
const h = columnAssignments[i]; | ||
columnAssignments[i] = j; | ||
@@ -88,2 +88,2 @@ j = h; | ||
exports.linearSumAssignment = linearSumAssignment; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5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BbUIsQ0FBQyxHQUFHO1lBQzlDLG1CQUFtQjtZQUNuQixzQkFBc0I7U0FDdkIsQ0FBQztJQUNKLENBQUM7SUFFRCxPQUFPO1FBQ0wsY0FBYztRQUNkLGlCQUFpQjtRQUNqQixJQUFJO1FBQ0osc0JBQXNCO1FBQ3RCLG1CQUFtQjtLQUNwQixDQUFDO0FBQ0osQ0FBQztBQW5GRCxrREFtRkMifQ== |
{ | ||
"name": "linear-sum-assignment", | ||
"version": "1.0.5", | ||
"version": "1.0.7", | ||
"description": "it performs a linear sum assignment even if the cost matrix is rectangular.", | ||
@@ -21,3 +21,3 @@ "main": "./lib/index.js", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepublishOnly": "npm run tsc", | ||
"prepack": "npm run tsc", | ||
"prettier": "prettier --check src", | ||
@@ -34,8 +34,8 @@ "prettier-write": "prettier --write src", | ||
"type": "git", | ||
"url": "git+https://github.com/jobo322/linear-sum-assignment.git" | ||
"url": "git+https://github.com/mljs/linear-sum-assignment.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jobo322/linear-sum-assignment/issues" | ||
"url": "https://github.com/mljs/linear-sum-assignment/issues" | ||
}, | ||
"homepage": "https://github.com/jobo322/linear-sum-assignment#readme", | ||
"homepage": "https://github.com/mljs/linear-sum-assignment#readme", | ||
"jest": { | ||
@@ -53,18 +53,18 @@ "preset": "ts-jest", | ||
"dependencies": { | ||
"cheminfo-types": "^1.4.0", | ||
"cheminfo-types": "^1.7.3", | ||
"install": "^0.13.0", | ||
"ml-matrix": "^6.10.4", | ||
"ml-spectra-processing": "^12.0.0" | ||
"ml-matrix": "^6.11.0", | ||
"ml-spectra-processing": "^14.2.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.0", | ||
"eslint": "^8.36.0", | ||
"eslint-config-cheminfo-typescript": "^11.3.1", | ||
"jest": "^29.5.0", | ||
"@types/jest": "^29.5.12", | ||
"eslint": "^8.57.0", | ||
"eslint-config-cheminfo-typescript": "^12.2.0", | ||
"jest": "^29.7.0", | ||
"jest-matcher-deep-close-to": "^3.0.2", | ||
"prettier": "^2.8.7", | ||
"rimraf": "^4.4.1", | ||
"ts-jest": "^29.0.5", | ||
"typescript": "^5.0.2" | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"ts-jest": "^29.1.2", | ||
"typescript": "^5.4.2" | ||
} | ||
} |
@@ -72,7 +72,7 @@ # linear sum assignment | ||
[npm-url]: https://www.npmjs.com/package/linearSumAssignment | ||
[ci-image]: https://github.com/jobo322/linearSumAssignment/workflows/Node.js%20CI/badge.svg?branch=main | ||
[ci-url]: https://github.com/jobo322/linearSumAssignment/actions?query=workflow%3A%22Node.js+CI%22 | ||
[codecov-image]: https://img.shields.io/codecov/c/github/jobo322/linearSumAssignment.svg | ||
[codecov-url]: https://codecov.io/gh/jobo322/linearSumAssignment | ||
[ci-image]: https://github.com/mljs/linear-sum-assignment/workflows/Node.js%20CI/badge.svg?branch=main | ||
[ci-url]: https://github.com/mljs/linear-sum-assignment/actions?query=workflow%3A%22Node.js+CI%22 | ||
[codecov-image]: https://img.shields.io/codecov/c/github/mljs/linear-sum-assignment.svg | ||
[codecov-url]: https://codecov.io/gh/mljs/linear-sum-assignment | ||
[download-image]: https://img.shields.io/npm/dm/linearSumAssignment.svg | ||
[download-url]: https://www.npmjs.com/package/linearSumAssignment |
import { DoubleArray } from 'cheminfo-types'; | ||
import type { Matrix } from 'ml-matrix'; | ||
import { xSequentialFill } from 'ml-spectra-processing'; | ||
import { xSequentialFillFromTo } from 'ml-spectra-processing'; | ||
@@ -15,3 +15,3 @@ interface GetShortestPathOptions { | ||
export function getShortestPath(options: GetShortestPathOptions) { | ||
let { | ||
const { | ||
currUnAssCol, | ||
@@ -25,10 +25,12 @@ dualVariableForColumns, | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
let pred = new Float64Array(nbRows); | ||
let scannedColumns = new Float64Array(nbColumns); | ||
let scannedRows = new Float64Array(nbRows); | ||
const pred = new Float64Array(nbRows); | ||
const scannedColumns = new Float64Array(nbColumns); | ||
const scannedRows = new Float64Array(nbRows); | ||
let rows2Scan = Array.from(xSequentialFill({ from: 0, to: nbRows - 1 })); | ||
const rows2Scan = Array.from( | ||
xSequentialFillFromTo({ from: 0, to: nbRows - 1, size: nbRows }), | ||
); | ||
let numRows2Scan = nbRows; | ||
@@ -39,3 +41,3 @@ | ||
let curColumn = currUnAssCol; | ||
let shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
const shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY); | ||
while (sink === -1) { | ||
@@ -46,5 +48,5 @@ scannedColumns[curColumn] = 1; | ||
for (let curRowScan = 0; curRowScan < numRows2Scan; curRowScan++) { | ||
let curRow = rows2Scan[curRowScan]; | ||
const curRow = rows2Scan[curRowScan]; | ||
let reducedCost = | ||
const reducedCost = | ||
delta + | ||
@@ -67,3 +69,3 @@ matrix.get(curRow, curColumn) - | ||
} | ||
let closestRow = rows2Scan[closestRowScan]; | ||
const closestRow = rows2Scan[closestRowScan]; | ||
scannedRows[closestRow] = 1; | ||
@@ -70,0 +72,0 @@ numRows2Scan -= 1; |
@@ -35,6 +35,6 @@ import { DoubleArray } from 'cheminfo-types'; | ||
let nbRows = matrix.rows; | ||
let nbColumns = matrix.columns; | ||
const nbRows = matrix.rows; | ||
const nbColumns = matrix.columns; | ||
let matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
const matrixDelta = maximaze ? matrix.max() : matrix.min(); | ||
matrix = matrix.subtract(matrixDelta); | ||
@@ -49,3 +49,3 @@ if (maximaze) matrix = matrix.mul(-1); | ||
for (let currUnAssCol = 0; currUnAssCol < nbColumns; currUnAssCol++) { | ||
let currentAugmenting = getShortestPath({ | ||
const currentAugmenting = getShortestPath({ | ||
matrix, | ||
@@ -58,3 +58,3 @@ currUnAssCol, | ||
}); | ||
let { sink, pred } = currentAugmenting; | ||
const { sink, pred } = currentAugmenting; | ||
@@ -76,3 +76,3 @@ if (sink === -1) { | ||
rowAssignments[j] = i; | ||
let h = columnAssignments[i]; | ||
const h = columnAssignments[i]; | ||
columnAssignments[i] = j; | ||
@@ -79,0 +79,0 @@ j = h; |
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
37637
518
+ Addedml-spectra-processing@14.6.2(transitive)
+ Addedml-xsadd@3.0.1(transitive)
- Removedml-spectra-processing@12.11.0(transitive)
- Removedml-xsadd@2.0.0(transitive)
Updatedcheminfo-types@^1.7.3
Updatedml-matrix@^6.11.0