• Stars
    star
    199
  • Rank 189,821 (Top 4 %)
  • Language
    Clojure
  • Created over 11 years ago
  • Updated over 5 years ago

Reviews

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

Repository Details

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

vectorz-clj

Join the chat at https://gitter.im/mikera/vectorz-clj

Clojars Project

Build Status Dependency Status

Fast vector and matrix library for Clojure, building on the Vectorz library and designed to work with the core.matrix array programming API.

vectorz-clj is designed so that you don't have to compromise, offering both:

  • An idiomatic high-level Clojure API using core.matrix
  • General purpose multi-dimensional arrays
  • High performance (about as fast as you can get on the JVM). vectorz-clj is currently the fastest pure-JVM vector/matrix library available for Clojure

The library was originally designed for games, simulations and machine learning applications, but should be applicable for any situations where you need numerical double arrays.

Important features:

  • "Pure" functions for an idiomatic functional programming style are provided. These return new vectors without mutating their arguments.
  • Primitive-backed special purpose vectors and matrices for performance, e.g. Vector3 for fast 3D maths.
  • Flexible DSL-style functions for manipulating vectors and matrices, e.g. the ability to create a "view" into a subspace of a large vector.
  • core.matrix fully supported - see: https://github.com/mikera/core.matrix
  • Pure cross-platform JVM code - no native dependencies
  • "Impure" functions that mutate vectors are available for performance when you need it: i.e. you can use a nice functional style most of the time, but switch to mutation when you hit a bottleneck.

Documentation

vectorz-clj is intended to be used primarily as a core.matrix implementation. As such, the main API to understand is core.matrix itself. See the core.matrix wiki for more information:

For more information about the specific details of vectorz-clj itself, see the vectorz-clj Wiki.

Status

vectorz-clj requires Clojure 1.4 or above, Java 1.7 or above, and an up to date version of core.matrix

vectorz-clj is reasonably stable, and implements all of the core.matrix API feature set.

License

Like Vectorz, vectorz-clj is licensed under the LGPL license:

Usage

Follow the instructions to install with Leiningen / Maven from Clojars:

You can then use Vectorz as a standard core.matrix implementation. Example:

    (use 'clojure.core.matrix)
    (use 'clojure.core.matrix.operators)           ;; overrides *, + etc. for matrices
    
    (set-current-implementation :vectorz)  ;; use Vectorz as default matrix implementation
    
    ;; define a 2x2 Matrix
    (def M (matrix [[1 2] [3 4]]))
    M
    => #<Matrix22 [[1.0,2.0][3.0,4.0]]>
    
    ;; define a length 2 vector (a 1D matrix is considered equivalent to a vector in core.matrix)
    (def v (matrix [1 2]))
    v
    => #<Vector2 [1.0,2.0]>
    
    ;; Matrix x Vector elementwise multiply
    (mul M v)
    => #<Matrix22 [[1.0,4.0],[3.0,8.0]]>
    
    ;; Matrix x Vector matrix multiply (inner product)
    (inner-product M v)
    => #<Vector2 [5.0,11.0]>

For more examples see Wiki Examples

More Repositories

1

core.matrix

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

imagez

Image processing library for Clojure
Clojure
296
star
3

clisk

The Clojure Image Synthesis Kit
Clojure
278
star
4

vectorz

Fast and flexible numerical library for Java featuring N-dimensional arrays
Java
234
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