documentation update.

This commit is contained in:
Vítor Santos Costa 2014-09-22 18:12:57 +01:00
parent 5cfe70420f
commit f29e017c63

View File

@ -22,20 +22,21 @@
This package provides a fast implementation of multi-dimensional This package provides a fast implementation of multi-dimensional
matrices of integers and floats. In contrast to dynamic arrays, these matrices of integers and floats. In contrast to dynamic arrays, these
matrices are multi-dimensional and compact. In contrast to static matrices are multi-dimensional and compact. In contrast to static
arrays. these arrays are allocated in the stack. Matrices are available arrays. these arrays are allocated in the stack, and disppear in
by loading the library `library(matrix)`. They are multimensional backtracking. Matrices are available by loading the library
objects of type: `library(matrix)`. They are multimensional objects of type:
+ <tt>terms</tt>: Prolog terms + <tt>terms</tt>: Prolog terms
+ <tt>ints</tt>: bounded integers, represented as an opaque term. The + <tt>ints</tt>: bounded integers, represented as an opaque term. The
maximum integer depends on hardware, but should be obtained from the maximum integer depends on hardware, but should be obtained from the
natural size of the machine. natural size of the machine.
+ <tt>floats</tt>: floating-poiny numbers, represented as an opaque term.
+ <tt>floats</tt>: floating-point numbers, represented as an opaque term.
Matrix elements can be accessed through the `matrix_get/2` Matrix elements can be accessed through the `matrix_get/2`
predicate or through an <tt>R</tt>-inspired access notation (that uses the ciao predicate or through an <tt>R</tt>-inspired access notation (that uses the ciao
style extension to `[]`. Examples include: style extension to `[]`). Examples include:
+ Access the second row, third column of matrix <tt>X</tt>. Indices start from + Access the second row, third column of matrix <tt>X</tt>. Indices start from
@ -161,8 +162,10 @@ of matrix _M_ at offset _Offset_.
create a matrix from a list. Options are: create a matrix from a list. Options are:
+ dim= + dim=
a list of dimensions a list of dimensions
+ type= + type=
integers, floating-point or terms integers, floating-point or terms
+ base= + base=
a list of base offsets per dimension (all must be the same for arrays of a list of base offsets per dimension (all must be the same for arrays of
integers and floating-points integers and floating-points
@ -227,8 +230,9 @@ all elements of a matrix or list
+ `* /2` + `* /2`
multiply two numbers, multiply two matrices or lists element-by-element, or multiply a number from multiply two numbers, multiply two matrices or lists
all elements of a matrix or list element-by-element, or multiply a number from all elements of a
matrix or list
+ `log/1` + `log/1`
@ -566,8 +570,7 @@ Unify _NElems_ with the type of the elements in _Matrix_.
*/ */
:- module( matrix, :- module( matrix,
[op(100, yf, []), [(<==)/2, op(600, xfx, '<=='),
(<==)/2, op(600, xfx, '<=='),
op(700, xfx, in), op(700, xfx, in),
op(700, xfx, ins), op(700, xfx, ins),
op(450, xfx, ..), % should bind more tightly than \/ op(450, xfx, ..), % should bind more tightly than \/
@ -922,7 +925,7 @@ mtimes(I1, I2, V) :-
% %
% three types of matrix: integers, floats and general terms. % three types of matrix: integers, floats and general terms.
% §%
matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :- matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :-
length(Dims,NDims), length(Dims,NDims),