mikera/vectorz-clj


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

Language: Clojure


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

Project Statistics

Sourcerank 5
Repository Size 795 KB
Stars 176
Forks 21
Watchers 21
Open issues 7
Dependencies 0
Contributors 6
Tags 68
Created
Last updated
Last pushed

Top Contributors See all

Mike Anderson Prasant Chidella Matt Revelle michaelochurch The Gitter Badger Alexander Kiel

Recent Tags See all

vectorz-clj-0.47.0 May 18, 2017
vectorz-clj-0.46.0 March 01, 2017
vectorz-clj-0.45.0 August 15, 2016
vectorz-clj-0.44.1 May 30, 2016
vectorz-clj-0.44.0 April 01, 2016
vectorz-clj-0.43.1 February 23, 2016
vectorz-clj-0.43.0 January 29, 2016
vectorz-clj-0.42.0 January 26, 2016
vectorz-clj-0.41.0 January 15, 2016
vectorz-clj-0.40.0 January 03, 2016
vectorz-clj-0.39.0 December 20, 2015
vectorz-clj-0.38.0 December 05, 2015
vectorz-clj-0.37.0 October 29, 2015
vectorz-clj-0.36.0 October 05, 2015
vectorz-clj-0.35.0 September 23, 2015

Interesting Forks See all

clojure-numerics/vectorz-clj
Fast matrix and vector maths library for Clojure
Clojure - Last pushed - 5 stars
CNXTEoE/vectorz-clj
Fast matrix and vector maths library for Clojure - as a core.matrix implementation
This repository is no longer available - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-11-24 18:37:15 UTC

Login to resync this repository