## Abstract

A module type for standard Euclidean vectors.

Vectors of arbitrary dimension can be constructed with
`mk_vspace`

by passing in a `vector`

and a
`real`

module, although for most uses the
`mk_vspace_2d`

and `mk_vspace_3d`

modules are simpler and
sufficient.

## Synopsis

module type vspace = {
| |||||||||||||||||||||||||||||

module type vspace_2d = {
| |||||||||||||||||||||||||||||

module mk_vspace_2d | : | (real: real) -> vspace_2d with real = real.t | |||||||||||||||||||||||||||

module type vspace_3d = {
| |||||||||||||||||||||||||||||

module mk_vspace_3d | : | (real: real) -> vspace_3d with real = real.t | |||||||||||||||||||||||||||

module mk_vspace | : | (V: vector) -> (real: real) -> vspace with real = real.t with vector = V.vector real.t |

## Description

- ↑module type vspace
- ↑type real
- ↑type vector
A vector type. Semantically a sequence of

`real`

s.- ↑val +: vector -> vector -> vector
- ↑val -: vector -> vector -> vector
- ↑val dot: vector -> vector -> real
Inner product.

- ↑val quadrance: vector -> real
Squared norm.

- ↑val scale: real -> vector -> vector
- ↑val norm: vector -> real
- ↑val normalise: vector -> vector
Transform to unit vectortor.

- ↑module type vspace_2d
A two-dimensional vector space is just a vector space, but we give the vectors a convenient record type.

- ↑module mk_vspace_2d
Construct a 2D vector space.

- ↑module type vspace_3d
A three-dimensional vector space is just a vector space, but we give the vectors a convenient record type. Also, cross product is defined.

- ↑module mk_vspace_3d
Construct a 3D vector space.