{"id":23038463,"url":"https://github.com/sztorm/kotlinlowallocmath","last_synced_at":"2025-07-21T10:04:24.129Z","repository":{"id":160138645,"uuid":"606585732","full_name":"Sztorm/KotlinLowAllocMath","owner":"Sztorm","description":"A collection of various math related types that have little to no GC memory allocation pressure.","archived":false,"fork":false,"pushed_at":"2024-12-30T18:22:04.000Z","size":1858,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T23:31:53.394Z","etag":null,"topics":["kotlin","kotlin-library","library","math-library","performance"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/Sztorm.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":"2023-02-25T23:31:31.000Z","updated_at":"2023-12-03T20:48:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"a674f177-aa54-4949-be17-d8154d12ea1c","html_url":"https://github.com/Sztorm/KotlinLowAllocMath","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Sztorm/KotlinLowAllocMath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sztorm%2FKotlinLowAllocMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sztorm%2FKotlinLowAllocMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sztorm%2FKotlinLowAllocMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sztorm%2FKotlinLowAllocMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sztorm","download_url":"https://codeload.github.com/Sztorm/KotlinLowAllocMath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sztorm%2FKotlinLowAllocMath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266278322,"owners_count":23904039,"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":["kotlin","kotlin-library","library","math-library","performance"],"created_at":"2024-12-15T18:19:00.726Z","updated_at":"2025-07-21T10:04:24.114Z","avatar_url":"https://github.com/Sztorm.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# low-alloc-math\n\n[![](https://jitpack.io/v/Sztorm/KotlinLowAllocMath.svg)](https://jitpack.io/#Sztorm/KotlinLowAllocMath)\n\nA collection of various math related types that have little to no GC memory allocation\npressure. This library makes extensive use of Kotlin's\n[inline classes](https://kotlinlang.org/docs/inline-classes.html) to achieve primitive type\ncomparable performance; therefore, usage of the library is optimized for the Kotlin language.\n\n[Documentation](https://sztorm.github.io/KotlinLowAllocMath)\n\n## Installation\n\n\u003cdetails\u003e\n\u003csummary\u003eGradle Kotlin\u003c/summary\u003e\n\nStep 1. Add it in your root `build.gradle.kts` at the end of repositories:\n\n```kotlin\nallprojects {\n    repositories {\n        maven(\"https://jitpack.io\")\n    }\n}\n```\n\nStep 2. Add the dependency\n\n```kotlin\ndependencies {\n    implementation(\"com.github.Sztorm.KotlinLowAllocMath:low-alloc-math:1.1.0\")\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGradle Groovy\u003c/summary\u003e\n\nStep 1. Add it in your root `build.gradle` at the end of repositories:\n\n```groovy\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nStep 2. Add the dependency\n\n```groovy\ndependencies {\n    implementation 'com.github.Sztorm.KotlinLowAllocMath:low-alloc-math:1.1.0'\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eMaven\u003c/summary\u003e\n\nStep 1. Add it in your root `pom.xml` at the end of repositories:\n\n```maven\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nStep 2. Add the dependency\n\n```maven\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.Sztorm\u003c/groupId\u003e\n    \u003cartifactId\u003eKotlinLowAllocMath\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003c/details\u003e\n\n## Samples\n\n```kotlin\nimport com.sztorm.lowallocmath.*\n\n// No GC allocation when declared locally (inside the body of a method).\n// Under the hood, a long value will be created for each Vector2F.\nval a = Vector2F(0.5f, 3f)\nval b = Vector2F(4f, 2f)\nval (ax, ay) = a\n\nprintln(a + b)        // Vector2F(x=4.5, y=5.0)\nprintln(ax * ay)      // 1.5\nprintln(a.x * a[1])   // 1.5\nprintln(a dot b)      // 8.0\nprintln(a.magnitude)  // Vector2F(x=0.16439898, y=0.98639387)\nprintln(a.normalized) // 1.0\n```\n\n```kotlin\nimport com.sztorm.lowallocmath.*\n\nval a = ComplexF(3f, 2f)\nval b = 3f + 2f.i\nval c = ComplexF.fromPolar(3.6055512f, 0.5880026f)\nval d = ComplexF.fromAngle(AngleF.fromDegrees(30f))\n\nprintln(c)           // 2.9999998 + 2.0i\nprintln(d)           // 2.9999998 + 2.0i\nprintln(a.magnitude) // 3.6055512\nprintln(a.phase)     // 0.5880026\nprintln(a + b)       // 6.0 + 4.0i\nprintln(a * b)       // 5.0 + 12.0i\n```\n\n```kotlin\nimport com.sztorm.lowallocmath.*\n\n// This is an array of values, on the JVM side it is represented as long array.\nval arrayA = Vector2FArray(3)\nval arrayB = Vector2FArray(3) { Vector2F(it.toFloat(), it.toFloat()) }\n\nprintln(arrayA) // Vector2F(x=0.0, y=0.0), Vector2F(x=0.0, y=0.0), Vector2F(x=0.0, y=0.0)\nprintln(arrayB) // Vector2F(x=0.0, y=0.0), Vector2F(x=1.0, y=1.0), Vector2F(x=2.0, y=2.0)\n\n// vector2FArrayOf function is currently unimplemented due to lack of support for vararg parameter\n// of inline class types. This is a workaround that may be replaced in the future.\nval arrayC = arrayOf(Vector2F(0f, 0f), Vector2F(1f, 1f), Vector2F(2f, 2f)).toVector2FArray()\narrayC[0] = Vector2F(4f, 5f)\n\nprintln(arrayC[0])    // Vector2F(x=4.0, y=5.0)\nprintln(arrayC[2])    // Vector2F(x=2.0, y=2.0)\nprintln(arrayC.sum()) // Vector2F(x=7.0, y=8.0)\n```\n\n## License\n\n*low-alloc-math* is licensed under the MIT license.\n\n[More about license](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztorm%2Fkotlinlowallocmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsztorm%2Fkotlinlowallocmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztorm%2Fkotlinlowallocmath/lists"}