Update aplK.py

This commit is contained in:
calquezar 2024-08-21 23:36:26 +02:00
parent d75b8e9d03
commit e35d7b4b57

12
aplK.py
View File

@ -83,7 +83,7 @@ class AplN(DifferentialGCAlgebra_multigraded, UniqueRepresentation):
#return value*factorial(self.n)*prod(self.gens()[self.n+2:])
gens = self.gens()
tExp = [randint(0,3) for i in range(self.n+1)]
tExp = [0*randint(0,3) for i in range(self.n+1)]
yExp = [0]+[1]*self.n
exp = tuple(tExp + yExp)
#print(value, " - ", exp, flush=True)
@ -138,6 +138,8 @@ class AplN(DifferentialGCAlgebra_multigraded, UniqueRepresentation):
N = len(self.gens())//2
ygens = self.gens()[N+1:] #N+1 because we remove y0 generator
listProds = [prod(s) for s in self.findsubsets(self, ygens,ydegree)]
listCoefs = [tuple(2*N*[0])]
if tdegree>1:
V = VectorSpace(GF(tdegree),N-1)
listCoefs = [tuple([0]+list(v)+N*[0]) for v in V]
listPolinomials = [self.get_term(self, 1, c, self.gens()) for c in listCoefs]
@ -585,14 +587,14 @@ class SimplicialAplN(AplN, UniqueRepresentation):
basis += apl.get_primitive_basis_of_a_monomial(apl,monomial)
basis = list(set(basis))
#basis += p._add_kernel_terms_to_primitive_basis(basis)
t_degree = 2
y_degree = self.parent().n #p.total_degree()#p.degree()[0]
t_degree = 0
y_degree = self.total_degree() #self.parent().n #p.total_degree()#p.degree()[0]
basis += apl.add_kernel_terms_to_primitive_basis(apl,t_degree, y_degree-1)
basis = list(set(basis))
terms = []
apl = self.parent()
for b in basis:
dim = len(b)//2 - 1
#dim = len(b)//2 - 1
terms.append(apl.get_term(apl,1, b, apl.gens()))
terms.sort(reverse=False)
return terms
@ -1166,7 +1168,6 @@ class AlgebraAplK(UniqueRepresentation, Parent):
def _face_basis(self, basis, face_idx):
face_basis = []
for b in basis:
face_pol = b.face(face_idx).reduce()
apl = face_pol.parent()
@ -1199,6 +1200,7 @@ class AlgebraAplK(UniqueRepresentation, Parent):
primitive_basis[simplex.tuple()] += pol._get_primitive_basis()
primitive_basis[simplex.tuple()] = list(set(primitive_basis[simplex.tuple()]))
primitive_basis[simplex.tuple()].sort(reverse=False)
print(primitive_basis[simplex.tuple()], flush=True)
# propagate the primitive basis through its faces
for f in range(n+1):
simplex_face = S.face(simplex, f).tuple()