diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index bc57d11..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1 +0,0 @@ -extends: cheminfo-typescript diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 71e0af2..0000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Node.js CI - -on: - push: - branches: - - main - pull_request: - -jobs: - nodejs: - # Documentation: https://github.com/zakodium/workflows#nodejs-ci - uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1 - with: - lint-check-types: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7f5db58..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Release - -on: - push: - branches: - - main - -jobs: - release: - # Documentation: https://github.com/zakodium/workflows#release - uses: zakodium/workflows/.github/workflows/release.yml@release-v1 - with: - npm: true - secrets: - github-token: ${{ secrets.BOT_TOKEN }} - npm-token: ${{ secrets.NPM_BOT_TOKEN }} diff --git a/.github/workflows/typedoc.yml b/.github/workflows/typedoc.yml deleted file mode 100644 index 81c1ff6..0000000 --- a/.github/workflows/typedoc.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: TypeDoc - -on: - workflow_dispatch: - release: - types: [published] - -jobs: - typedoc: - # Documentation: https://github.com/zakodium/workflows#typedoc - uses: zakodium/workflows/.github/workflows/typedoc.yml@typedoc-v1 - with: - entry: 'src/index.ts' - secrets: - github-token: ${{ secrets.BOT_TOKEN }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 91a5f1e..0000000 --- a/.gitignore +++ /dev/null @@ -1,81 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless - -# FuseBox cache -.fusebox/ - -lib -lib-esm - -.DS_Store \ No newline at end of file diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 43c97e7..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1b763b1..0000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -CHANGELOG.md diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index a23e760..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arrowParens": "always", - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all" -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 0457f75..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,89 +0,0 @@ -# Changelog - -## [1.0.9](https://github.com/mljs/linear-sum-assignment/compare/v1.0.8...v1.0.9) (2025-10-21) - - -### Bug Fixes - -* update dependencies and fix build ([#25](https://github.com/mljs/linear-sum-assignment/issues/25)) ([a3f2fdc](https://github.com/mljs/linear-sum-assignment/commit/a3f2fdc7bce9ffd5ed1f95c3f35939a18ba9bd6a)) - -## [1.0.8](https://github.com/mljs/linear-sum-assignment/compare/v1.0.7...v1.0.8) (2025-10-21) - - -### Bug Fixes - -* remove unneeded dependency ([aabebd2](https://github.com/mljs/linear-sum-assignment/commit/aabebd2b8f0bedec1c7119849ceccc43ed19526c)) - -## [1.0.7](https://github.com/mljs/linear-sum-assignment/compare/v1.0.6...v1.0.7) (2024-03-16) - - -### Bug Fixes - -* prepack script ([d0b3424](https://github.com/mljs/linear-sum-assignment/commit/d0b3424aa787ce3302931a165f75062d691d765e)) - -## [1.0.6](https://github.com/mljs/linear-sum-assignment/compare/v1.0.5...v1.0.6) (2024-03-07) - - -### Bug Fixes - -* update dependencies ([62dae97](https://github.com/mljs/linear-sum-assignment/commit/62dae97c55bc763df5f1759273af44c8ef1aa8a7)) - -## [1.0.5](https://github.com/mljs/linear-sum-assignment/compare/v1.0.4...v1.0.5) (2023-03-24) - - -### Bug Fixes - -* update dependencies and remove package-lock ([95b5b4d](https://github.com/mljs/linear-sum-assignment/commit/95b5b4d9aac9d6eb87f7680b458fcc38b1112c01)) - -### [1.0.4](https://github.com/jobo322/linear-sum-assignment/compare/v1.0.3...v1.0.4) (2022-05-26) - - -### Bug Fixes - -* use updated dependencies ([#19](https://github.com/jobo322/linear-sum-assignment/issues/19)) ([508cde5](https://github.com/jobo322/linear-sum-assignment/commit/508cde5898fcfd03941f6b464554e6881d5cc35b)) - -### [1.0.3](https://github.com/jobo322/linear-sum-assignment/compare/v1.0.2...v1.0.3) (2022-05-18) - - -### Bug Fixes - -* ensure nbRows <= nbColumns ([3df0e84](https://github.com/jobo322/linear-sum-assignment/commit/3df0e8494d73dfbe90fec2c9ed60629e4fdbe923)) -* wrong pred array size ([0e40eb1](https://github.com/jobo322/linear-sum-assignment/commit/0e40eb158d96910d3619389baed190068766a3a3)) - -### [1.0.2](https://github.com/jobo322/linearSumAssignment/compare/v1.0.1...v1.0.2) (2022-05-16) - - -### Bug Fixes - -* update README ([0dd6f27](https://github.com/jobo322/linearSumAssignment/commit/0dd6f275d0129da3a70fadf81796225a77be63ac)) - -### [1.0.1](https://github.com/jobo322/linearSumAssignment/compare/v1.0.0...v1.0.1) (2022-05-16) - - -### Bug Fixes - -* not upper case in package name ([dfb3bad](https://github.com/jobo322/linearSumAssignment/commit/dfb3bad83fd9d84a468cabd44a206cb939ad1fc3)) - -## 1.0.0 (2022-05-16) - - -### Features - -* add code for rectangular assignment ([8e65d4f](https://github.com/jobo322/linearSumAssignment/commit/8e65d4f9bdbea9dcc5aeb7e0c3bb080dc4c91d10)) -* add github workflows ([904ac79](https://github.com/jobo322/linearSumAssignment/commit/904ac791cea2487f3a0d30f4631a8ad89183de23)) -* rename the package, add README ([74b92c2](https://github.com/jobo322/linearSumAssignment/commit/74b92c288f13d525fcd25ee7cbf51ccdea1805e3)) - - -### Bug Fixes - -* add again workflows ([#4](https://github.com/jobo322/linearSumAssignment/issues/4)) ([2f8d77d](https://github.com/jobo322/linearSumAssignment/commit/2f8d77d5f5b733d5d8ec9862787462b18535dcec)) -* add check-types ([#3](https://github.com/jobo322/linearSumAssignment/issues/3)) ([6aacee5](https://github.com/jobo322/linearSumAssignment/commit/6aacee560819594e3719574db9026d36c29b7358)) -* add package-lock ([5df51e3](https://github.com/jobo322/linearSumAssignment/commit/5df51e340625aebb110fafc72fea3ad69a63e02c)) -* add prettier write script ([#2](https://github.com/jobo322/linearSumAssignment/issues/2)) ([75d1992](https://github.com/jobo322/linearSumAssignment/commit/75d19924283dd6eaa5807e110c70682c32ce8958)) -* add test cases and split code ([d53c4a0](https://github.com/jobo322/linearSumAssignment/commit/d53c4a0ca54609bb654681b8dd06c9e5e768d7e7)) -* branch name ([d353383](https://github.com/jobo322/linearSumAssignment/commit/d3533838153d1cf0c5df1fd637792e349a4ed396)) -* gitHub workflows ([#1](https://github.com/jobo322/linearSumAssignment/issues/1)) ([02efeb0](https://github.com/jobo322/linearSumAssignment/commit/02efeb0108f773e242290f354c89707aa5787dcf)) -* remove comments ([40269cf](https://github.com/jobo322/linearSumAssignment/commit/40269cf7f630ca97f7de123ea5956df95945bfc9)) -* remove support for node 14.x ([#5](https://github.com/jobo322/linearSumAssignment/issues/5)) ([a8d1ca0](https://github.com/jobo322/linearSumAssignment/commit/a8d1ca098fd4dd8d84f880c953cc013d7ab3c7de)) -* set bot_token ([d20d982](https://github.com/jobo322/linearSumAssignment/commit/d20d982d31dd56281e00737da896d608967b90b2)) -* update workflows ([#6](https://github.com/jobo322/linearSumAssignment/issues/6)) ([8540439](https://github.com/jobo322/linearSumAssignment/commit/854043927e593f48876462c46e63e48395eced6f)) diff --git a/README.md b/README.md deleted file mode 100644 index f3f66ff..0000000 --- a/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# linear sum assignment - -
- Package to perform a linear sum assignment even if the cost matrix is rectangular. -
-
-
-
Cost matrix
++ Package to perform a linear sum assignment even if the cost matrix is rectangular. +
+
+
+
This package is the implementation of Jonker-Volgenant shortest +augmenting path algorithm based on the publication On implementing 2D rectangular assignment algorithms
+If the number of rows is <= the number of columns, then every row is assigned to one column; otherwise every column is assigned to one row. The assignment minimizes the sum of the assigned elements.
+$ npm i linear-sum-assignment
import linearSumAssignment from 'linear-sum-assignment';
import { xCostMatrix } from 'ml-spectra-processing';
/**
* there is one more value in the experimental values, so one of
* them will be not assigned.
**/
const experimental = [1, 2, 3, 4, 5, 7];
const predicted = [3.1, 1.1, 1.9, 3.99, 5.2];
/**
* We will compute a cost matrix where experimental are
* rows and predicted in columns.
* In this case we will look for the closest peak for each experimental peak value.
**/
const diff = xCostMatrix(experimental, predicted, {
fct: (a, b) => Math.abs(a - b),
});
const result = linearSumAssignment(diff, { maximaze: false });
console.log(result);
/**
{
rowAssignments: Float64Array(6) [ 1, 2, 0, 3, 4, -1 ],
columnAssignments: Float64Array(5) [ 2, 0, 1, 3, 4 ],
gain: 0.5100000000000002,
dualVariableForColumns: Float64Array(5) [
0.0900000000000003,
0.0900000000000003,
0.0900000000000003,
0,
0.1900000000000004
],
dualVariableForRows: Float64Array(6) [ 0, 0, 0, 0, 0, 0 ]
}
*/
+
+
+rowAssignments contains the index of the column assigned to each element in the rows (experimental).
columnAssignments contains the index of the row assigned to each element in the columns. So the first element in predicted is assigned to third element in experimental.
+dualVariableForColumns and dualVariableForRows are the Lagrange multipliers or dual variables.
+gain the sum of the elements in the cost matrix.
Implementation of Jonker-Volgenant shortest augmenting path algorithm based +on the publication On implementing 2D rectangular assignment algorithms
+