I wanted to know what procedure does SAGE use for computing class numbers. I typed
sage : K = NumberField(x^2 + x + 1)
sage : K.class_number?
After that I got the documentation and further I opened this file ~/SageMath/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py
In that I looked for the place where I can find the class number snippet. It turns out that sage returns the order of class group, so I looked for class group snippet.
proof = proof_flag(proof)
try:
return self.__class_group[proof, names]
except KeyError:
pass
except AttributeError:
self.__class_group = {}
k = self.pari_bnf(proof)
cycle_structure = tuple( ZZ(c) for c in k.bnf_get_cyc() )
# Gens is a list of ideals (the generators)
gens = tuple( self.ideal(hnf) for hnf in k.bnf_get_gen() )
G = ClassGroup(cycle_structure, names, self, gens, proof=proof)
self.__class_group[proof, names] = G
return G
But I couldn't understand where is the implementation of algorithm. Can anyone help me from here to reach where I can get the algorithm?