32 Vectors

A important concept in algebra is the vector space over a field F. A vector space V is a set of vectors, for which an addition u + v and a multiplication by scalars, i.e., elements from F, s v must be defined. A base of V is a list of vectors, such that every vector in V can be uniquely written as linear combination of the base vectors. If the base if finite, its size is called the dimension of V. Using a base it can be shown that V is isomorphic to the set n-tuples of elements with the componentwise addition and multiplication.

This comment suggests the representation that is actually used in GAP. A GAP vector is a list without holes whose elements all come from a common field. We call the length of the list the dimension of the vector. This is a little bit lax, because the dimension is a property of the vector space, not of the vector, but should seldom cause confusion.

The first possibility for this field are the rationals (see Rationals). We call a list without holes whose elements are all rationals a rational vector, which is a bit lax too, but should again cause no confusion. For example [ 1/2, 0, -1/3, 2 ] is a rational vector of dimension 4.

The second possibility are cyclotomics (see Cyclotomics). Note that the rationals are the prime field of cyclotomic fields and therefore rational vectors are just a special case of cyclotomic vectors. An example of a cyclotomic vector is [ E(3)+E(3)^2, 1, E(15) ].

Third the common field may be a finite field (see Finite Fields). Note that it is not enough that all elements are finite field elements of the same characteristic, the common finite field containing all elements must be representable in GAP, i.e., must have at most 2^{16} elements. An example of such a vector over the finite field GF(3^4) with 81 elements is [ Z(3^4)^3, Z(3^2)^5, Z(3^4)^11 ].

Finally a list all of whose elements are records is also considered a vector. In that case the records should all have an operations record with the necessary functions +, -, *, ^. This allows for vectors over library and/or user defined fields (or rings) such as a polynomial ring (see Polynomials).

The first section in this chapter describes the operations applicable to vectors (see Operations for Vectors).

The next section describes the function that tests if an object is a vector (see IsVector).

The next section describes the function that returns a canonical multiple of a vector (see NormedVector).

The last section tells you more about the internal representation of vectors (see More about Vectors).

Because vectors are just a special case of lists, all the operations and functions for lists are applicable to vectors also (see chapter Lists). List Elements), changing elements of a vector (see List Assignment), and comparing vectors (see Comparisons of Lists).

Vectorspaces are a special category of domains and are described by vectorspace records (see chapter Vector Spaces).

Vectors play an important role for matrices (see chapter Matrices), which are implemented as lists of vectors.

Subsections

  1. Operations for Vectors
  2. IsVector
  3. NormedVector
  4. More about Vectors
Previous Up Next
Index

GAP 3.4.4
April 1997