2.1
Vectors

- 2.1.1. Computation Types
- 2.1.2. Storage Types
- 2.1.3. Phantom Types

2.1.1
Computation Types
1
The com.io7m.jtensors package provides computation vectors with single-precision (float) elements, double-precision (double) elements, integer (int), and long integer (long) elements. Each vector type is available in two, three, and four element versions. The package unambiguously identifies the vector types by using the following naming conventions for the types (given as a simple EBNF grammar) :
2.1.1.2 Vector type naming

    prefix       = "Vector" | "PVector" ;
    size         = "2" | "3" | "4" ;
    element_type = "I" | "L" | "F" | "D" ;
    type         = prefix , size , element_type ;

3
Computation vectors are always immutable and are defined in such a way to allow the Java virtual machine to efficiently inline all vector method calls and to eliminate the allocations of intermediate vectors via escape analysis.
4
The available vector types include:
2.1.1.5 Vector types

- Vector2D
- Vector3D
- Vector4D
- Vector2F
- Vector3F
- Vector4F
- Vector2I
- Vector3I
- Vector4I
- Vector2L
- Vector3L
- Vector4L
- PVector2D
- PVector3D
- PVector4D
- PVector2F
- PVector3F
- PVector4F
- PVector2I
- PVector3I
- PVector4I
- PVector2L
- PVector3L
- PVector4L

2.1.2
Storage Types
1
The com.io7m.jtensors package provides mutable storage vectors. A storage vector is a mutable vector upon which only very simple get and set operations are defined. The intention is to allow all intermediate computations to be written with immutable computation vectors, with the final results of those computations being written to storage vectors in order to, for example, be passed directly to native code without requiring copying.
2
To enumerate the available storage vector types, see the API documentation for the VectorStorageType interface.
2.1.3
Phantom Types
1
The com.io7m.jtensors package also provides copies of the existing vector types indexed by a phantom type parameter in order to allow the programmer to make semantically distinct values type-incompatible [1].

[1]
See http://io7m.com/documents/tt1-pt/.