Skip to content

feat: add new matrix addition method and improve performance of mmul and kroneckerProduct method #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
27e7e9b
feat: add new matrix addition method and improve performance of mmul …
jobo322 Jun 13, 2025
e4a7002
feat: improve performance of mmul and kronecker product
jobo322 Jun 13, 2025
9a44f16
feat: add new multiplication methods and improve getNonZeros function
jobo322 Jun 20, 2025
f0b16b2
feat: add benchmark for sparse matrix operations and performance comp…
jobo322 Jun 21, 2025
7ac8a4c
feat: add tests for getNonZeros method in SparseMatrix
jobo322 Jun 21, 2025
f2e2935
feat: update benchmark parameters and add comprehensive tests for Spa…
jobo322 Jun 21, 2025
0f1cdb9
Merge remote-tracking branch 'origin/main' into improve-performance-mmul
targos Jun 21, 2025
099f24f
feat: add new matrix addition method and improve performance of mmul …
jobo322 Jun 13, 2025
104e3e1
feat: improve performance of mmul and kronecker product
jobo322 Jun 13, 2025
1bacd59
feat: add new multiplication methods and improve getNonZeros function
jobo322 Jun 20, 2025
d647066
feat: add benchmark for sparse matrix operations and performance comp…
jobo322 Jun 21, 2025
12758f9
feat: add tests for getNonZeros method in SparseMatrix
jobo322 Jun 21, 2025
d78911d
feat: update benchmark parameters and add comprehensive tests for Spa…
jobo322 Jun 21, 2025
807ab3d
chore: keep mmul simple
jobo322 Jun 23, 2025
09d0a98
chore: use benchmark package
jobo322 Jun 23, 2025
72db1dd
chore: simple benchmark run
jobo322 Jun 23, 2025
77eff3a
refactor: remove add method from SparseMatrix class
jobo322 Jun 23, 2025
c050090
refactor: remove mul method from SparseMatrix class and update mulM m…
jobo322 Jun 23, 2025
ac26a10
Merge branch 'improve-performance-mmul' of github.com:jobo322/sparse-…
targos Jun 24, 2025
44b9822
chore: use mitota
jobo322 Jun 24, 2025
22d602d
Chore: use default value of initialCapacity from ml-hast-table
jobo322 Jun 24, 2025
dd0b69c
chore: fix eslint and prettier in benchmark
jobo322 Jun 24, 2025
c32bc1b
chore: add jsdoc to functions
jobo322 Jun 24, 2025
eac75af
chore: exclude benchmark and lib from coverage report
jobo322 Jun 25, 2025
63b64ed
chore: ensure that getNonZeros sort data if format is required
jobo322 Jun 25, 2025
8cef7c0
chore: refactor getNonZeros method to simplify format handling and im…
jobo322 Jul 2, 2025
80686cd
chore: remove benchmark script
jobo322 Jul 2, 2025
255e351
chore: add benchmarks for cardinality and size comparisons
jobo322 Jul 2, 2025
87966e4
chore: fix randommatrix util
jobo322 Jul 2, 2025
a3568a8
Merge branch 'improve-performance-mmul' of github.com:jobo322/sparse-…
targos Jul 3, 2025
163c079
chore: fix lint and remove redundant vitest config
targos Jul 3, 2025
8505401
chore(getNonZeros): rename format options to csr and move cooToCsr as…
jobo322 Jul 3, 2025
10aee91
test: refactor matrix multiplication tests and improve random matrix …
jobo322 Jul 3, 2025
e287ca1
feat: move internal specialized matrix multiplication as pure functions
jobo322 Jul 3, 2025
f101f9d
chore: update benchmark
jobo322 Jul 3, 2025
5a7b46e
fix eslint import order
targos Jul 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
name: Deploy TypeDoc on GitHub pages
name: TypeDoc

on:
workflow_dispatch:
release:
types: [published]

env:
NODE_VERSION: 22.x
ENTRY_FILE: 'src/index.js'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
- name: Build documentation
uses: zakodium/typedoc-action@v2
with:
entry: ${{ env.ENTRY_FILE }}
- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.BOT_TOKEN }}
branch: gh-pages
folder: docs
clean: true
typedoc:
# Documentation: https://github.com/zakodium/workflows#typedoc
uses: zakodium/workflows/.github/workflows/typedoc.yml@typedoc-v1
with:
entry: 'src/index.js'
secrets:
github-token: ${{ secrets.BOT_TOKEN }}
55 changes: 55 additions & 0 deletions benchmark/benchmarkLinePlot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { bench, do_not_optimize, lineplot, run } from 'mitata';
import { xSequentialFillFromStep } from 'ml-spectra-processing';

import { SparseMatrix } from '../src/index.js';

import { SparseMatrix as SparseMatrixOld } from './class/SparseMatrixOld.js';
import { randomMatrix } from './utils/randomMatrix.js';

const density = 0.02; // Fixed density for this comparison;

// Prepare matrices once
const sizes = Array.from(
xSequentialFillFromStep({ from: 4, step: 4, size: 13 }),
);
lineplot(() => {
bench('Sparse.mmul($size)', function* (ctx) {
const size = ctx.get('size');

// Prepare matrices once
const A = new SparseMatrix(randomMatrix(size, size, density));
const B = new SparseMatrix(randomMatrix(size, size, density));
// Benchmark the multiplication
yield () => do_not_optimize(A.mmul(B));
})
.gc('inner')
.args('size', sizes); // 16, 32, 64, 128, 256

bench('SparseOld.mmul($size)', function* (ctx) {
const size = ctx.get('size');
const A = randomMatrix(size, size, density);
const B = randomMatrix(size, size, density);
const AOld = new SparseMatrixOld(A);
const BOld = new SparseMatrixOld(B);

// Benchmark the multiplication
yield () => do_not_optimize(AOld.mmul(BOld));
})
.gc('inner')
.args('size', sizes);

// bench('Dense.mmul($size)', function* (ctx) {
// const size = ctx.get('size');

// // Prepare matrices once
// const A = randomMatrix(size, size, density);
// const B = randomMatrix(size, size, density);
// const ADense = new Matrix(A);
// const BDense = new Matrix(B);

// // Benchmark the multiplication
// yield () => do_not_optimize(ADense.mmul(BDense));
// }).gc('inner').range('size', min, max, multiplier);
});

await run();
Loading