{"id":32187320,"url":"https://github.com/ogeagla/clj-hypercomplex","last_synced_at":"2026-02-23T05:02:03.882Z","repository":{"id":57714122,"uuid":"127042710","full_name":"ogeagla/clj-hypercomplex","owner":"ogeagla","description":"A library for hypercomplex algebras in Clojure","archived":false,"fork":false,"pushed_at":"2024-02-06T13:54:14.000Z","size":65299,"stargazers_count":4,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T00:02:13.381Z","etag":null,"topics":["algebraic-structures","cayley-dickson","clojure","complex-numbers","hypercomplex-number","octonion","quaternions"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ogeagla.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-03-27T20:32:06.000Z","updated_at":"2024-11-28T13:08:35.000Z","dependencies_parsed_at":"2024-02-06T15:22:51.001Z","dependency_job_id":null,"html_url":"https://github.com/ogeagla/clj-hypercomplex","commit_stats":{"total_commits":47,"total_committers":2,"mean_commits":23.5,"dds":"0.021276595744680882","last_synced_commit":"ae37d089fde65a5326004c2e3d3078675738645b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ogeagla/clj-hypercomplex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogeagla%2Fclj-hypercomplex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogeagla%2Fclj-hypercomplex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogeagla%2Fclj-hypercomplex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogeagla%2Fclj-hypercomplex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ogeagla","download_url":"https://codeload.github.com/ogeagla/clj-hypercomplex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogeagla%2Fclj-hypercomplex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["algebraic-structures","cayley-dickson","clojure","complex-numbers","hypercomplex-number","octonion","quaternions"],"created_at":"2025-10-22T00:02:17.987Z","updated_at":"2026-02-23T05:02:03.864Z","avatar_url":"https://github.com/ogeagla.png","language":"Clojure","readme":"# hypercomplex\n\n[Changelog](CHANGELOG.md)\n\n[![Build Status](https://travis-ci.com/ogeagla/clj-hypercomplex.svg?branch=master)](https://travis-ci.com/ogeagla/clj-hypercomplex)\n\n[![Clojars Project](https://img.shields.io/clojars/v/hypercomplex.svg)](https://clojars.org/hypercomplex)\n\n```clojure\n[hypercomplex \"0.0.4\"]\n```\n\nA hypercomplex number library written in Clojure.\n\nIncludes Cayley-Dickson construction for generating and working with hypercomplex algebras.\n\nhttps://en.wikipedia.org/wiki/Cayley%E2%80%93Dickson_construction\n\n![The Hypercomplex Numbers](papers/Figure1.JPG)\n\n## Usage\n\n - `hypercomplex.core` for operators on or between hypercomplex numbers: `times`, `plus`, `minus`, `neg`, `c` (conjugate), `scale`, `norm`, `inv`, and `mag`.\n - `hypercomplex.cayley-dickson-construction` for constructing hypercomplex numbers: `complex`, `quaternion`, `octonion`, `sedenion`, `pathion`, and `n-hypercomplex` for constructing higher-order algebras of arbitrary order, provided it is a power of 2.\n - All constructions can take an `:impl`, which can be either `:plain`, or `:apache`, which represent either pure Clojure or `org.apache.commons.math3.complex.Complex` implementations to be used under the hood for constructing the hypercomplex numbers.  Hypercomplex numbers with different underlying implementations are not interoperable (TODO).\n\n\nAn example of creating complex numbers, `quaternion`s, performing multiplication, and checking equality as a result of associativity:\n```clojure\n(:require [hypercomplex.core :refer :all]\n          [hypercomplex.cayley-dickson-construction :refer\n            [complex quaternion octonion sedenion pathion n-hypercomplex]])\n\n;create a complex number using pure Clojure impl:\n(complex {:a 1.1 :b 2.2 :impl :plain})\n; =\u003e #hypercomplex.core.Complex2{:a 1.1, :b 2.2, :order 2}\n\n;create a complex number using Apache Commons Complex2 impl:\n(complex {:a 1.1 :b 2.2 :impl :apache})\n; =\u003e #hypercomplex.core.Complex2Apache{:a 1.1, :b 2.2, :order 2, :obj #object[org.apache.commons.math3.complex.Complex 0x3249a1ce (1.1, 2.2)]}\n\n;similar for other hypercomplex numbers:\n(quaternion {:a 1 :b 2 :c 3 :d 4 :impl :plain})\n; =\u003e #hypercomplex.core.Construction{:a #hypercomplex.core.Complex2{:a 1, :b 2, :order 2}, :b #hypercomplex.core.Complex2{:a 3, :b 4, :order 2}, :order 4}\n\n;example passing test case:\n(is\n  (= (times\n       (quaternion {:a 1 :b 2 :c 3 :d 4})\n       (times (quaternion {:a 8 :b 7 :c 6 :d 5})\n              (quaternion {:a 9 :b 10 :c 11 :d 12})))\n     (times\n       (times\n         (quaternion {:a 1 :b 2 :c 3 :d 4})\n         (quaternion {:a 8 :b 7 :c 6 :d 5}))\n       (quaternion {:a 9 :b 10 :c 11 :d 12}))))\n```\nAn example of several other operators and constructions:\n```clojure\n(is \n  (= (quaternion {:a 1.5 :b 1.5 :c 1.5 :d 1.5})\n     (scale \n       (quaternion {:a 1 :b 1 :c 1 :d 1})\n       1.5)))\n       \n(is (= 32\n       (norm (pathion {:a 1 :b 1 :c 1 :d 1 :e 1 :f 1 :g 1 :h 1\n                       :i 1 :j 1 :k 1 :l 1 :m 1 :n 1 :o 1 :p 1\n                       :q 1 :r 1 :s 1 :t 1 :u 1 :v 1 :w 1 :x 1\n                       :y 1 :z 1 :aa 1 :bb 1 :cc 1 :dd 1 :ee 1 :ff 1}))))       \n```\nAn example of creating much higher order algebras using pure Clojure implementation, `:plain`:\n\n```clojure\n(n-hypercomplex [0 1 2 3 4 5 6 7] :plain)\n=\u003e \n  #hypercomplex.core.Construction\n  {:a #hypercomplex.core.Construction\n      {:a #hypercomplex.core.Complex2\n          {:a     0\n           :b     1                                                                     \n           :order 2}\n       :b #hypercomplex.core.Complex2\n          {:a     2\n           :b     3\n           :order 2}\n       :order 4}\n   :b #hypercomplex.core.Construction\n      {:a #hypercomplex.core.Complex2\n          {:a     4\n           :b     5\n           :order 2}\n       :b #hypercomplex.core.Complex2\n          {:a     6\n           :b     7\n           :order 2}\n       :order 4}\n   :order 8}\n```\n\n\nAnd a _very_ high order hypercomplex number:\n```clojure\n(n-hypercomplex (range 4096) :plain)\n=\u003e\n  #hypercomplex.core.Construction\n  {:a #hypercomplex.core.Construction\n      {:a #hypercomplex.core.Construction\n          {:a #hypercomplex.core.Construction\n              {:a #hypercomplex.core.Construction\n                  {:a #hypercomplex.core.Construction\n                      {:a #hypercomplex.core.Construction\n                          {:a #hypercomplex.core.Construction\n                              {:a #hypercomplex.core.Construction\n                                  {:a #hypercomplex.core.Construction\n                                      {:a #hypercomplex.core.Construction\n                                          {:a #hypercomplex.core.Complex2\n                                               {:a 0 \n                                                :b 1 \n                                                :order 2}\n                                           :b #hypercomplex.core.Complex2\n                                               {:a 2 \n                                                :b 3 \n                                                :order 2}\n                                           :order 4}\n                                                ...\n                                                :order 2}\n                                           :order 4} \n                                       :order 8} \n                                   :order 16} \n                               :order 32} \n                           :order 64} \n                       :order 128} \n                   :order 256} \n               :order 512} \n           :order 1024} \n       :order 2048} \n   :order 4096}\n\n```\n\n\n## Tests\n```bash\nlein test\n```\n\n## License\n\nCredits to:\n  - https://github.com/hamiltron/py-cayleydickson (MIT License)\n  - https://nakkaya.com/2009/09/29/fractals-in-clojure-mandelbrot-fractal/\n  - https://github.com/clojure-numerics/image-matrix/blob/master/src/main/clojure/mikera/image_matrix/colours.clj (EPL License)\n\nCopyright © 2018 Octavian Geagla\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogeagla%2Fclj-hypercomplex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fogeagla%2Fclj-hypercomplex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogeagla%2Fclj-hypercomplex/lists"}