Module vector

This module provides vectors of element columns. A vector is a compound with varying number of elements which can be constants or symbolic expressions. An element can be accessed by the predicate []/3. The first element has the index one. The arity of the vector can be queried by the predicate len/2. Vectors can be created by the two special forms [_ | _] and {_ | _} introduced in the module element.

Examples:
?- X is [A,B,C], Y is len(X).
X is [A,B,C],
Y = 3
?- X is [A,B,C], Z is X[2].
X is [A,B,C],
Z is B

The predicate sum/2, min/2 and max/2 can be used to compute the sum, minimum or maxi-mum of the elements of a vector. Further aggregate functions are currently not provided. This module further provides some rudimentary arithmetic such as sign change, addition and subtraction. Other operations such as scalar product or transposing are currently not provided. Error handling is rudimentary.

The vector based consing returns a matrix. The consing does currently not check that the second argument is a proper list and that all elements of the list are vectors. The intention here is to use the consing to only create homogenous matrixes of vectors. The reader interested in the methods of the matrix should browse into the module matrix.

The following vector predicates are defined:

.(X, Y, Z):
The predicate succeeds in Z with the consing of X and Y.
X[Y, Z]:
The predicate succeeds in Z with the Y-the element of the vector X.
len(X, Y):
The predicate succeeds in Y with the number of elements in the vector X.
sum(X, Y):
The predicate succeeds in Y with the sum of elements in the vector X.
min(X, Y):
The predicate succeeds in Y with the minimum of the elements in the vector X.
max(X, Y):
The predicate succeeds in Y with the maximum of the elements in the vector X.
-(X, Y):
The predicate succeeds in Y with the sign changed vector X.
+(X, Y, Z):
The predicate succeeds in Z with the sum of the vector X and the vector Y.
-(X, Y, Z):
The predicate succeeds in Z with the vector X subtracted by the vector Y.

Kommentare