Vectors, matrices and linear algebra.

adj(x): [*] of x, i.e. the matrix y of cofactors of x such that x*y = det(x)*Id. x must be a (non necessarily invertible) square matrix.

The library syntax is $\teb$adj(x).

algdep(x, k): [*] x being real or complex, finds a polynomial of degree at most k having x as approximate root. The algorithm used is a variant of the LLL algorithm due to Hastad, Lagarias and Schnorr (STACS 1986). Note that the polynomial which is obtained is not necessarily the ``correct'' one. One can check the closeness either by a polynomial evaluation or substitution, or by finding the roots of the polynomial given by algdep.

The library syntax is $\teb$algdep(x, k, prec), where k is a 32-bit C-integer.

algdep2 (x, k, bit): [*] x being real or complex, finds a polynomial of degree at most k having x as approximate root. bit is a number which should be approximately equal to half the number of precision bits. The algorithm used is the LLL algorithm. Note that the polynomial which is obtained is not necessarily the ``correct'' one. One can check the closeness either by a polynomial evaluation or substitution, or by finding the roots of the polynomial given by algdep2.

The library syntax is $\teb$algdep2(x, k, bit, prec), where k and bit are 32-bit C-integers.

char(x, y): [*] of x with respect to the variable y, i.e. determinant of y*I - x. x must be a square matrix.

The library syntax is $\teb$caract(x, v), where v is the variable number.

char2(x, y): characteristic polynomial of the square matrix x with respect to the variable y using the hessenberg form. This is faster than char when the coefficients are integermod a prime or real numbers, but can be slower in other base rings.

The library syntax is $\teb$carhess(x, v), where v is the variable number.

concat(x, y): concatenation of x and y. If x or y is not a vector or matrix, it is considered as a one dimensional vector. All types are allowed for x and y, but the sizes must be compatible. Note that matrices are concatenated horizontally, i.e. the number of rows stays the same. Using transpositions, it is easy to concatenate them vertically.

To concatenate vectors sideways (i.e. to obtain a 2-row or two column matrix), first transform the vector into a 1-row or 1-column matrix using the function mat (3.7.22.).

The library syntax is $\teb$concat(x, y).

det(x): determinant of x. x must be a square matrix. Another program called [*](x) is better when the entries of the matrix are reals or integers for example, but can be much worse for more complicated entries like multivariate polynomials.

The library syntax is $\teb$det(x) and $\teb$det2(x).

eigen(x): gives the eigenvectors of x as columns of a matrix.

The library syntax is $\teb$eigen(x).

extract(x, y): extraction of components of the vector or matrix x according to y. x must be a vector or a matrix. In the case of a matrix, the components are as usual the columns of x. y must be either a number of PARI type integer, in which case it is considered as a mask: The binary bits of y are read from right to left, but correspond to taking the components from left to right. For example, if y = 13 = (1101)2 then the components 1,3 and 4 are extracted.

Or y can be a vector, with integer entries, in which case these entries correspond to the component number to be extracted, in the order specified.

In the case of a matrix, the difference between extract and matextract is that only columns are extracted.

The library syntax is $\teb$extract(x, y).

gauss(x, y): x being a square matrix and y a column vector, finds the solution u of x*u = y, using gaussian elimination. This has the same effect, but is much faster, than x-1*y.

The library syntax is $\teb$gauss(x, y).

hermite(x): if x is a (not necessarily square) matrix of maximal rank, finds the upper triangular Hermite Normal Form of x (which is a square matrix).

The library syntax is $\teb$hnf(x).

hess(x): Hessenberg form of the square matrix x.

The library syntax is $\teb$hess(x).

hilbert(x): x being a 32-bit C-integer, creates the [*] of order x, i.e. the matrix whose coefficient (i,j) is 1$\over$i+j-1.

The library syntax is $\teb$hilbert(x).

indsort(x): indirect sorting of the vector x, i.e. if x is an n-dimensional vector, creates the permutation of [1, 2,..., n] which applied to the components of x sorts x in increasing order.

The library syntax is $\teb$indexsort(x).

jacobi(x): x being a real symmetric matrix, this gives a vector having two components: the first one is the vector of eigenvalues of x, the second is the corresponding orthogonal matrix of eigenvectors of x. The method used is Jacobi's method for symmetric matrices.

The library syntax is $\teb$jacobi(x).

ker(x): gives a basis for the kernel of the matrix x as columns of a matrix. A priori the matrix can have entries of any type. See also keri and kerr.

The library syntax is $\teb$ker(x).

keri(x): same as ker, except that it assumes that the matrix has entries of type integer. In that case it is much faster.

The library syntax is $\teb$keri(x).

