/*** This module provides matrixes of vector rows. A matrix is a* compound with varying number of vectors. A vector can be* accessed by the predicate []/3. The first vector has the* index one. An element can be accessed by the predicate []/4.* The first element in each vector has the index one. The arity* of the matrix 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,D]], Y is X[2][1].* X is [[A,B],[C,D]],* Y is C* ?- X is [[A,B],[C,D]], Y is X[2,1].* X is [[A,B],[C,D]],* Y is C** This module provides arithmetic for matrixes. Besides change sign,* addition and subtraction, we also find multiplication, division and* power. The multiplication uses the usual multiplication sign (*)/2* despite the fact that matrix multiplication is not commutative. Power* is defined for an integer exponent. Operations such as transposing* are currently not provided.** Examples:* ?- X is [[1,1/2],[1/2,1/3]], Y is X^(-1).* X is [[1,1/2],[1/2,1/3]],* Y is [[4,-6],[-6,12]]* ?- X is [[1,1/A],[1,1]], Y is X^(-1).* X is [[1,1/A],[1,1]],* Y is [[-A/(1-A),1/(1-A)],[A/(1-A),-A/(1-A)]]** The matrix inversion is implemented by an exchange step method. It* works for constant and symbol expression elements. We have not yet* implemented pivot search so that the current implementation might* not find an inversion even if there exists one. Error handling is* rudimentary. Cancellation does not yet generate non-zero* side conditions.** Warranty & Liability* To the extent permitted by applicable law and unless explicitly* otherwise agreed upon, XLOG Technologies GmbH makes no warranties* regarding the provided information. XLOG Technologies GmbH assumes* no liability that any problems might be solved with the information* provided by XLOG Technologies GmbH.** Rights & License* All industrial property rights regarding the information - copyright* and patent rights in particular - are the sole property of XLOG* Technologies GmbH. If the company was not the originator of some* excerpts, XLOG Technologies GmbH has at least obtained the right to* reproduce, change and translate the information.** Reproduction is restricted to the whole unaltered document. Reproduction* of the information is only allowed for non-commercial uses. Selling,* giving away or letting of the execution of the library is prohibited.* The library can be distributed as part of your applications and libraries* for execution provided this comment remains unchanged.** Restrictions* Only to be distributed with programs that add significant and primary* functionality to the library. Not to be distributed with additional* software intended to replace any components of the library.** Trademarks* Jekejeke is a registered trademark of XLOG Technologies GmbH.*//***********************************************************//* Array Builder & Access *//***********************************************************/* X[Y, Z]:* The predicate succeeds in Z with the Y-the vector* of the matrix X.*/% +Matrice [+Integer, -Vector]* X[Y, Z, T]:* The predicate succeeds in T with the Z-the element* of the Y-the vector of X.*/% +Matrice [+Integer, +Integer, -Element]* len(X, Y):* The predicate succeeds in Y with the number of vectors* in the matrix X.*/% len(+Matrice, -Integer)/***********************************************************//* Basic Arithmetic *//***********************************************************/* -(X, Y):* The predicate succeeds in Y with the sign changed matrix X.*/% -(+Matrice, -Matrice)* +(X, Y, Z):* The predicate succeeds in Z with the sum of the matrix X and* the matrix Y.*/% +(+Matrice, +Internal, -Matrice)* -(X, Y, Z):* The predicate succeeds in Z with the matrix X subtracted* by the matrix Y.*/% -(+Matrice, +Internal, -Matrice)* *(X, Y, Z):* The predicate unifies Z with the product of the matrix X followed* by the matrix Y.*/% *(+Matrice, +Internal, -Matrice)* /(X, Y, Z):* The predicate succeeds in Z with the matrix X divided* by the matrix Y.*/% /(+Matrice, +Internal, -Matrice)* ^(X, Y, Z):* The predicate succeeds in Z with the Y-the power of the matrix X.*/% ^(+Matrice, +Integer, -Matrice)R = P./***********************************************************//* CAS Display Hook *//***********************************************************/* sys_printable_value(F, G):* The predicate succeeds in G with a custom form of F. The* predicate should be extended for custom forms.*/% sys_printable_value(+Term, -Term)/*********************************************************************//* Generic Hook *//*********************************************************************/* X is E:* The predicate succeeds in evaluating E by using polymorphism.*/% is(-Internal, +Expr)X = E.