{"id":17062148,"url":"https://github.com/recp/mathkit","last_synced_at":"2025-05-06T23:17:32.403Z","repository":{"id":72428324,"uuid":"62674951","full_name":"recp/mathkit","owner":"recp","description":"C vector, matrix library (including 3d, opengl math)","archived":false,"fork":false,"pushed_at":"2016-09-09T08:36:43.000Z","size":107,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T23:17:24.501Z","etag":null,"topics":[],"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/recp.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}},"created_at":"2016-07-05T22:56:47.000Z","updated_at":"2022-11-28T14:06:39.000Z","dependencies_parsed_at":"2023-05-18T12:12:50.970Z","dependency_job_id":null,"html_url":"https://github.com/recp/mathkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fmathkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fmathkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fmathkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fmathkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recp","download_url":"https://codeload.github.com/recp/mathkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782835,"owners_count":21803410,"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":[],"created_at":"2024-10-14T10:49:19.159Z","updated_at":"2025-05-06T23:17:32.386Z","avatar_url":"https://github.com/recp.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mathkit\nC vector, matrix library (including 3d, opengl math)\n\n|| **Unix (gcc, clang)** | **Windows (msvc)** |\n|---|---|---|\n| **Build** | [![Build Status](https://travis-ci.org/recp/mathkit.svg?branch=master)](https://travis-ci.org/recp/mathkit)|[![Build status](https://ci.appveyor.com/api/projects/status/xodt8l6bp2jr41q6/branch/master?svg=true)](https://ci.appveyor.com/project/recp/mathkit/branch/master)\n\n*Note: This project is not ready for production yet*\n\nmathkit uses `MkHint` struct to help compiler to eliminate branches compile-time. If compiler will do, compile-time known matrices will be optimised by compiler e.g. vectorization, unrool loops, eliminate unused braches... To do that almost all important functions are inline (if compiler can inline).\nUser can prefer a matrix is compile-time or run time by `MkHint`. For instance if we know that our matrices are 4x4 e.g. when working on OpenGL then we can optimise the matrices aggressively in compile-time\n\nmathkit uses single type for matrices: `MkMatrix` (run time \u0026\u0026 compile time matrices)\n\n## Usage\n```C\n#include \u003cmk.h\u003e\n#include \u003cmk-matrix.h\u003e\n\nfloat m1Buf[16] = {\n  1,  2,  3,  4,\n  5,  6,  7,  8,\n  9,  10, 11, 12,\n  13, 14, 15, 16  \n};\n\nfloat m2Buf[16] = {\n  10,  20,  30,  40,\n  50,  60,  70,  80,\n  90,  10,  110, 120,\n  130, 140, 150, 160  \n};\n\nfloat m3Buf[16] = {\n  0.1,  0.2,  0.3,  0.4,\n  0.5,  0.6,  0.7,  0.8,\n  0.9,  0.10, 0.11, 0.12,\n  0.13, 0.14, 0.15, 0.16  \n};\n\nfloat resultBuf[16];\n\n#define hint4x4f MK_HINT(MK_FLOAT, 4, 4, false)\n\nMkMatrix m1;\nMkMatrix m2;\nMkMatrix m3;\nMkMatrix result;\n\nmkMatrixInit(\u0026m1, m1Buf, hint4x4f);\nmkMatrixInit(\u0026m2, m2Buf, hint4x4f);\nmkMatrixInit(\u0026m3, m3Buf, hint4x4f);\nmkMatrixInit(\u0026result, resultBuf, hint4x4f);\n\nmkMatrixMatrixMulN((MkMatrix *[]){\u0026m1, \u0026m2, \u0026m3},\n                   \u0026result,\n                   3,\n                   (MkHint []){hint4x4f, hint4x4f, hint4x4f});\n\nmkMatrixPrint(\u0026result,\n              mkFloatPrinter,\n              stdout);      \n```\n\n```\nOutput:\n\nMatrix (4x4):\n\t1601.00f,\t896.00f,\t1082.00f,\t1268.00f,\n\t3677.00f,\t2040.00f,\t2460.40f,\t2880.80f,\n\t5753.00f,\t3184.00f,\t3838.80f,\t4493.60f,\n\t7829.00f,\t4328.00f,\t5217.20f,\t6106.40f,\n```\n\n## Build\n\n### Unix (Autotools)\n\n```text\n$ sh autogen.sh\n$ ./configure\n$ make\n$ [sudo] make install\n```\n\n### Windows (MSBuild)\n\n```text\n$ msbuild mathkit.vcxproj /p:Configuration=Release\n```\n\n## Roadmap\n\n- [ ] Row Major Matrices\n    - [X] Matrix - Matrix multiplication\n    - [X] Matrix - Scalar ops\n    - [X] Small matrix optimisations\n    - [ ] Large matrix optimisations (SSE, AVX)\n- [ ] Col Major Matrices\n- [ ] Vectors\n    - [X] Basic struct\n    - [X] Normalize, Cross, Dot products\n- [ ] GL Math\n    - [ ] basic funcs(lookAt, translate, rotate...) \n- [ ] Matrix - Vectors\n- [ ] Tests, Benchmarks\n- [ ] Documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fmathkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecp%2Fmathkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fmathkit/lists"}