kerr(x): gives a basis for the kernel of the matrix x as columns of a matrix, where x has elements which can be nonexact real or complex numbers. In that case, the precision of the matrix entries determines what is meant by an element of the kernel. In particular, if the matrix is ill conditioned, the results may not be what you expect.

The library syntax is $\teb$kerreel(x).

image(x): gives a basis for the image of the matrix x as columns of a matrix. A priori the matrix can have entries of any type.

The library syntax is $\teb$image(x).

lindep(x): linear dependencex being a vector with real or complex coefficients, finds a small integral linear combination among these coefficients using a variant of the LLL algorithm due to Hastad, Lagarias and Schnorr (STACS 1986).

The library syntax is $\teb$lindep(x, prec).

lindep2(x, bit): linear dependencex being a vector with real or complex coefficients, finds a small integral linear combination among these coefficients using the LLL algorithm. bit is a parameter which should be about one half the number of precision bits.

The library syntax is $\teb$lindep2(x, bit, prec) where bit is a C-integer.

lll(x): LLL algorithm applied to the columns of the (non necessarily square) matrix x. The result is a square transformation matrix T such that xT is an LLL-reduced basis of the lattice generated by the column vectors of x. The computations are done with real numbers (i.e. not with rational numbers) hence are fast but as presently programmed (version 1.35) are numerically unstable.

The library syntax is $\teb$lll(x, prec).

lllgram(x): same as LLL except that the matrix x which is now square is the gram matrix of the lattice vectors, and not the coordinates of the vectors themselves. The result is again the transformation matrix T which gives (as columns) the coefficients with respect to the initial basis vectors. Same remarks as for LLL about numerical instability in the present version 1.35.

The library syntax is $\teb$lllgram(x).

lllrat(x): same as LLL except that the computations are all done in rational numbers. Hence no risk of numerical instability, but extremely slow.

The library syntax is $\teb$lllrat(x).

mat(x): transform the object x into a matrix. If x is not a vector or a matrix, this creates a 1×1 matrix. If x is a row (resp. column) vector, this creates a 1-row (resp. 1-column) matrix. If x is already a matrix, a copy of x is created.

This function can be useful in connection with the function concat (see 3.7.5.).

The library syntax is $\teb$gtomat(x).

matextract (x, y, z): extraction of a matrix from the matrix x, the line mask or vector y and the column mask or vector z. x must be a matrix, and y and z either numbers of PARI type integer or vectors. The extraction is done using the same rules as for extract (3.7.8). The difference with extract is that both lines and columns are extracted.

The library syntax is $\teb$matextract(x, y, z).

minim(x): number of minimal vectors and minimum on $\Bbb$Z of the positive definite integral quadratic form x, as a two component vector. x is represented by a square and symmetric matrix with integer entries.

The library syntax is $\teb$minim(x)

pascal(x): creates as a matrix the lower triangular [*] of order x + 1 (i.e. with binomial coefficients up to x).

The library syntax is $\teb$pascal(x), where x is a 32-bit C-integer.

rank(x): rank of the matrix x.

The library syntax is $\teb$rank(x), and the result is a 32-bit C-integer.

signat(x): signature of the quadratic form represented by the symmetric matrix x. The result is a two-component vector.

The library syntax is $\teb$signat(x)

smith(x): if x is a nonsingular square matrix, outputs the vector of elementary divisors of x (i.e. the diagonal of the Smith normal form of x)

The library syntax is $\teb$smith(x).

sort(x): sort the vector x in ascending order, using the heapsort method. x must be a vector, and its components integers, reals, or fractions. A related function is indsort (see 3.7.13 above) which gives the indexes of the sorted vector in terms of the initial one. For example, extract(x,indsort(x)) is equivalent to sort(x).

The library syntax is $\teb$sort(x).

sqred(x): [*] of the quadratic form represented by the symmetric matrix x. The result is a matrix whose diagonal entries are the coefficients of the squares, and the non diagonal entries represent the bilinear forms.

The library syntax is $\teb$sqred(x).

supplement(x): assuming that the columns of the matrix x are linearly independent (if they are not, an error message is issued), find a square invertible matrix whose first columns are the columns of x, i.e. supplement the columns of x to a basis of the whole space.

The library syntax is $\teb$suppl(x).

trace(x): This applies to quite general x. If x is not a matrix, it is equal to the sum of x and its conjugate, except for polymods where it is the trace as an algebraic number.

For x a square matrix, it is the ordinary trace. If x is a non square matrix (but not a vector), an error occurs.

The library syntax is $\teb$trace(x).

trans(x) or x$\tilde{{\ }}$: transpose of x. This has an effect only on vectors and matrices.

The library syntax is $\teb$gtrans(x).