# Calculating Ray class Numbers in sagemath?

I got the code of this class from here https://ask.sagemath.org/question/9127/computing-the-order-of-an-ideal-in-a-ray-class-group/ , problem is it gives the error NameError: name 'AbelianGroup_class' is not defined, any help would be highly appreciated.

class RayClassGroup(AbelianGroup_class ):
def __init__(self, number_field, mod_ideal = 1, mod_archimedean = None):
if mod_archimedean == None:
mod_archimedean =  * len(number_field.real_places())

bnf = gp(number_field.pari_bnf())
# Use PARI to compute ray class group
bnr = bnf.bnrinit([mod_ideal, mod_archimedean],1)
invariants = bnr         # bnr.clgp.cyc
invariants = [ ZZ(x) for x in invariants ]

AbelianGroup_class.__init__(self, len(invariants), invariants)
self.__number_field = number_field
self.__bnr = bnr

def __call__(self, *args, **kwargs):
return group.Group.__call__(self, *args, **kwargs)

def _element_constructor_(self, *args, **kwargs):
if isinstance(args, AbelianGroupElement):
return AbelianGroupElement(self, args)
else:
I = self.__number_field.ideal(*args, **kwargs)

# Use PARI to compute class of given ideal
g = self.__bnr.bnrisprincipal(I)
g = [ ZZ(x) for x in g ]
return AbelianGroupElement(self, g)
$$$$

• Welcome to MSE. That question is off-topic here. May 29 at 2:14
• where should I post it @JoséCarlosSantos May 29 at 2:16
• I suppose that here. May 29 at 2:20
• Perhaps try from sage.groups.group import AbelianGroup as AbelianGroup_class`. May 29 at 13:15
• Asked again as Ask Sage question 57338: Computing Ray class numbers? May 29 at 14:02