{"id":20149641,"url":"https://github.com/kumar-shivam-ranjan/sparse-matrix-multiplication","last_synced_at":"2026-05-02T05:05:44.100Z","repository":{"id":73555810,"uuid":"280771197","full_name":"kumar-shivam-ranjan/Sparse-Matrix-Multiplication","owner":"kumar-shivam-ranjan","description":"This repository consists of sparse Matrix multiplication algorithms implemented in C/C++","archived":false,"fork":false,"pushed_at":"2020-07-19T02:02:38.000Z","size":2085,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T00:42:02.311Z","etag":null,"topics":["c","cpp14","sparse-matrix"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kumar-shivam-ranjan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-07-19T01:40:49.000Z","updated_at":"2023-04-15T17:12:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"52f65782-74dc-4421-85dd-c18ac907f732","html_url":"https://github.com/kumar-shivam-ranjan/Sparse-Matrix-Multiplication","commit_stats":null,"previous_names":["kumar-shivam-ranjan/sparse-matrix-multiplication"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kumar-shivam-ranjan/Sparse-Matrix-Multiplication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kumar-shivam-ranjan%2FSparse-Matrix-Multiplication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kumar-shivam-ranjan%2FSparse-Matrix-Multiplication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kumar-shivam-ranjan%2FSparse-Matrix-Multiplication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kumar-shivam-ranjan%2FSparse-Matrix-Multiplication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kumar-shivam-ranjan","download_url":"https://codeload.github.com/kumar-shivam-ranjan/Sparse-Matrix-Multiplication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kumar-shivam-ranjan%2FSparse-Matrix-Multiplication/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261960506,"owners_count":23236572,"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","cpp14","sparse-matrix"],"created_at":"2024-11-13T22:46:17.684Z","updated_at":"2026-05-02T05:05:44.059Z","avatar_url":"https://github.com/kumar-shivam-ranjan.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sparse-Matrix-Multiplication\nCode for heterogeneous computing of product of two sparse matrices\u003cbr\u003e\n\n\n### Algorithm: Gustavson’s Row-wise SpGEMM 3\u003cbr\u003e\nInput: Sparse matrices A and B\u003cbr\u003e\nOutput: Sparse matrix C\u003cbr\u003e\n\u003cpre\u003e \nset matrix C to ∅\u003cbr\u003e\nfor all a i ∗ in matrix A in parallel do\u003cbr\u003e\n  for all a ik in row a i ∗ do\u003cbr\u003e\n    for all b k j in row b k ∗ do\u003cbr\u003e\n\t\t\tvalue ← a ik b k j\u003cbr\u003e\n\t\t\tif c i j #∈ c i ∗ then\u003cbr\u003e\n\t\t\t\tinsert ( c i j ← v alue ) to c i ∗\u003cbr\u003e\n\t\t\telse\u003cbr\u003e\n\t\t\t\tc i j ← c i j + value\u003cbr\u003e\n\t\t\tend if\u003cbr\u003e\n\t\tend for\u003cbr\u003e\n\tend for\u003cbr\u003e\nend for\u003cbr\u003e\n\u003c/pre\u003e\n\n## Algorithm 2 RowsToThreads.\nInput: Sparse matrices A and B\u003cbr\u003e\nOutput: Array o f f set\n\u003cpre\u003e\n{1. Set FLOP vector}\nfor i ← 0 to m in parallel do\n\tflop [ i ] ← 0\n\tfor j ← r pts A [ i ] to r pts A [ i + 1] do\n\t\trnz ← r pts B [ cols A [ j] + 1] − r pt B [ cols A [ j]]\n\t\tflop [ i ] ← flop [ i ] + rnz\n\tend for\nend for\n{ 2 . Assign rows to thread }\nflop ps ← ParallelPrefixSum ( flop )\nsum flop ← flop ps [ m ]\ntnum ← omp_get_max_threads ()\na v e flop ← sum flop / tnum\no f f set[0] ← 0\nfor tid ← 1 to tnum in parallel do\n\to f f set [ tid ] ← lowbnd ( flop ps , a v e flop ∗ tid )\nend for\no f f set [ t num ] ← m\n\u003c/pre\u003e\n## Algorithm : Hash SpGEMM.\nInput: Sparse matrices A and B\u003cbr\u003e \nOutput: Sparse matrix C\n\u003cpre\u003e\noff set ← RowsToThreads ( A, B )\n{Determine hash-table size for each thread}\ntnum ← omp_get_max_threads ()\nfor tid ← 0 to tnum in parallel do\n\tsize t ← 0\n\tfor i ← o f f set [ t id] to o f f set [ t id + 1] do\n\t\tsize t ← max ( size t , flop [ i ] )\n\tend for\n\t{Required maximum hash-table size is N col }\n\tsize t ← min ( N col , size t )\n\t{Return minimum 2 n so that 2 n \u003e size t }\n\tsize t ← lowest_p2 ( size t )\nend for\nSymbolic ( r pts C , A, B )\nNumeric ( C, A, B )\n\u003cpre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkumar-shivam-ranjan%2Fsparse-matrix-multiplication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkumar-shivam-ranjan%2Fsparse-matrix-multiplication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkumar-shivam-ranjan%2Fsparse-matrix-multiplication/lists"}