Implement Matlab bindings #24
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement Matlab Bindings for Binsparse
This PR adds Matlab bindings, supporting (hopefully) Matlab and Octave. These add the functions
binsparse_read
andbinsparse_write
, which read and write, respectively, sparse matrices to or from Binsparse files.This PR returns matrices as a "native Matlab struct," which contains the component arrays that compose the sparse matrix. Is does not convert to or from a Matlab sparse matrix. (We probably want that, but it should be done at the Matlab layer.)
Below are some AI-generated notes on what's changed:
New Features:
Core MEX Functions:
binsparse_read.c
- Read Binsparse matrix files into MATLAB structsbinsparse_write.c
- Write MATLAB structs to Binsparse format filesBuild Infrastructure:
build_matlab_bindings.m
- Main MATLAB build script with auto-detectionbuild_octave_bindings.m
- Main Octave build script using mkoctfilecompile_octave.sh
- Command-line shell script for Octave compilationUtilities & Testing:
bsp_matrix_create.m
- Helper for creating matrix structsbsp_matrix_info.m
- Matrix information display utilitytest_binsparse_read.m
/test_binsparse_write.m
- Comprehensive test suitesREADME.md
- Complete documentation with usage examplesAPI:
Key Technical Features:
memcpy
for compatible types, proper complex number handlingConfiguration Updates:
.gitignore
for MATLAB/Octave artifacts.pre-commit-config.yaml
to exclude MATLAB files from clang-formatCMakeLists.txt
for bindings supportThis provides a complete, production-ready interface for MATLAB/Octave users to work with Binsparse matrices, enabling seamless integration into scientific computing workflows.