Skip to content
Mike Anderson edited this page Aug 13, 2015 · 9 revisions

Adding Vectorz as a dependency

You need to have the Vectorz library .jar and all its dependencies on your classpath if you want to use Vectorz.

The easiest way to do this is to use Maven. Simply add the following to the dependencies section in your pom.xml file:

<dependency>
	<groupId>net.mikera</groupId>
	<artifactId>vectorz</artifactId>
	<version>0.48.0</version>
</dependency>

Basic Vectorz types

mikera.vectorz.Vector is the most basic type in Vectorz - it represents a one-dimensional vector of double values, analogous to a normal Java array.

import mikera.vectorz.*;
...
Vector v=Vector.of(1,2,3,4);
double sum=v.elementSum(); // => 10.0

Factory classes

There are a lot of helpful static factory methods in the following classes:

  • mikera.vectorz.Vectorz
  • mikera.matrixx.Matrixx
  • mikera.arrayz.Arrayz

Example usage:

Matrix m = Matrix.createSquareMatrix(10); // => 10x10 square matrix, initially filled with zeros