Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
| CARVIEW |
Function Repository Resource:
Compute a reduced basis for a set of vectors, along with a unimodular matrix that converts from the vectors to the reduced basis
ResourceFunction["ExtendedLatticeReduce"][lat] computes a reduced basis ℬ for the lattice of integer vectors lat, returning the pair {𝒰,ℬ}, where 𝒰 is a unimodular conversion matrix satisfying 𝒰.lat=ℬ. |
Create an integer lattice comprised of two columns of large integers augmented on the right by an identity matrix:
| In[1]:= |
|
| Out[1]= |
|
Reduce the lattice:
| In[2]:= |
|
| Out[2]= |
|
Check the conversion matrix equation:
| In[3]:= |
|
| Out[3]= |
|
Check that the conversion matrix is unimodular:
| In[4]:= |
|
| Out[4]= |
|
Check that LatticeReduce gives the same reduced lattice (this is not strictly necessary):
| In[5]:= |
|
| Out[5]= |
|
Create a rational lattice:
| In[6]:= |
|
| Out[6]= |
|
Compute a reduction of the lattice along with the corresponding unimodular conversion matrix::
| In[7]:= |
|
| Out[7]= |
|
Reduce a lattice of Gaussian integers with larger entries in the leftmost two columns:
| In[8]:= |
|
| Out[8]= |
|
Check the result:
| In[9]:= |
|
| Out[9]= |
|
Create a large matrix with big integers in the first two columns and an identity matrix on the right:
First compute the default reduction:
| In[10]:= |
|
| Out[10]= |
|
Check the conversion matrix criteria:
| In[11]:= |
|
| Out[11]= |
|
Computing a reduction of higher quality typically takes longer:
| In[12]:= |
|
| Out[12]= |
|
Using a smaller reduction size ratio setting typically gives a faster computation:
| In[13]:= |
|
| Out[13]= |
|
The higher quality reduction manifests by most rows in the “stronger” result having norms smaller than for corresponding rows in the default reduction:
| In[14]:= |
|
| Out[14]= |
|
The lower quality reduction manifests by most rows in the “weaker” result having norms larger than for corresponding rows in the default reduction:
| In[15]:= |
|
| Out[15]= |
|
A different implementation of this functionality, written by Wilberd van der Kallen, is available at the Wolfram Library Archive link provided.
Version 2 uses a "sometimes asymptotically fast" divide-and-conquer algorithm similar to that used in the half-GCD algorithm for integer GCD computations. This is done whenever the input lattice consists of integers or Gaussian integers and has full row rank. A more rigorous version is informally referred to as L1Plus. The theory behind it is in the links. This implementation qualities as "quick and dirty" and does not come with any guarantee about asymptotic speed other than it promises to try hard and do the best it can.
This work is licensed under a Creative Commons Attribution 4.0 International License