• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    Java
  • License
    GNU Lesser Genera...
  • Created about 12 years ago
  • Updated over 4 years ago

Reviews

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

Repository Details

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

Vectorz Logo

Fast double-precision vector and matrix maths library for Java, based around the concept of N-dimensional arrays.

This library is designed for use in games, simulations, raytracers, machine learning etc. where fast vector maths is important.

Some highlights:

  • Vectorz can do over 1 billion 3D vector operations per second on a single thread.
  • Specialised matrix types for efficient optimised operations (identity, diagonal, sparse etc.).
  • Support for arbitrary n-dimensional numerical arrays.

Status

Vectorz is reasonably mature, battle tested and being used in production applications. The API is still evolving however as new features get added so you can expect a few minor changes, at least until version 1.0.0

Build Status Dependency Status

Documentation

See the Vectorz Wiki

Example usage

    Vector3 v=Vector3.of(1.0,2.0,3.0);		
    v.normalise();                       // normalise v to a unit vector
    		
    Vector3 d=Vector3.of(10.0,0.0,0.0);		
    d.addMultiple(v, 5.0);               // d = d + (v * 5)
    
	Matrix33 m=Matrixx.createXAxisRotationMatrix(Math.PI);
	Vector3 rotated=m.transform(d);      // rotate 180 degrees around x axis	    

Key features

  • Supports double typed vectors of arbitrary size
  • Both mutable and immutable vectors are supported, enabling high performance algorithms
  • Support for any size matrices, including higher dimensional (NDArray) matrices
  • Ability to create lightweight view vectors (e.g. to access subranges of other vectors)
  • Library of useful mathematical functions on vectors
  • Vectors have lots of utility functionality implemented - Cloneable, Serializable, Comparable etc.
  • Various specialised types of vectors/matrices types (e.g. identity matrices, diagonal matrices)
  • Support for affine and other matrix transformations
  • sparse arrays for space efficient large vectors and matrices where most elements are zero
  • Operator system provides composable operators that can be applied to array elements
  • Input / output of vectors and matrices - in various formats including readable edn format

Vectorz is designed to allow the maximum performance possible for vector maths on the JVM.

This focus has driven a number of important design decisions:

  • Support for sparse vectors and other specialised array types
  • Specialised primitive-backed small vectors (1,2,3 and 4 dimensions) and matrices (1x1, 2x2, 3x3 and M*3)
  • Abstract base classes preferred over interfaces to allow more efficient method dispatch
  • Multiple types of vector are provided for optimised performance in special cases
  • Hard-coded fast paths for most common 2D and 3D operations
  • Vector operations are generally not thread safe, by design
  • Concrete classes are generally final

If you have a use case that isn't yet well optimised then please post an issue - the aim is to make all common operations as efficient as possible.

More Repositories

1

core.matrix

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

imagez

Image processing library for Clojure
Clojure
296
star
3

clisk

The Clojure Image Synthesis Kit
Clojure
278
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