Given a field K and a positive integer n, create the n-dimensional vector space V = K^((n)), consisting of all n-tuples over K. The vector space is created with respect to the standard basis, e_1, ..., e_n, where e_i (i = 1, ..., n) is the vector containing a 1 in the i-th position and zeros elsewhere.Use of the functions VectorSpace and KSpace ensures that subspaces of V will be presented in embedded form.
Given a field K and a positive integer n, create the n-dimensional vector space V = K^((n)), consisting of all n-tuples over K. The vector space is created with respect to the standard basis, e_1, ..., e_n, where e_i (i = 1, ..., n) is the vector containing a 1 in the i-th position and zeros elsewhere.Use of the function KModule ensures that subspaces of V will be presented in reduced form. In all other respects, a vector space created by this function is identical to one created by KSpace.
Given a field K and integers m and n greater than one, create the vector space K^((m x n)), consisting of all m x n matrices over K. The vector space is created with the standard basis, {E_(ij) | i = 1 ..., m, j = 1 ..., n}, where E_(ij) is the matrix having a 1 in the (i, j)-th position and zeros elsewhere.Note that for a matrix space, subspaces will always be presented in embedded form, i.e. there is no reduced mode available for matrix spaces.
If V is the vector space K^((m)) and W is the vector space K^((n)), create the matrix space Hom_(K)(V, W) as the vector space K^((m x n)), represented as the set of all m x n matrices over K. The vector space is created with the standard basis, {E_(ij) | i = 1 ..., m, j = 1 ..., n}, where E_(ij) is the matrix having a 1 in the (i, j)-th position and zeros elsewhere.
> Q := RationalField(); > V := VectorSpace(Q, 6); > V; Vector space of dimension 6 over Rational Field
> K<w> := QuadraticField(5); > V := KMatrixSpace(K, 3, 5); > V; Full Vector Space of 3 by 5 matrices over Quadratic Field Q(w)
(1) Suppose V is a subspace of the vector space K^((n)). Given elements a_1, ..., a_n belonging to K, construct the vector v = (a_1, ..., a_n) as a vector of V. Note that if v is not an element of V, an error will result.(2) Suppose V is a subspace of the matrix space K^((m x n)). Given elements a_1, ..., a_(mn) belonging to K, construct the matrix m = (a_1, ..., a_(mn)) as an element of V. Note that if m is not an element of V, an error will result.
(1) Suppose V is a subspace of the vector space K^((n)). Given elements a_1, ..., a_n belonging to K, construct the vector v = (a_1, ..., a_n) as a vector of V. Note that if v is not an element of V, an error will result.
(2) Suppose V is a subspace of the matrix space K^((m x n)). Given elements a_1, ..., a_(mn) belonging to K, construct the matrix m = (a_1, ..., a_(mn)) as an element of V. Note that if m is not an element of V, an error will result.
Given a subspace V of the vector space K^((n)) together with a set S of integers lying in the interval [1, n], return the characteristic number of S as a vector of V.
The zero element for the vector space V.
Given a vector space V defined over a finite field, return a random vector.
> K<w> := GaloisField(4); > V := VectorSpace(K, 5); > u := V ! [1, w, 1+w, 0, 0]; > u; (1 w w + 1 0 0) > zero := V ! 0; > zero; (0 0 0 0 0) r := Random(V); (1 0 w 1 w + 1)
> R<x> := PolynomialRing(RationalField()); > L<w> := NumberField(x^7 - 7*x + 3); > L34 := KMatrixSpace(L, 3, 4); > a := L34 ! [ 1, w, 0, -w, 0, 1+w, 2, -w^3, w-w^3, 2*w, 1/3, 1 ]; > a; [1 w 0 -1 * w] [0 w + 1 2 -1 * w^3] [-1 * w^3 + w 2 * w 1/3 1]
Given an element u belonging to the K-vector space V, return u in the form of a sequence Q of elements of V. Thus, if u is an element of K^((n)), then Q[i] = u[i], 1 <= i <= n.
For the following operations the vectors u and v must belong to
the same vector space i.e. the same tuple space K^((n)) or the
same matrix space K^((m x n)). The scalar a must belong to
the field K.
u + v : ModTupFldElt, ModTupFldElt -> ModTupFldElt
Sum of the vectors u and v, where u and v lie in the same vector space.
Additive inverse of the vector u.
Difference of the vectors u and v, where u and v lie in the same vector space.
The scalar product of the vector u belonging to the K-vector space and the field element x belonging to K.
The scalar product of the vector u belonging to the K-vector space and the field element 1/x belonging to K where x is non-zero.
The number of columns in the vector u.
The index of the first non-zero entry of the vector u (0 if none such).
Inner product of the vectors u and v with respect to the inner product defined on the space.
True iff the vector u belonging to a vector space is the zero element.
Given an element u, not the zero element, belonging to the K-vector space V, return (1/a) * u, where a is the first non-zero component of u. If u is the zero vector, it is returned as the value of this function. The net effect is that Normalize(u) always returns a vector v in the subspace generated by u, such that the first non-zero component of v is the unit of K.
Given a vector u, return the vector obtained from u by rotating by k coordinate positions.
Given a vector u, destructively rotate u by k coordinate positions.
The number of rows in the vector u (1 of course; included for completeness).
A set of integers giving the positions of the non-zero components of the vector u.
The tensor (Kronecker) product of the vectors u and v. The resulting vector has degree equal to the product of the degrees of u and v.
Given a vector belonging to the space K^((n)), and a subfield F of K, return the vector obtained by replacing each component of u by its trace over the subfield F. If F is the prime field of K, it may be omitted.
The number of non-zero components of the vector u.
> K<w> := CyclotomicField(8); > V := VectorSpace(K, 4); > x := V ! [ w, w^ 2, w^ 4, 0]; > y := V ! [1, w, w^ 2, w^ 4]; > x + y; ((1 + w) (w + w^2) (-1 + w^2) -1) > -x; ((-w) (-w^2) 1 0) > x - y; ((-1 + w) (-w + w^2) (-1 - w^2) 1) > w * x; ( (w^2) (w^3) (-w) 0) > y * w^ -4; ( -1 (-w) (-w^2) 1) > Normalize(x); ( 1 (w) (w^3) 0) > InnerProduct(x, y); (w - w^2 + w^3) > z := V ! [1, 0, w, 0 ]; > z; ( 1 0 (w) 0) > Support(z); { 1, 3 }
The indexing operations have a different meaning depending upon whether
they are applied to a tuple space or a matrix space.
u[i] : ModTupFldElt, RngIntElt -> RngElt
Given an vector u belonging to a K-vector space V, the result of this operation depends upon whether V is a tuple or matrix space.If V is a subspace of K^((n)), and i, 1 <= i <= n, is a positive integer, the i-th component of the vector u is returned (as an element of the field K).
If V is a subspace of K^((m x n)), and i, 1 <= i <= m, is a positive integer, u[i] will return the i-th row of the matrix u (as an element of the vector space K^((n))). Similarly, if i and j, 1 <= i <= m, 1 <= j <= n, are positive integers, u[i, j] will return the (i, j)-th component of the matrix u (as an element of K).
Given an vector u belonging to a K-vector space V, and an element x of K, the result of this operation depends upon whether V is a tuple or matrix space.If V is a subspace of K^((n)), and i, 1 <= i <= n, is a positive integer, the i-th component of the vector u is redefined to be x.
If V is a subspace of K^((m x n)) and 1 <= i <= m is a positive integer and x is an element of K^((n)), u[i] := x will redefine the i-th row of the matrix u to be the vector x, where x must be an element of K^((n)). Similarly, if 1 <= i <= m, 1 <= j <= n, are positive integers, u[i, j] := x will redefine the (i, j)-th component of the matrix u to be x, where x must be an element of K^((n)).
> K<w> := CyclotomicField(8); > V := VectorSpace(K, 3); > u := V ! [ 1 + w, w^ 2, w^ 4]; > u; ((1 + w) (w^2) -1) > u[3]; -1 > u[3] := 1 + w - w^7; > u; ((1 + w) (w^2) (1 + w + w^3)) > // We now demonstrate indexing a matrix space > W := KMatrixSpace(K, 2, 3); > l := W ! [ 1 - w, 1 + w, 1 + w + w^2, 0, 1 - w^7, 1 - w^3 + w^6 ]; > l; [(1 - w) (1 + w) (1 + w + w^2)] [0 (1 + w^3) (1 - w^2 - w^3)] > l[2]; (0 (1 + w^3) (1 - w^2 - w^3)) > l[2,2]; (1 + w^3) > m := l[2]; > m; (0 (1 + w^3) (1 - w^2 - w^3)) > l[2] := u; > l; [(1 - w) (1 + w) (1 + w + w^2)] [(1 + w) (w^2) -1] > l[2, 3] := 1 + w - w^7; > l; [(1 - w) (1 + w) (1 + w + w^2)] [(1 + w) (w^2) (1 + w + w^3)]