io7m
io7m-jtensors 6.0.2
2.1
Vectors

- 2.1.1. Types
- 2.1.2. Access control

2.1.1
Types
1
The jtensors package provides 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. Each vector type is available in mutable or immutable 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.1. Vector type naming

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

2
A comprehensive list of the available vector types is as follows:
2.1.1.2. Available vector types

- VectorM2D
- VectorM2F
- VectorM2I
- VectorM2L
- VectorM3D
- VectorM3F
- VectorM3I
- VectorM3L
- VectorM4D
- VectorM4F
- VectorM4I
- VectorM4L
- VectorI2D
- VectorI2F
- VectorI2I
- VectorI2L
- VectorI3D
- VectorI3F
- VectorI3I
- VectorI3L
- VectorI4D
- VectorI4F
- VectorI4I
- VectorI4L

2.1.2
Access control
1
If a function only needs to read from a value of a vector type, then it would be desirable to be able to statically enforce this fact. Therefore, the package provides a set of Readable interfaces that all vector types implement. By writing a function that takes a value of a type implementing a Readable interface, the programmer is implicitly stating that this function does not modify the vector.
2.1.2.1. Available vector Readable types

- VectorReadable2I
- VectorReadable2F
- VectorReadable2D
- VectorReadable2L
- VectorReadable3I
- VectorReadable3F
- VectorReadable3D
- VectorReadable3L
- VectorReadable4I
- VectorReadable4F
- VectorReadable4D
- VectorReadable4L