{"id":22624652,"url":"https://github.com/barrettotte/linear-algebra-c","last_synced_at":"2025-07-12T01:10:52.591Z","repository":{"id":114090763,"uuid":"189892256","full_name":"barrettotte/Linear-Algebra-C","owner":"barrettotte","description":"A linear algebra library for performing basic and advanced matrix operations. This was made as a refresher for linear algebra and is by no means complete.","archived":false,"fork":false,"pushed_at":"2019-10-10T14:08:55.000Z","size":36,"stargazers_count":10,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T15:06:36.886Z","etag":null,"topics":["c","c99","linear-algebra","mathematics","matrix","matrix-library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barrettotte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-02T20:30:26.000Z","updated_at":"2024-05-24T04:34:30.000Z","dependencies_parsed_at":"2023-06-12T14:00:20.000Z","dependency_job_id":null,"html_url":"https://github.com/barrettotte/Linear-Algebra-C","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barrettotte/Linear-Algebra-C","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FLinear-Algebra-C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FLinear-Algebra-C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FLinear-Algebra-C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FLinear-Algebra-C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barrettotte","download_url":"https://codeload.github.com/barrettotte/Linear-Algebra-C/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FLinear-Algebra-C/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922866,"owners_count":23683702,"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","c99","linear-algebra","mathematics","matrix","matrix-library"],"created_at":"2024-12-09T00:17:14.139Z","updated_at":"2025-07-12T01:10:52.564Z","avatar_url":"https://github.com/barrettotte.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linear-Algebra-C\n\nA linear algebra library for performing basic and advanced matrix/vector operations. \nTargeted for **C99**.\n\nThis was made as a refresher for linear algebra and is by no means complete.\n\n\nI did a basic refresher with Elementary Linear Algebra 10th Ed, the book I used in a previous course.\n\n\n### Matrix\nA struct containing a data field, number of columns, and number of rows.\n\nTo index a matrix, I use row-major indexing with zero indexing\n```\n[1, 2, 3]     [(0,0) (0,1) (0,2)]\n[4, 5, 6] --\u003e [(1,0) (1,1) (1,2)]\n[7, 8, 9]     [(2,0) (2,1) (2,2)]\n```\n\nMatrix data is stored in memory as a one dimensional array. To access the data properly in \na two dimensional manner, it is sliced on rows and cols like this ```m-\u003edata[i * m-\u003ecols + j] = 0```\n\n\n### Vector\nA simple struct containing a data field and size field. I started this little library using a 1xn matrix\nfor a vector representation. But, I found that there were enough vector only functions to make a separate \ndistinct type; even though they are practically identical, it adds a bit of readability.\n\n\n## Functions\nAll functions are documented in ```linear-algebra.h```\n\n\n## Debugging\nAs far as valgrind is concerned, I have taken care of all detected possible memory leaks so far.\n```shell\ngcc -o dbg_matrix -std=c99 -rdynamic -Wall -g matrix.c test.c utils.c vector.c -lm \nvalgrind --leak-check=full \\\n         --show-leak-kinds=all \\\n         --track-origins=yes \\\n         --verbose \\\n         --log-file=valgrind-out.txt \\\n         ./dbg_matrix\n```\n\ngdb debugging\n* compile normally (with -g)\n* ```gdb```\n* ```file test_matrix```\n* ```run```\n\n\n## Resources\n* [Elementary Linear Algebra textbook](https://www.amazon.com/Elementary-Linear-Algebra-Howard-Anton/dp/0470458216)\n* Laplace expansion https://en.wikipedia.org/wiki/Laplace_expansion\n* Matrix decomposition https://en.wikipedia.org/wiki/Matrix_decomposition\n  * Doolittle algorithm https://www.geeksforgeeks.org/doolittle-algorithm-lu-decomposition/\n  * LU decomposition \n    * https://en.wikipedia.org/wiki/LU_decomposition\n    * https://www.youtube.com/watch?v=yYxwlnilEJs\n* Matrix/Vector calculator https://www.symbolab.com/solver/matrix-vector-calculator","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Flinear-algebra-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarrettotte%2Flinear-algebra-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Flinear-algebra-c/lists"}