This module implements a data type cube for representing multidimensional cubes.
This module is considered “trusted”, that is, it can be installed by non-superusers who have CREATE privilege on the current database.
Table F.1 shows the valid external representations for the cube type. x, y, etc. denote floating-point numbers.
Table F.1. Cube External Representations
| External Syntax | Meaning |
|---|---|
|
A one-dimensional point (or, zero-length one-dimensional interval) |
( |
Same as above |
|
A point in n-dimensional space, represented internally as a zero-volume cube |
( |
Same as above |
( |
A one-dimensional interval starting at x and ending at y or vice versa; the order does not matter |
[( |
Same as above |
( |
An n-dimensional cube represented by a pair of its diagonally opposite corners |
[( |
Same as above |
It does not matter which order the opposite corners of a cube are entered in. The cube functions automatically swap values if needed to create a uniform “lower left — upper right” internal representation. When the corners coincide, cube stores only one corner along with an “is point” flag to avoid wasting space.
White space is ignored on input, so [( is the same as x),(y)][ ( .x ), ( y ) ]
Values are stored internally as 64-bit floating point numbers. This means that numbers with more than about 16 significant digits will be truncated.
Table F.2 shows the specialized operators provided for type cube.
Table F.2. Cube Operators
|
Operator Description |
|---|
|
Do the cubes overlap? |
|
Does the first cube contain the second? |
|
Is the first cube contained in the second? |
|
Extracts the |
|
Extracts the |
|
Computes the Euclidean distance between the two cubes. |
|
Computes the taxicab (L-1 metric) distance between the two cubes. |
|
|