# Vector Spaces¶

class sage.categories.vector_spaces.VectorSpaces(K)

The category of (abstract) vector spaces over a given field

??? with an embedding in an ambient vector space ???

EXAMPLES:

```sage: VectorSpaces(QQ)
Category of vector spaces over Rational Field
sage: VectorSpaces(QQ).super_categories()
[Category of modules over Rational Field]
```
class CartesianProducts(category, *args)
extra_super_categories()

The category of vector spaces is closed under Cartesian products:

```sage: C = VectorSpaces(QQ)
sage: C.CartesianProducts()
Category of Cartesian products of vector spaces over Rational Field
sage: C in C.CartesianProducts().super_categories()
True
```
class DualObjects(category, *args)
extra_super_categories()

Returns the dual category

EXAMPLES:

The category of algebras over the Rational Field is dual to the category of coalgebras over the same field:

```sage: C = VectorSpaces(QQ)
sage: C.dual()
Category of duals of vector spaces over Rational Field
sage: C.dual().super_categories() # indirect doctest
[Category of vector spaces over Rational Field]
```
class ElementMethods

Bases: `object`

class Filtered(base_category)

Category of filtered vector spaces.

class FiniteDimensional(base_category)
class TensorProducts(category, *args)
extra_super_categories()

Implement the fact that a (finite) tensor product of finite dimensional vector spaces is a finite dimensional vector space.

EXAMPLES:

```sage: VectorSpaces(QQ).FiniteDimensional().TensorProducts().extra_super_categories()
[Category of finite dimensional vector spaces over Rational Field]
sage: VectorSpaces(QQ).FiniteDimensional().TensorProducts().FiniteDimensional()
Category of tensor products of finite dimensional vector spaces over Rational Field
```

class ParentMethods

Bases: `object`

dimension()

Return the dimension of this vector space.

EXAMPLES:

```sage: M = FreeModule(FiniteField(19), 100)
sage: W = M.submodule([M.gen(50)])
sage: W.dimension()
1

sage: M = FiniteRankFreeModule(QQ, 3)
sage: M.dimension()
3
sage: M.tensor_module(1,2).dimension()
27
```
class TensorProducts(category, *args)
extra_super_categories()

The category of vector spaces is closed under tensor products:

```sage: C = VectorSpaces(QQ)
sage: C.TensorProducts()
Category of tensor products of vector spaces over Rational Field
sage: C in C.TensorProducts().super_categories()
True
```
class WithBasis(base_category)
class CartesianProducts(category, *args)
extra_super_categories()

The category of vector spaces with basis is closed under Cartesian products:

```sage: C = VectorSpaces(QQ).WithBasis()
sage: C.CartesianProducts()
Category of Cartesian products of vector spaces with basis over Rational Field
sage: C in C.CartesianProducts().super_categories()
True
```
class Filtered(base_category)

Category of filtered vector spaces with basis.

example(base_ring=None)

Return an example of a graded vector space with basis, as per `Category.example()`.

EXAMPLES:

```sage: Modules(QQ).WithBasis().Graded().example()
An example of a graded module with basis:
the free module on partitions over Rational Field
```
class FiniteDimensional(base_category)
class TensorProducts(category, *args)
extra_super_categories()

Implement the fact that a (finite) tensor product of finite dimensional vector spaces is a finite dimensional vector space.

EXAMPLES:

```sage: VectorSpaces(QQ).WithBasis().FiniteDimensional().TensorProducts().extra_super_categories()
[Category of finite dimensional vector spaces with basis over Rational Field]
sage: VectorSpaces(QQ).WithBasis().FiniteDimensional().TensorProducts().FiniteDimensional()
Category of tensor products of finite dimensional vector spaces with basis over Rational Field
```

Category of graded vector spaces with basis.

example(base_ring=None)

Return an example of a graded vector space with basis, as per `Category.example()`.

EXAMPLES:

```sage: Modules(QQ).WithBasis().Graded().example()
An example of a graded module with basis:
the free module on partitions over Rational Field
```
class TensorProducts(category, *args)
extra_super_categories()

The category of vector spaces with basis is closed under tensor products:

```sage: C = VectorSpaces(QQ).WithBasis()
sage: C.TensorProducts()
Category of tensor products of vector spaces with basis over Rational Field
sage: C in C.TensorProducts().super_categories()
True
```
is_abelian()

Return whether this category is abelian.

This is always `True` since the base ring is a field.

EXAMPLES:

```sage: VectorSpaces(QQ).WithBasis().is_abelian()
True
```

Return `None`.

Indeed, the category of vector spaces defines no additional structure: a bimodule morphism between two vector spaces is a vector space morphism.

Todo

Should this category be a `CategoryWithAxiom`?

EXAMPLES:

```sage: VectorSpaces(QQ).additional_structure()
```
base_field()

Returns the base field over which the vector spaces of this category are all defined.

EXAMPLES:

```sage: VectorSpaces(QQ).base_field()
Rational Field
```
super_categories()

EXAMPLES:

```sage: VectorSpaces(QQ).super_categories()
[Category of modules over Rational Field]
```