Abstract base class for modules

Abstract base class for modules

class sage.modules.module.Module

Bases: sage.structure.parent.Parent

Generic module class.

EXAMPLES:

   sage: from sage.modules.module import Module
   sage: M = Module(ZZ)
   sage: M.category()
   Category of modules over Integer Ring
   sage: M.category().required_methods()
   {'parent': {'required': ['__contains__'], 'optional': []}, 'element': {'required': ['__nonzero__'], 'optional': ['_add_']}}
   sage: M_QQ = Module(QQ)
   sage: M_QQ.category()
   Category of vector spaces over Rational Field

TESTS:

We check for #8119::

   sage: M = ZZ^3
   sage: h = M.__hash__()
   sage: M.rename('toto')
   sage: h == M.__hash__()
   True
endomorphism_ring()

Return the endomorphism ring of this module in its category.

EXAMPLES:

sage: from sage.modules.module import Module
sage: M = Module(ZZ); M
<type 'sage.modules.module.Module'>
sage: M.endomorphism_ring()
Set of Morphisms from <type 'sage.modules.module.Module'> to
<type 'sage.modules.module.Module'> in Category of
modules over Integer Ring
class sage.modules.module.Module_old

Bases: sage.structure.parent_gens.ParentWithAdditiveAbelianGens

Generic module class.

category()

Return the category to which this module belongs.

endomorphism_ring()

Return the endomorphism ring of this module in its category.

sage.modules.module.is_Module(x)

Return True if x is a module.

INPUT:

  • x – anything.

OUTPUT:

Boolean.

EXAMPLES:

sage: from sage.modules.module import is_Module
sage: M = FreeModule(RationalField(),30)
sage: is_Module(M)
True
sage: is_Module(10)
False
sage.modules.module.is_VectorSpace(x)

Return True if x is a vector space.

INPUT:

  • x – anything.

OUTPUT:

Boolean.

EXAMPLES:

sage: from sage.modules.module import is_Module, is_VectorSpace
sage: M = FreeModule(RationalField(),30)
sage: is_VectorSpace(M)
True
sage: M = FreeModule(IntegerRing(),30)
sage: is_Module(M)
True
sage: is_VectorSpace(M)
False

Previous topic

Modules

Next topic

Free modules

This Page