{"id":15038485,"url":"https://github.com/markuswntr/vector","last_synced_at":"2026-01-30T02:09:50.526Z","repository":{"id":167943062,"uuid":"156281531","full_name":"markuswntr/vector","owner":"markuswntr","description":"📐 Defines the properties of space, displacements, euclidean vector, vector algebra and Vector(2|3|4) of known cardinality","archived":false,"fork":false,"pushed_at":"2020-02-03T17:06:54.000Z","size":106,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T09:09:01.936Z","etag":null,"topics":["avx","neon","simd","sse","swift","swift-framework","swift-language","swift-library","swift-package-manager","vector","vector-space"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markuswntr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2018-11-05T20:53:02.000Z","updated_at":"2022-07-04T07:23:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"6790c921-0dbd-4761-9240-1382a93675a6","html_url":"https://github.com/markuswntr/vector","commit_stats":null,"previous_names":["markuswntr/vector"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markuswntr%2Fvector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markuswntr%2Fvector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markuswntr%2Fvector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markuswntr%2Fvector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markuswntr","download_url":"https://codeload.github.com/markuswntr/vector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243410446,"owners_count":20286396,"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":["avx","neon","simd","sse","swift","swift-framework","swift-language","swift-library","swift-package-manager","vector","vector-space"],"created_at":"2024-09-24T20:38:39.493Z","updated_at":"2026-01-30T02:09:50.463Z","avatar_url":"https://github.com/markuswntr.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vector\n\nDefines the properties of space, an `EuclideanVector` protocol and `Vector2`, `Vector3` and `Vector4` as implementations of an euclidean\nvector of known length. Vectors can be used to calculate 📦 [geometric values](https:/github.com/markuswntr/geometry), dot products or\ncross products, and to interpolate between values. You can use vectors to modify data such as\n🎨 [Color](https:/github.com/markuswntr/color), or positions in 2D or 3D space. Vector operations are inlined by \n[SIMD](https://en.wikipedia.org/wiki/SIMD) intrinsic functions of the target hardware whenever possible.  \n\nThe module has no platform restrictions nor hardware requirements.\nThere is a fallback in place for hardware targets with limit or no support for SIMD intrinsic functions.\nIt depends on the [apple/swift-numerics](https:/github.com/apple/swift-numerics) module.\n\n## Overview\n\nA vector is comparable to a fixed-length array containing numeric values (i.e. floating-point, signed integer or unsigned integer).\nThe key difference to a fixed-length array however, is that a vector is backed by an SIMD intrinsic, allowing all values to be processed in\nparallel. Theoretically, this increases the throughput by the number of elements in the vector.\nThe library provides support for small vectors, that is, vectors that contain up to four numeric values – with longer vectors coming later. \n\nYou can use the library to apply a single instruction to each element in the vector.\nFor example, consider two vectors, each containing four elements:\n\n```\nlet lhs: Vector4\u003cFloat\u003e = [2, 4, 5, 8]\nlet rhs: Vector4\u003cFloat\u003e = [5, 6, 7, 8]\n```\n\nYou can easily find, for example, the element-wise sum of the two vectors by using the `+` operator:\n\n```\nlet sum = lhs + rhs    // sum = (7.0, 10.0, 12.0, 16.0)\n```\n\n## TODO\n\nThe module tries to follow (most of) the concepts defined in the\n[Vector Manifesto](https://gist.github.com/kelvin13/9689ead534d8f2d4e8792a66690ea002).\nConcepts that differ from the Manifesto may be considered deprecated and may change in the future.\nConcepts not yet supported by the Swift Programming Language may differ from the Manifesto but will be\nadjusted accordingly once Swift will support them.\n\nSome of the mismatches are:\n\n- [ ] EuclideanVector are `ExpressibleByArrayLiteral` rather than `ExpressibleByTupleLiteral`, as such protocol does not exist.\n- [ ] ...\n\nAdditionally, the vector library tries to align closely with the Numeric Protocols of the Swift Standard Library and the Swift Numerics Package.\nThe SIMD module of the stdlib however has (as of now) limited support for Numeric Protocols, as the available intrinsics on the target hardware\nare C-based and therefore limited/not designed for Swift. Read this [blog post](wntr.me/posts/) for further details. Given that a `Vector{Size}`\nis backed by SIMD intrinsics, these restrictions apply to the module as well. The restrictions may be lifted in the future. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkuswntr%2Fvector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkuswntr%2Fvector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkuswntr%2Fvector/lists"}