Opened 4 years ago

Last modified 4 years ago

#24809 new enhancement

Speed up lattice precision p-adics

Reported by: saraedum Owned by:
Priority: major Milestone: sage-8.2
Component: padics Keywords: lattice precision
Cc: roed, caruso, TristanVaccon Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #23505 Stopgaps:

Status badges


  • Drop labels keyword in parents & make parents more unique
  • Switch to templates for elements
  • Switch to cython for precision lattice
  • Specialized data structure for matrix
  • Make pickling and conversion more robust (pickling should dump the full lattice matrix and unpickling restores the matrix but puts it next to the existing matrix)
  • Share precision lattice between all parents with the same p.

Change History (2)

comment:1 Changed 4 years ago by caruso

About pickling/unpickling, I propose the following interface:

  • (usual syntax) if x is a p-adic, dumps(x) saves x as approx + O(p^prec) but diffused digits implying x are not saved
  • if R is a parent (and/or a precision lattice maybe), R.dumps_elements(x,y,z,...) saves the approximation of all listed elements together with a lattice representing the precision on this set of elements
  • loads(obj) loads the stored variables in obj (they can be many of them if obj was constructed by dumps_elements) as new independant variables.

How does it sound?

comment:2 Changed 4 years ago by saraedum

I am not sure how dumps_elements would integrate with the usual pickling workflow, say when pickling something like a matrix.

I think a simpler interface is not harder implement and makes things less surprising:

  • Whenever we pickle an element we pickle its entire precision lattice. So, if we happen to pickle many elements at the same time, say a polynomial, we pickle their lattice (once.)
  • Restoring elements just appends the pickled lattice to the existing lattice and does a "drop unused columns".

While this is not a very space-efficient format (but I guess we don't care) it gives us both behaviours you describe above automatically, doesn't it?

Note: See TracTickets for help on using tickets.