{"id":16660154,"url":"https://github.com/brianchevalier/numpy-clj","last_synced_at":"2025-08-22T05:40:18.595Z","repository":{"id":95443965,"uuid":"318604992","full_name":"BrianChevalier/numpy-clj","owner":"BrianChevalier","description":"A core.matrix implementation using NumPy via libpython-clj","archived":false,"fork":false,"pushed_at":"2020-12-19T10:17:24.000Z","size":28,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T20:43:45.675Z","etag":null,"topics":["clojure","corematrix","libpython-clj","linear-algebra","numpy"],"latest_commit_sha":null,"homepage":"https://mybinder.org/v2/gh/BrianChevalier/core.matrix-examples/main?urlpath=lab/tree/Notebooks","language":"Clojure","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/BrianChevalier.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":"2020-12-04T18:36:12.000Z","updated_at":"2024-05-23T15:59:11.000Z","dependencies_parsed_at":"2023-04-29T17:17:20.283Z","dependency_job_id":null,"html_url":"https://github.com/BrianChevalier/numpy-clj","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/BrianChevalier%2Fnumpy-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianChevalier%2Fnumpy-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianChevalier%2Fnumpy-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianChevalier%2Fnumpy-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrianChevalier","download_url":"https://codeload.github.com/BrianChevalier/numpy-clj/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248090379,"owners_count":21046076,"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":["clojure","corematrix","libpython-clj","linear-algebra","numpy"],"created_at":"2024-10-12T10:28:11.870Z","updated_at":"2025-04-09T18:43:02.294Z","avatar_url":"https://github.com/BrianChevalier.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numpy-clj\n\n[![Build Status](https://github.com/brianchevalier/numpy-clj/workflows/Clojure%20CI/badge.svg)](https://github.com/BrianChevalier/numpy-clj/actions?query=workflow%3A%22Clojure+CI%22)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/BrianChevalier/core.matrix-examples/main?urlpath=lab/tree/Notebooks)\n\n\nA Clojure [core.matrix](https://github.com/mikera/core.matrix) implementation using [NumPy](https://github.com/numpy/numpy) via [libpython-clj](https://github.com/clj-python/libpython-clj). `numpy-clj` allows you to use an idiomatic Clojure library, while still interoperating with Numpy, SciPy and the entire Python ecosystem.\n\nTry out `numpy-clj` in JupyterLab via Binder along with other `core.matrix` implementations. [Click here](https://mybinder.org/v2/gh/BrianChevalier/core.matrix-examples/main?urlpath=lab/tree/Notebooks) or click the 'launch binder' badge above.\n\n## Usage\n\n`numpy-clj` does not directly provide an API, but is instead used by `core.matrix`. `numpy-clj` extends `core.matrix` to translate to equivalent `numpy` functions. Include `core.matrix` in your project and use the [core.matrix API](https://cljdoc.org/d/net.mikera/core.matrix/0.62.0/api/clojure.core.matrix).\n\nIf you're new to core.matrix check out [matrix-compare](https://brianchevalier.github.io/matrix-compare/) to see how to translate common operations from MATLAB and NumPy into core.matrix.\n\n### Examples\nTo ensure the `numpy-clj` implementation is registered, make sure to require it in your namespace and set it as the current implementation.\n```clojure\n(ns your.namespace\n  (:require [numpy-clj.core]\n            [core.matrix :as m]))\n\n(m/set-current-implementation :numpy-clj)\n\n(m/array [[0 1 2]] [3 4 5])\n=\u003e [[0 1 2] ;; this will be a numpy object\n    [3 4 5]]\n```\n\nYou can also directly interoperate using `libpython-clj` and use `numpy` functions directly. Read the [official documentation](https://clj-python.github.io/libpython-clj/Usage.html) to learn more on writing Python in Clojure.\n\n```clojure\n(ns your.namespace\n  (:require [numpy-clj.core]\n            [core.matrix :as m]\n            [libpython-clj.require :refer [require-python]]))\n\n(require-python '[numpy :as np])\n\n(np/linspace 0 10 100)\n=\u003e [ 0.          0.1010101 ...\n```\n\n### Using numpy-clj in your project\nYou can include any commit of this project as a [git dependency](https://clojure.org/guides/deps_and_cli#_using_git_libraries). Copy and paste the sha hash from any commit and add it to your `deps.edn`, like below.\n\n```clojure\n{:deps\n {brianchevalier/numpy-clj\n  {:git/url \"https://github.com/brianchevalier/numpy-clj\"\n   :sha \"\"}}}\n```\n\n## Development\n\nNote: `numpy-clj` currently uses my fork of core.matrix ([via GitHub](https://clojure.org/guides/deps_and_cli#_using_git_libraries)) which adds a deps.edn file. When you run `make test` it will automatically checkout my fork of `core.matrix` with this change (branch: [deps.edn](https://github.com/BrianChevalier/core.matrix/tree/deps.edn)). Make sure to use the `:core-matrix` [alias](https://clojure.org/reference/deps_and_cli#_aliases) to use my branch.\n\nUseful resources:\n* [core.matrix protocols](https://cljdoc.org/d/net.mikera/core.matrix/0.62.0/api/clojure.core.matrix.protocols)\n* [Clojure protocols](https://clojure.org/reference/protocols)\n* [core.matrix implmenetation guide](https://github.com/mikera/core.matrix/wiki/Implementation-Guide)\n* [libpython-clj documentation](https://clj-python.github.io/libpython-clj/libpython-clj.python.html)\n* Slack channels:\n    * [clojurians/core.matrix](https://clojurians.slack.com/archives/C0533TY12)\n    * [clojurians/libpython-clj](https://clojurians.slack.com/archives/CLR5FD4ET)\n\n### Testing\nTo run the core.matrix compliance tests run the following make rule.\n\n```\nmake test\n```\n\n### Continuous Integration (CI)\n* The continous integration here uses uses [GitHub Actions](https://github.com/features/actions)\n\nTo test changes against the exact CI environment:\n* Install [Docker](https://docs.docker.com/get-docker/)\n* Install [act](https://github.com/nektos/act) (eg. with homebrew: `brew install act`)\n* Run the following make rule. Warning: This will require an 18GB(!) download but will fully replicate the GitHub Actions environment\n\n```\nmake ci/local\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianchevalier%2Fnumpy-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianchevalier%2Fnumpy-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianchevalier%2Fnumpy-clj/lists"}