{"_id":"@augustinmauroy/matrix-n","_rev":"5-f742b196f073528e3b08c269a8398f4f","name":"@augustinmauroy/matrix-n","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"@augustinmauroy/matrix-n","version":"0.1.0","author":{"name":"Augustin Mauroy"},"license":"MIT","_id":"@augustinmauroy/matrix-n@0.1.0","maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"homepage":"https://github.com/AugustinMauroy/matrix-n#readme","bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"dist":{"shasum":"970f085ac5b906cbdcf525a6756503b5af44bd66","tarball":"https://registry.npmjs.org/@augustinmauroy/matrix-n/-/matrix-n-0.1.0.tgz","fileCount":6,"integrity":"sha512-lg3lrQ6UHu4sZ//tkNnyq55qEjHLirfonWmFa+irX/7EOWjOEN9/u5Wczhr//Ig+nCvRCrGaj7WIR6fuVQ8k3Q==","signatures":[{"sig":"MEYCIQD4RI2e91lvH0qwHQCax9KyIlecC1gepzTC3RTx6uz5xQIhAMHpATRGG7WeaUb0RDxrPG5qtEgIJLQVGcn0X7OW6Qyi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@augustinmauroy%2fmatrix-n@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":54312},"main":"dist/mod.js","type":"module","types":"./dist/mod.d.ts","gitHead":"54ba3a66e22e86e0ce932a56cede2d4b4eca6c2f","scripts":{"test":"node --test tests/**/*.test.ts","build":"tsc","biome:ci":"biome ci ./","biome:lint":"biome lint ./","pre-commit":"node --run biome:lint:fix; node --run biome:format:fix","types:check":"tsc --noEmit","biome:format":"biome format ./","test:coverage":"node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout tests/**/*.test.ts","biome:lint:fix":"biome lint --fix ./","biome:format:fix":"biome format --fix ./"},"_npmUser":{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"},"repository":{"url":"git+https://github.com/AugustinMauroy/matrix-n.git","type":"git"},"_npmVersion":"11.3.0","description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","directories":{},"_nodeVersion":"24.0.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.17","@biomejs/biome":"^1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/matrix-n_0.1.0_1747077545358_0.7807435450968303","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@augustinmauroy/matrix-n","version":"0.1.1","author":{"name":"Augustin Mauroy"},"license":"MIT","_id":"@augustinmauroy/matrix-n@0.1.1","maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"homepage":"https://github.com/AugustinMauroy/matrix-n#readme","bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"dist":{"shasum":"be7f043cd17a7eec7ab9d09e056ff197f359c09c","tarball":"https://registry.npmjs.org/@augustinmauroy/matrix-n/-/matrix-n-0.1.1.tgz","fileCount":6,"integrity":"sha512-iuENYhsTnc940IJyK1hPYaqOtekM70JxdXLT3wWEM9UXZrIZRUr/SztB6ZEL4vg25B9dbPjOiIbr3zWSldBqLA==","signatures":[{"sig":"MEUCIQC1VGsRzpdWPoBPRjjF1WcZJt3rUgxV+hzPDSMHDqsb8AIgFdt8Zy9lotSd5aIH5V3LdA24J4YrWbQUGTX3i7U2ty0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@augustinmauroy%2fmatrix-n@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":54328},"main":"dist/mod.js","type":"module","types":"./dist/mod.d.ts","gitHead":"9383f36f7f0e17bd66f51d14389542d4755aec48","scripts":{"test":"node --test tests/**/*.test.ts","build":"tsc","biome:ci":"biome ci ./","biome:lint":"biome lint ./","pre-commit":"node --run biome:lint:fix; node --run biome:format:fix","types:check":"tsc --noEmit","biome:format":"biome format ./","test:coverage":"node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout tests/**/*.test.ts","biome:lint:fix":"biome lint --fix ./","biome:format:fix":"biome format --fix ./"},"_npmUser":{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"},"repository":{"url":"git+https://github.com/AugustinMauroy/matrix-n.git","type":"git"},"_npmVersion":"11.3.0","description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","directories":{},"_nodeVersion":"24.0.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.17","@biomejs/biome":"^1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/matrix-n_0.1.1_1747078564824_0.4763598039883168","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@augustinmauroy/matrix-n","version":"0.1.2","author":{"name":"Augustin Mauroy"},"license":"MIT","_id":"@augustinmauroy/matrix-n@0.1.2","maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"homepage":"https://github.com/AugustinMauroy/matrix-n#readme","bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"dist":{"shasum":"0626fd25ecdf3e94c75b79964280ecd0fb0801b9","tarball":"https://registry.npmjs.org/@augustinmauroy/matrix-n/-/matrix-n-0.1.2.tgz","fileCount":6,"integrity":"sha512-Uj4W85mx/cH7lYFtnASHIsgz9O7MVINyY1g+bfFIwecQamE2znkG5iY5MfjJR+2EAWChJPiWygMxxL38CpKxBA==","signatures":[{"sig":"MEYCIQCyjDhFrg23wnLfaaPgtfC6jm43BNuUK8hQsCXo4dvcXQIhAJIuCoqkiAspnkv2a63DPfmkyDn6yETx1R+aapxqtp5S","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@augustinmauroy%2fmatrix-n@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":54468},"main":"dist/mod.js","type":"module","types":"./dist/mod.d.ts","gitHead":"0f0fdc3d40c6e67013ace0cd549936751623886a","scripts":{"test":"node --test tests/**/*.test.ts","build":"tsc","biome:ci":"biome ci ./","biome:lint":"biome lint ./","pre-commit":"node --run biome:lint:fix; node --run biome:format:fix","types:check":"tsc --noEmit","biome:format":"biome format ./","test:coverage":"node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout tests/**/*.test.ts","biome:lint:fix":"biome lint --fix ./","biome:format:fix":"biome format --fix ./"},"_npmUser":{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"},"repository":{"url":"git+https://github.com/AugustinMauroy/matrix-n.git","type":"git"},"_npmVersion":"11.3.0","description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","directories":{},"_nodeVersion":"24.1.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.17","@biomejs/biome":"^1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/matrix-n_0.1.2_1748856751601_0.23252841092392385","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@augustinmauroy/matrix-n","version":"0.2.0","author":{"name":"Augustin Mauroy"},"license":"MIT","_id":"@augustinmauroy/matrix-n@0.2.0","maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"homepage":"https://github.com/AugustinMauroy/matrix-n#readme","bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"dist":{"shasum":"d2339486c6cc71a643aac0d55862a10b19501809","tarball":"https://registry.npmjs.org/@augustinmauroy/matrix-n/-/matrix-n-0.2.0.tgz","fileCount":9,"integrity":"sha512-Pyx5upsLCxlwi9xPOKFherb1GQG04+ZfRkUbtGrwacuFE/eZq63brmCJu4WCbX9UjAt49qTNxDRHYCVG1u0FnA==","signatures":[{"sig":"MEUCIQCqOpYNyuTqL6bejk1gRV9YZlxMnfHFKGJ+25fkFXs3XgIge5Oe+4GeFh0UD9uj2CVDNAN+d2+Dgoly5QkSgK51ZRc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@augustinmauroy%2fmatrix-n@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":106685},"main":"dist/mod.js","type":"module","types":"./dist/mod.d.ts","gitHead":"74de14aeb1b3548dec23f76540f08ea4df7e1e20","scripts":{"test":"node --test **/*.test.ts","build":"tsc","biome:ci":"biome ci ./","biome:lint":"biome lint ./","pre-commit":"node --run biome:lint:fix; node --run biome:format:fix","types:check":"tsc --noEmit","biome:format":"biome format ./","test:coverage":"node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout **/*.test.ts","biome:lint:fix":"biome lint --fix ./","biome:format:fix":"biome format --fix ./"},"_npmUser":{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"},"repository":{"url":"git+https://github.com/AugustinMauroy/matrix-n.git","type":"git"},"_npmVersion":"11.3.0","description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","directories":{},"_nodeVersion":"24.1.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.17","@biomejs/biome":"^1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/matrix-n_0.2.0_1749249460781_0.49585855358076425","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@augustinmauroy/matrix-n","description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","version":"1.0.0","type":"module","author":{"name":"Augustin Mauroy"},"license":"MIT","main":"dist/mod.js","scripts":{"biome:format":"biome format ./","biome:lint":"biome lint ./","biome:ci":"biome ci ./","build":"tsc","pre-commit":"biome check ./ --write && node --run test && node --run types:check","test":"node --test **/*.test.ts","test:coverage":"node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout **/*.test.ts","types:check":"tsc --noEmit"},"devDependencies":{"@biomejs/biome":"^2.1.3","@types/node":"^25.0.3","typescript":"^5.8.3"},"repository":{"type":"git","url":"git+https://github.com/AugustinMauroy/matrix-n.git"},"gitHead":"37c7f52e2c87a9b143544e9520b085f368176ba6","types":"./dist/mod.d.ts","_id":"@augustinmauroy/matrix-n@1.0.0","bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"homepage":"https://github.com/AugustinMauroy/matrix-n#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-mICub1i06xOYpx9zea/w6u40vEMvGNvvd5aDek58DNhrfBn/6XDEQER9A6jucUIgMN7IMtZArEGQPmAW4IQn7Q==","shasum":"b3656f182adde5052e554d38dd69d2d7313c4bec","tarball":"https://registry.npmjs.org/@augustinmauroy/matrix-n/-/matrix-n-1.0.0.tgz","fileCount":9,"unpackedSize":113787,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@augustinmauroy%2fmatrix-n@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEMlk56PHyTMNgmHRneqIAZPAH/5P6g8cilGgIBefxc3AiEAsGhbjQB+57e3cfpHof5HCkDsHR6zeO2wO1Uk5pMFWs0="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5841fa15-95c4-4245-8b58-53d4b341059f"}},"directories":{},"maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/matrix-n_1.0.0_1771255246193_0.34015805668254195"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-12T19:19:05.232Z","modified":"2026-02-16T15:20:46.695Z","0.1.0":"2025-05-12T19:19:05.536Z","0.1.1":"2025-05-12T19:36:05.069Z","0.1.2":"2025-06-02T09:32:31.803Z","0.2.0":"2025-06-06T22:37:41.021Z","1.0.0":"2026-02-16T15:20:46.344Z"},"bugs":{"url":"https://github.com/AugustinMauroy/matrix-n/issues"},"author":{"name":"Augustin Mauroy"},"license":"MIT","homepage":"https://github.com/AugustinMauroy/matrix-n#readme","repository":{"type":"git","url":"git+https://github.com/AugustinMauroy/matrix-n.git"},"description":"A JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.","maintainers":[{"name":"augustinmauroy","email":"augustin.mauroy@outlook.fr"}],"readme":"# @augustinmauroy/matrix-n\n\nA JavaScript library for matrix operations, including addition, multiplication, and inversion. It supports matrices of any size and provides a simple API for common operations.\n\n[![npm version](https://img.shields.io/npm/v/@augustinmauroy/matrix-n.svg)](https://www.npmjs.com/package/@augustinmauroy/matrix-n)\n[![JSR](https://jsr.io/badges/@augustinmauroy/matrix-n)](https://jsr.io/@augustinmauroy/matrix-n)\n[![codecov](https://codecov.io/gh/AugustinMauroy/matrix-n/graph/badge.svg?token=MZVSB35XDG)](https://codecov.io/gh/AugustinMauroy/matrix-n)\n\n> **NOTE** This package is tested with [Node.js](https://nodejs.org/en/) but the package din't use any Node.js specific feature. It should work in any JavaScript environment (browser, Deno, etc.). If you encounter any issue, please open an issue on [GitHub](https://github.com/AugustinMauroy/matrix-n/issues).\n\n> [!NOTE]\n> This library is stable as of version `1.0.0` and follows semantic versioning for breaking changes. Your feedback is still welcome!\n> Please open an issue on [GitHub](https://github.com/AugustinMauroy/matrix-n/issues) if you have any suggestion or if you encounter any issue.\n\n## Performance & Limitations\n\n### Performance Characteristics\n\n- **Matrix Multiplication**: $O(n^3)$ using standard algorithm. For large matrices (n > 1000), consider using specialized libraries like [numeric.js](https://numericjs.org/) or [math.js](https://mathjs.org/).\n- **Determinant Calculation**: Cofactor expansion for matrices ≤ 3×3 ($O(1)$), LU decomposition for larger matrices ($O(n^3)$).\n- **Matrix Inversion**: Uses LU decomposition ($O(n^3)$).\n- **Rank Calculation**: Gaussian elimination ($O(n^3)$).\n\n### Limitations\n\n- **Numerical Stability**: This library uses standard floating-point arithmetic. Large or ill-conditioned matrices may result in numerical instability. For numerical computing, consider [JSMath](https://www.jsmathtools.org/) or [sylvester.js](http://sylvester.jcoglan.com/).\n- **Algorithm Optimization**: No SIMD or GPU acceleration. Not suitable for real-time 3D graphics or scientific computing at scale.\n- **Missing Decompositions**: Does not include QR decomposition, eigenvalue decomposition, or singular value decomposition (SVD).\n- **Precision**: Uses `Float32Array` for storage, limiting precision to ~7 decimal places. For higher precision, use `BigDecimal` libraries.\n\n## Example\n\n```typescript\nimport { MatrixN, Mat2, Mat3 } from \"@augustinmauroy/matrix-n\";\n\nconst m1 = new MatrixN(2, 3, [[1, 2, 3], [4, 5, 6]]);\nconsole.log(\"M1:\\n\" + m1.toString());\n\nconst m2 = MatrixN.fill(2, 3, 2);\nconsole.log(\"M2:\\n\" + m2.toString());\n\nconst m3 = m1.add(m2);\nconsole.log(\"M1 + M2:\\n\" + m3.toString());\n\nm1.addSelf(m2);\nconsole.log(\"M1 += M2 (in-place):\\n\" + m1.toString());\n\n\nconst m4 = new MatrixN(3, 2, [[7, 8], [9, 10], [11, 12]]);\nconsole.log(\"M4:\\n\" + m4.toString());\n\nconst m5 = m1.multiply(m4); // M1 is now 2x3, M4 is 3x2 -> result 2x2\nconsole.log(\"M1 * M4:\\n\" + m5.toString());\n\nconst mId = Mat3.identity();\nconsole.log(\"Mat3 Identity:\\n\" + mId.toString());\n\nconst matA = new Mat2([4, 7, 2, 6]);\nconsole.log(\"MatA (2x2):\\n\" + matA.toString());\nconsole.log(\"Determinant of MatA:\", matA.determinant());\nconst invA = matA.invert();\nconsole.log(\"Inverse of MatA:\\n\" + invA.toString());\nconsole.log(\"MatA * InvA:\\n\" + matA.multiply(invA).toString()); // Should be identity\n\nconst matB = new Mat3([\n    [1, 2, 3],\n    [0, 1, 4],\n    [5, 6, 0]\n]);\nconsole.log(\"MatB (3x3):\\n\" + matB.toString());\nconsole.log(\"Determinant of MatB:\", matB.determinant());\nconst invB = matB.invert();\nconsole.log(\"Inverse of MatB:\\n\" + invB.toString());\nconsole.log(\"MatB * InvB:\\n\" + matB.multiply(invB).toString()); // Should be identity (approx due to float errors)\n\ntry {\n    const nonSquare = new MatrixN(2,3);\n    // nonSquare.determinant(); // This would throw error\n    const singular = new Mat2([1,1,1,1]);\n    // singular.invert(); // This would throw error\n} catch (e: any) {\n    console.error(\"Error:\", e.message);\n}\n\nconst mBig = MatrixN.identity(4);\n// console.log(\"Det of 4x4 Identity:\", mBig.determinant()); // Uses cofactor expansion\n// const mBigInv = mBig.invert();\n// console.log(\"Inverse of 4x4 Identity:\\n\", mBigInv.toString());\n```\n","readmeFilename":"README.md"}