def _interpolate_multivariate(evalpoints, hpeval, ring, i, p, ground=False):
 hp = ring.zero
 if ground:
  domain = ring.domain.domain
  y = ring.domain.gens[i]
 else:
  domain = ring.domain
  y = ring.gens[i]
 for (a, hpa) in zip(evalpoints, hpeval):
  numer = ring.one
  denom = domain.one
  for b in evalpoints:
   if (b == a):
    continue
   numer *= (y - b)
   denom *= (a - b)
  denom = domain.invert(denom, p)
  coeff = numer.mul_ground(denom)
  hp += (hpa.set_ring(ring) * coeff)
 return hp.trunc_ground(p)

def _interpolate_multivariate ( evalpoints , hpeval , ring , i , p , ground = False ) : hp = ring . zero if ground : domain = ring . domain . domain y = ring . domain . gens [ i ] else : domain = ring . domain y = ring . gens [ i ] for ( a , hpa ) in zip ( evalpoints , hpeval ) : numer = ring . one denom = domain . one for b in evalpoints : if ( b == a ) : continue numer *= ( y - b ) denom *= ( a - b ) denom = domain . invert ( denom , p ) coeff = numer . mul_ground ( denom ) hp += ( hpa . set_ring ( ring ) * coeff ) return hp . trunc_ground ( p )
reconstruct a polynomial h_p in mathbb{z}_p[x_0 .