{"id":20600934,"url":"https://github.com/cbouilla/spasm","last_synced_at":"2025-04-15T00:42:45.199Z","repository":{"id":23540613,"uuid":"26907558","full_name":"cbouilla/spasm","owner":"cbouilla","description":"a Sparse Direct Solver modulo p","archived":false,"fork":false,"pushed_at":"2024-11-04T17:19:57.000Z","size":5454,"stargazers_count":25,"open_issues_count":6,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-15T00:42:36.676Z","etag":null,"topics":["c","gaussian-elimination","sparse-matrices"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbouilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-20T10:31:44.000Z","updated_at":"2025-03-04T13:53:59.000Z","dependencies_parsed_at":"2022-08-21T19:00:33.154Z","dependency_job_id":"6febc834-6bf5-4d7b-aaac-5db0d730ae8b","html_url":"https://github.com/cbouilla/spasm","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbouilla%2Fspasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbouilla%2Fspasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbouilla%2Fspasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbouilla%2Fspasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbouilla","download_url":"https://codeload.github.com/cbouilla/spasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986271,"owners_count":21194024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","gaussian-elimination","sparse-matrices"],"created_at":"2024-11-16T08:39:51.527Z","updated_at":"2025-04-15T00:42:45.180Z","avatar_url":"https://github.com/cbouilla.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"SpaSM (Sparse direct Solver Modulo _p_)\n=======================================\n\nSpaSM is a software library devoted to sparse gaussian elimination modulo a small prime _p_. \nIt is available under the General Public License Version 3 or later (GPLv3+).\n\nThis is \"research-quality\" software. While we try to make sure that it actually works, we cannot make any promises.\n\nFeatures\n--------\n\nThe core of the library is a multithreaded function that computes the row echelon form of a sparse matrix modulo a word-sized prime. \n\nThis enables several of useful computations on sparse matrices modulo _p_:\n  * Basis of the row space\n  * Basis of the kernel\n  * Rank\n  * (Reduced) Row Echelon Form of `A*Q`, for some permutation matrix Q\n\nIn addition, SpaSM is capable of computing a full PLUQ factorization, but this is slower and requires more memory than simple echelonization. This enables:\n  * Solution of linear systems\n  * Extraction of a square submatrix of maximal rank\n  * Production of rank certificates\n\nSpaSM works with all odd 32-bit prime moduli.  While it would be possible to work with _p = 2_, this would require non-trivial tweaks to the code. \n\nFinally, SpaSM contains code to compute the Dulmage-Mendelson decomposition (permutation of a matrice to block triangular form) and several other useful functions.\n\nThe following algorithms algorithms are used in SpaSM:\n  * [Gilbert-Peierls sparse triangular solving with sparse right-hand side](https://doi.org/10.1137/0909058)\n  * [Faugère-Lachartre pivot selection](http://www-almasty.lip6.fr/~bouillaguet/pub/CASC16.pdf)\n  * [Improved greedy pivot selection](http://www-almasty.lip6.fr/~bouillaguet/pub/PASCO17.pdf)\n  * [Dense linear algebra mod _p_](https://hal.science/hal-00018223/)\n  * [Linear-size rank certificates](https://prism.ucalgary.ca/server/api/core/bitstreams/b00bb76d-12bf-41c2-9fed-88cd774d3b29/content)\n\nInitial versions of SpaSM were heavily influence by\n[Tim Davis](http://faculty.cse.tamu.edu/davis/)'s [CSparse](http://faculty.cse.tamu.edu/davis/publications_files/CSparse.zip). \n\nSpasm does I/O of matrices in either the :\n  * [SMS format](http://hpac.imag.fr/) --- which makes it somewhat compatible with [LinBox](http://linalg.org/).  \n  * [MatrixMarket format](https://math.nist.gov/MatrixMarket/), with kind `matrix coordinate integer general`.\n(The actual input format is autodetected).\n\nA set of demonstration programs is provided (see the `tools/` folder). They can be used to compute the rank, the RREF, a kernel basis, or a Dumlage-Mendelson decomposition of a sparse matrix.\n\n\nInstallation\n------------\n\nIn brief:\n```make```\n\nThis requires [cmake](https://cmake.org) and [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). The executables can be found in `build/tools`.\n\nSpaSM relies on two third-party libraries, which are required at compile-time:\n  * [Givaro](https://github.com/linbox-team/givaro)\n  * [FFLAS-FFPACK](https://github.com/linbox-team/fflas-ffpack)\n  \nUnder Debian linux or ubuntu, installing the `fflas-ffpack` package is sufficient to compile.\n\nSpaSM uses OpenMP to exploit multicore machines.\n\nDemonstration scripts\n---------------------\n\nAll SpaSM demonstration scripts read a matrix in [SMS format](http://hpac.imag.fr/) on the standard input.\n\nFor instance, these commands (run inside the `build/tools/` folder) will compute the rank of several large matrices in a few seconds:\n```\ncurl https://hpac.imag.fr/Matrices/Margulies/kneser_10_4_1.sms.gz | gunzip - | ./rank\ncurl https://hpac.imag.fr/Matrices/Homology/mk13.b5.135135x270270.sms.gz | gunzip - | ./rank\ncurl https://hpac.imag.fr/Matrices/G5/IG5-17.sms.gz | gunzip - | ./rank\n```\n\nIt would be necessary to disable greedy pivot search for this one:\n```\ncurl https://hpac.imag.fr/Matrices/Mgn/M0,6.data/M0,6-D9.sms.gz | gunzip - | ./rank\n```\n\nWhen matrices have many empty rows/columns, they can/have to be removed with the `stack` utility:\n```\ncurl https://hpac.imag.fr/Matrices/Relat/relat8.sms.gz | gunzip - | ./stack | ./rank\ncurl https://hpac.imag.fr/Matrices/Relat/relat9.sms.gz | gunzip - | ./stack | ./rank\n```\n\nFinding good pivots is crucial for the performance of any kind of sparse elimination procedure. The pivot-finding code is still a bit naïve. Sometimes it will find much more pivots, much faster, if the matrices are flipped around a vertical axis with the `vertical_swap` utility:\n```\ncurl https://hpac.imag.fr/Matrices/GL7d/GL7d14.sms.gz | gunzip - | ./vertical_swap | ./rank --dense-threshold 0.01\n...\ncurl https://hpac.imag.fr/Matrices/GL7d/GL7d22.sms.gz | gunzip - | ./vertical_swap | ./rank --dense-threshold 0.01\n```\n\nDealing with large matrices\n---------------------------\n\nSparse Gaussian elimination is more an art than a science.  In some cases, it will inevitably fail (the matrix will fill and the process will grind to a halt). \n\nHowever, with some expertise, it may be possible to deal with potentially larger problems than what the auto-pilot is capable of. Don't hesitate to get in touch.\n\nCiting SpaSM\n------------\n\nIf by any luck your research depends on the SpaSM library, please consider citing the project as\n\n```\n@manual{spasm,\ntitle = {{SpaSM}: a Sparse direct Solver Modulo $p$},\nauthor = {Charles Bouillaguet},\nedition = {v1.3},\nyear = {2023},\nnote = {\\url{http://github.com/cbouilla/spasm}}\n}\n```\n\nContact and discussion\n----------------------\n\nPlease email \u003ccharles.bouillaguet@lip6.fr\u003e for any questions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbouilla%2Fspasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbouilla%2Fspasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbouilla%2Fspasm/lists"}