5.1.1.3 VectorSpace_generic Objects

class VectorSpace_generic
The VectorSpace_generic class derives from VectorSpace, and defines functionality for generic vector spaces over an arbitrary base field. (One never instantiates objects of this class.)
VectorSpace_generic( base_field, degree, [sparse=False])

Create the space of all vectors of given degree over base_field.

INPUT:
    base_field -- a field
    degree -- int >= 0, the degree of the vector space 
              (number of components of vectors).
    sparse -- whether or not matrices are given a sparse
representation 
              (default to False)

Instances of class VectorSpace_generic have the following functions (in addition to inherited functions and special functions):

ambient_space,$  $ base_field,$  $ base_ring,$  $ basis,$  $ change_ring,$  $ coordinate_vector,$  $ coordinates,$  $ degree,$  $ dimension,$  $ echelonized_basis,$  $ gen,$  $ intersection,$  $ is_ambient,$  $ is_dense,$  $ is_full,$  $ is_sparse,$  $ is_subspace,$  $ linear_combination_of_basis,$  $ matrix,$  $ ngens,$  $ random,$  $ random_element,$  $ subspace,$  $ subspace_with_basis,$  $ vector,$  $ vector_space,$  $ zero_subspace,$  $ zero_vector

Further documentation:

change_ring( R)

Change this vector space to be a vector space over R by coercing the basis vectors into R.

coordinate_vector( v)

Write v in terms of the user basis for self.

Returns a vector c such that if B is the basis for self, then sum c[i] B[i] = v If v is not in self, raises an ArithmeticError exception.

coordinates( v)

Write v in terms of the basis for self.

Returns a list c such that if B is the basis for self, then sum c[i] B[i] = v If v is not in self, raises an ArithmeticError exception.

intersection( other)

Return the intersection of self and other, which must be subspaces of a common ambient space.

sage: V  = VectorSpace(RationalField(),3)
sage: W1 = V.subspace([V.gen(0), V.gen(0) + V.gen(1)])
sage: W2 = V.subspace([V.gen(1), V.gen(2)])
sage: W1.intersection(W2)
Vector space of degree 3, dimension 1 over Rational Field
Basis matrix:
[0 1 0]
sage: W2.intersection(W1)
Vector space of degree 3, dimension 1 over Rational Field
Basis matrix:
[0 1 0]
sage: V.intersection(W1)
Vector space of degree 3, dimension 2 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]
sage: W1.intersection(V)
Vector space of degree 3, dimension 2 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]
sage: Z = V.subspace([])
sage: W1.intersection(Z)
Vector space of degree 3, dimension 0 over Rational Field
Basis matrix:
[]

is_subspace( other)

True if this vector space is a subspace of other.

sage: V = VectorSpace(RationalField(),3)
sage: W = V.subspace([V.gen(0), V.gen(0) + V.gen(1)])
sage: W2 = V.subspace([V.gen(1)])
sage: W.is_subspace(V)
True
sage: W2.is_subspace(V)
True
sage: W.is_subspace(W2)
False
sage: W2.is_subspace(W)
True

linear_combination_of_basis( v)

Return the linear combination of the basis for self obtained from the coordinates of v.

random( [X=True], [prob=1.0], [coerce=[-2, -1, 1, 2]])

Returns a random element of self.

random_element( [X=True], [prob=1.0], [coerce=[-2, -1, 1, 2]])

Returns a random element of self.

subspace( gens, [check=True])

Create a subspace of self.

INPUT:
    gens -- a list of vector in self
    check -- whether or not to verify that each vector is in
self
OUTPUT:
    VectorSpace -- the subspace spanned by the vectors in the
list gens.
    The basis for the subspace is always put in reduced row
echelon form.

sage: V = VectorSpace(RationalField(), 3)
sage: B = V.basis()
sage: W = V.subspace([B[0]+B[1], 2*B[1]-B[2]])
sage: W
Vector space of degree 3, dimension 2 over Rational Field
Basis matrix:
[   1    0  1/2]
[   0    1 -1/2]

subspace_with_basis( basis)

Create a subspace of self with given basis.

INPUT:
    basis -- a list of linearly independent vectors

OUTPUT:
    VectorSpace_subspace_with_basis -- the subspace with given
basis.
    The basis for the subspace is always put in reduced row
echelon form.

sage: V = VectorSpace(RationalField(), 3)
sage: B = V.basis()
sage: W = V.subspace_with_basis([B[0]+B[1], 2*B[1]-B[2]])
sage: W
Vector space of degree 3, dimension 2 over Rational Field
User basis matrix:
[ 1  1  0]
[ 0  2 -1]

Instances of class VectorSpace_generic also have the following special functions:

__add__,$  $ __call__,$  $ __cmp__,$  $ __contains__

See About this document... for information on suggesting changes.