Just as in mathematics, a vector in GAP is any object which supports appropriate addition and scalar multiplication operations (see Vector Spaces). As in mathematics, an especially important class of vectors are those represented by a list of coefficients with respect to some basis. These correspond roughly to the GAP concept of row vectors.
IsRowVector( obj ) C
A row vector is a vector (see IsVector) that is also a homogeneous list. Typical examples are lists of integers, lists of finite field elements of the same characteristic, lists of polynomials from a common polynomial ring, and matrices.
The additive operations of the vector must thus be compatible with that for lists, implying that the list entries are the coefficients of the vector with respect to some basis.
Note that not all row vectors admit a scalar product via *;
for example, matrices are row vectors but the matrix product is defined
in a different way.
For the installation of a scalar product of row vectors, the entries of
the vector must be ring elements; note that the default method expects
the row vectors to lie in IsRingElementList, and this category may not
be implied by IsRingElement for all entries of the row vector
(see the comment for IsVector in IsVector).
Note that methods for special types of row vectors really must be
installed with the requirement IsRowVector,
since IsVector may lead to a rank of the method below
that of the default method for row vectors (see file vecmat.gi).
gap> IsRowVector([1,2,3]); true
Because row vectors are just a special case of lists, all operations and functions for lists are applicable to row vectors as well (see chapter Lists). This especially includes accessing elements of a row vector (see List Elements), changing elements of a mutable row vector (see List Assignment), and comparing row vectors (see Comparisons of Lists).
Note that, unless your algorithms specifically require you to be able to change entries of your vectors, it is generally better and faster to work with immutable row vectors. See section Mutability and Copyability for more details.
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual