Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit eeba29a

Browse files
author
Matthias Koeppe
committed
src/sage/tensor/modules/free_module_basis.py: Add documentation
1 parent d15bd7d commit eeba29a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/sage/tensor/modules/free_module_basis.py

+30
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,36 @@
3939
class Basis_abstract(UniqueRepresentation, AbstractFamily):
4040
"""
4141
Abstract base class for (dual) bases of free modules.
42+
43+
A basis is an :class:`~sage.sets.family.AbstractFamily`, hence like
44+
:class:`collections.abc.Mapping` subclasses such as :class:`dict`, it is
45+
an associative :class:`Container`, providing methods :meth:`keys`,
46+
:meth:`values`, and :meth:`items`. Thus, ``e[i]`` returns the element
47+
of the basis ``e`` indexed by the key ``i``. However, in contrast to
48+
:class:`Mapping` subclasses, not the :meth:`keys` but the
49+
:meth:`values` are considered the elements.
50+
51+
EXAMPLES:
52+
53+
sage: M = FiniteRankFreeModule(ZZ, 3, name='M', start_index=1)
54+
sage: e = M.basis('e'); e
55+
Basis (e_1,e_2,e_3) on the Rank-3 free module M over the Integer Ring
56+
sage: list(e)
57+
[Element e_1 of the Rank-3 free module M over the Integer Ring,
58+
Element e_2 of the Rank-3 free module M over the Integer Ring,
59+
Element e_3 of the Rank-3 free module M over the Integer Ring]
60+
sage: e.category()
61+
Category of facade finite enumerated sets
62+
sage: list(e.keys())
63+
[1, 2, 3]
64+
sage: list(e.values())
65+
[Element e_1 of the Rank-3 free module M over the Integer Ring,
66+
Element e_2 of the Rank-3 free module M over the Integer Ring,
67+
Element e_3 of the Rank-3 free module M over the Integer Ring]
68+
sage: list(e.items())
69+
[(1, Element e_1 of the Rank-3 free module M over the Integer Ring),
70+
(2, Element e_2 of the Rank-3 free module M over the Integer Ring),
71+
(3, Element e_3 of the Rank-3 free module M over the Integer Ring)]
4272
"""
4373
def __init__(self, fmodule, symbol, latex_symbol, indices, latex_indices):
4474
"""

0 commit comments

Comments
 (0)