• Stars
    star
    696
  • Rank 62,695 (Top 2 %)
  • Language
    Clojure
  • License
    Other
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

core.matrix : Multi-dimensional array programming API for Clojure

core.matrix

Clojars Project

Build Status Dependency Status

The core.matrix library provides array programming as a language extension for Clojure/Clojurescript, with a focus on numerical computing.

core.matrix will become an official part of Clojure Contrib now that the API is mature and proven, at which point this repo will move to org.clojure/core.matrix

The central objective of core.matrix is to make matrix and array programming idiomatic, productive, elegant and fast in the Clojure environment.

(+ [[1 2]
    [3 4]]
   (* (identity-matrix 2) 3.0))

=> [[4.0 2.0]
    [3.0 7.0]]

(shape [[2 3 4] [5 6 7]]) ; => [2 3]

(mmul
  (array [[2 2] [3 3]])
  (array [[4 4] [5 5]])) ; => [[18 18] [27 27]]

;; Note: nested Clojure vectors can be used as matrices

Key goals of core.matrix:

  • Provide a clear, standard API / abstraction for matrix and array programming in Clojure
  • Enable pluggable support for different underlying matrix library implementations
  • Provide general purpose n-dimensional array implementations
  • Provide a foundation for other projects in the ecosystem (e.g. Incanter)
  • Enable high performance numerical computing
  • Allow idiomatic Clojure coding for numerical code

Documentation

For general core.matrix documentation and examples see the Wiki:

API documentation is available here

For a general introduction, the slide and video from the 2013 Clojure Conj talk are available here:

Clojurescript

To develop for clojurescript you will need to use the cljs-dev profile like this:

lein with-profile +cljs-dev repl

or using figwheel:

lein with-profile +cljs-dev figwheel

To build the Clojurescript unit tests you can run:

lein with-profile +cljs cljsbuild once

and then load resources/public/test.html in a browser to run the tests.

Docker

A Docker setup is available for quick reproducable envivironment.

Sample Commands

To build the dev environment image. This is currently based on clojure:openjdk-11-lein-buster image.

`docker build -f ./docker/Dockerfile . -t core.matrix-dev`

To run the build after the dev image is ready

`docker run --rm core.matrix-dev`

To run interactive bash shell for adhoc build commands

`docker run -it --entrypoint bash core.matrix-dev`

Status

core.matrix is fully functional and usable in production applications. As well as supporting the standard Clojure data structures, multiple back end implementations exist that provide optimised matrix implementations. The most mature implementations are currently:

  • vectorz-clj : a fast pure-JVM matrix library for Clojure, supporting full ND arrays
  • Clatrix : native code matrix library using BLAS
  • NDArray : a general purpose pure Clojure N-dimensional array implementation, included as part of core.matrix itself
  • nd4clj : This is a wrapper around the Nd4j api a native code and GPU accelerated matrix library

For Clojurescript:

  • aljabr : a cljc matrix library supporting Clojurescript

The API is relatively mature but still subject to some changes at present (at least up until release 1.0.0), so users should be prepared to deal with potential breaking changes when updating to future releases.

Contributing

All contributions / ideas welcome!

There are a number of proposed enhancements listed as GitHub issues: these are a good place to start if you wish to contribute to core.matrix:

If you wish to contribute code, please ensure you have a Clojure Contributors Agreement signed and on file. For more information see:

Discussions related to core.matrix generally take place on the "Numerical Clojure" group:

If you are interested in writing a core.matrix implementation, see:

You can also find a protocol implementation summary here:

Thanks

YourKit is kindly supporting this open source project with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler.

More Repositories

1

imagez

Image processing library for Clojure
Clojure
296
star
2

clisk

The Clojure Image Synthesis Kit
Clojure
278
star
3

vectorz

Fast and flexible numerical library for Java featuring N-dimensional arrays
Java
234
star
4

vectorz-clj

Fast matrix and vector maths library for Clojure - as a core.matrix implementation
Clojure
199
star
5

ironclad

Ironclad: Steam Legions - A steampunk strategy game in Clojure
Clojure
133
star
6

clojure-utils

A library of various small but handy clojure utility functions
Clojure
114
star
7

kiss

A statically typed, functional Lisp, building upon Clojure
Java
78
star
8

alchemy

A 7 day roguelike in Clojure
Clojure
75
star
9

swing-console

A Swing text console component
Java
68
star
10

tyrant

Tyrant Roguelike game in Java
Java
55
star
11

enlight

A Clojure raytracer
Java
44
star
12

timeline

Adding the time dimension to Clojure data
Clojure
39
star
13

magic

Experimental typed JVM Lisp inspired by Clojure
Java
33
star
14

cljunit

JUnit test integration for Clojure
Java
20
star
15

spectral

Experiments in Overtone with spectral analysis
Clojure
18
star
16

telegenic

Video creation and manipulation in Clojure
Clojure
18
star
17

task

A Clojure library for running and managing interactive tasks
Clojure
17
star
18

orculje

A Clojure toolkit for building roguelike games
Clojure
13
star
19

randomz

Library of fast random number generation functions
Java
12
star
20

mikera

Mike's general purpose Java library
Java
11
star
21

clojure-golf

Code golfing in Clojure - for fans of obfuscated code and code golf
Clojure
11
star
22

blockgame

A decentralised block game, 100% on-chain 3D universe
Java
11
star
23

core.matrix.complex

Complex numerical arrays in Clojure, as an extension to core.matrix
Clojure
9
star
24

motion-sensor

Clojure library to interface with TI CC254X accelerometers / motion sensors
8
star
25

steampunk-laf

Steampunk look and feel for Java Swing
Java
8
star
26

singa-viz

Animated visualisation of Singapore with Clojure and core.matrix
Clojure
5
star
27

mikera-clojure

Mike's library of Clojure functions
Clojure
4
star
28

trellis

A mildly opinionated Clojure framework for data-driven web applications
Clojure
3
star
29

glaze

A lightweight Clojure wrapper library for LWJGL
Java
3
star
30

edn-pojos

A lightweight library for building / unmarshalling Java POJO objects from edn format data
Java
3
star
31

vectorz-opencl

Experimental
Java
3
star
32

clojure-pom

A generic parent pom.xml for Clojure projects, based on mikera-pom
2
star
33

core.matrix.benchmark

Benchmark and testing suite for core.matrix implementations
Clojure
2
star
34

java-life

Flexible cellular automata system inspired by Conway's Game of Life
Java
2
star
35

vectorz-native

Fast native-optimised linear algebra library for Java
Java
2
star
36

euler-clojure

Project Euler solutions in Clojure
Clojure
2
star
37

enchant

Clojure integration for the Magic language
Clojure
2
star
38

clobber

Prototype-based object system for Clojure (experimental)
Clojure
2
star
39

mathz

Library of maths functions and utilities for Java
Java
2
star
40

streamz

RESTful server for realtime data streams
Clojure
2
star
41

mikera-gui

GUI components and utilities for Java
Java
2
star
42

mikera.net

Mike's personal website
HTML
1
star
43

clj-spss

SPSS .Sav file reader for Clojure
Java
1
star
44

mikera-pom

Parent pom.xml for mikera projects
1
star
45

datomic-test

Test project for Datomic database, with Clojure, Java and Maven
Clojure
1
star
46

cuboid

Java
1
star