18.15. Vectors and matrices

The following cmavo are discussed in this section:

jo'i

JOhI

start vector

te'u

TEhU

end vector

pi'a

VUhU

matrix row combiner

sa'i

VUhU

matrix column combiner

A mathematical vector is a list of numbers, and a mathematical matrix is a table of numbers. Lojban considers matrices to be built up out of vectors, which are in turn built up out of operands.

jo'i, the only cmavo of selma'o JOhI, is the vector indicator: it has a syntax reminiscent of a forethought operator, but has very high precedence. The components must be simple operands rather than full expressions (unless parenthesized). A vector can have any number of components; te'u is the elidable terminator. An example:

Example 18.107. 

lijo'ipaboireboite'usu'ijo'iciboivoboi
The-numberarray(one,two)plusarray(three,four)
dulijo'ivoboixaboi
equalsthe-numberarray(four,six).
(1,2) + (3,4) = (4,6)

Vectors can be combined into matrices using either pi'a, the matrix row operator, or sa'i, the matrix column operator. The first combines vectors representing rows of the matrix, and the second combines vectors representing columns of the matrix. Both of them allow any number of arguments: additional arguments are tacked on with the null operator ge'a.

Therefore, the magic square matrix

816
357
492

can be represented either as:

Example 18.108. 

jo'ibiboipaboixapi'ajo'iciboimuboize
the-vector(816)matrix-rowthe-vector(357),
ge'ajo'ivoboisoboire
the-vector(492)

or as

Example 18.109. 

jo'ibiboiciboivosa'ijo'ipaboimuboiso
the-vector(834)matrix-columnthe-vector(159),
ge'ajo'ixaboizeboire
the-vector(672)

The regular mekso operators can be applied to vectors and to matrices, since grammatically both of these are expressions. It is usually necessary to parenthesize matrices when used with operators in order to avoid incorrect groupings. There are no VUhU operators for the matrix operators of inner or outer products, but appropriate operators can be created using a suitable symbolic lerfu word or string prefixed by ma'o.

Matrices of more than two dimensions can be built up using either pi'a or sa'i with an appropriate subscript numbering the dimension. When subscripted, there is no difference between pi'a and sa'i.