# source:sage/algebras/algebra_ideal.py@0:039f6310c6fe

Revision 0:039f6310c6fe, 2.9 KB checked in by tornaria@…, 7 years ago (diff)

[project @ original sage-0.10.12]

Line
1"""
2Algebra left, right, and two-sided ideals
3
4AUTHOR: David Kohel, 2005-09
5"""
6
7#*****************************************************************************
8#  Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu>
9#
11#
12#    This code is distributed in the hope that it will be useful,
13#    but WITHOUT ANY WARRANTY; without even the implied warranty
14#    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15#
16#  See the GNU General Public License for more details; the full text
17#  is available at:
18#
20#*****************************************************************************
21
22from sage.algebras.algebra import Algebra
23
24class AlgebraIdeal(object):
25    """
26    Generic left, right, and two-sided algebra ideals.
27    """
28    def __init__(self, A, gens = []):
29        if not isinstance(A, Algebra): raise TypeError, "Argument A must be an algebra."
30        self.__algebra = A
31        self.__gens = gens
32
33    def __repr__(self):
34        NotImplementedError
35
36    def __call__(self, x):
37        raise NotImplementedError
38
39    def __contains__(self, x):
40        raise NotImplementedError
41
42    def base_ring(self):
43        return self.__algebra.base_ring()
44
45    def gen(self,i):
46        if i < 0 or not i < ngens(self):
47            raise IndexError, \
48                  "Argument i (= %s) must be between 0 and %s."%(i, ngens(self)-1)
49        return self.__gens[i]
50
51    def ngens(self):
52        return len(self.__gens)
53
54class AlgebraLeftIdeal(AlgebraIdeal):
55    """
56    A left ideal in an algebra.
57    """
58    def __init__(self, A, gens = []):
59        AlgebraIdeal.__init__(self, A, gens)
60
61    def __repr__(self):
62        return "Left ideal on generators %s over %s"%(
63            self.gens(), self.algebra())
64
65    def left_algebra(self):
66        return self.algebra()
67
68class AlgebraRightIdeal(AlgebraIdeal):
69    """
70    A right ideal in an algebra.
71    """
72    def __init__(self, A, gens = []):
73        AlgebraIdeal.__init__(self, A, gens)
74
75    def __repr__(self):
76        return "Right ideal on generators %s over %s"%(
77            self.gens(), self.algebra())
78
79    def right_algebra(self):
80        return self.algebra()
81
82class AlgebraTwoSidedIdeal(AlgebraIdeal):
83    """
84    A two-sided ideal in an algebra, such that the left and right orders coincide.
85    """
86    def __init__(self, A, gens = []):
87        AlgebraIdeal.__init__(self, A, gens)
88
89    def __repr__(self):
90        return "Two-sided ideal on generators %s over %s"%(
91            self.gens(), self.algebra())
92
93    def __call__(self, x):
94        raise NotImplementedError
95
96    def __contains__(self, x):
97        raise NotImplementedError
98
99    def right_algebra(self):
100        return self.algebra()
101
102    def left_algebra(self):
103        return self.algebra()
Note: See TracBrowser for help on using the repository browser.