research papers\(\def\hfill{\hskip 5em}\def\hfil{\hskip 3em}\def\eqno#1{\hfil {#1}}\)

Journal logoFOUNDATIONS
ADVANCES
ISSN: 2053-2733

A new method for lattice reduction using directional and hyperplanar shearing

crossmark logo

aLaboratory of Thermo Mechanical Metallurgy (LMTM), PX Group Chair, EPFL, Rue de la Maladière 71b, Neuchâtel, 2000, Switzerland
*Correspondence e-mail: [email protected]

Edited by L. Palatinus, Czech Academy of Sciences, Czech Republic (Received 26 January 2021; accepted 21 October 2021)

A geometric method of lattice reduction based on cycles of directional and hyperplanar shears is presented. The deviation from cubicity at each step of the reduction is evaluated by a parameter called `basis rhombicity' which is the sum of the absolute values of the elements of the metric tensor associated with the basis. The levels of reduction are quite similar to those obtained with the Lenstra–Lenstra–Lovász (LLL) algorithm, at least up to the moderate dimensions that have been tested (lower than 20). The method can be used to reduce unit cells attached to given hyperplanes.

1. Introduction

In a recent paper (Cayron, 2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]), we proposed a method to determine a unit cell attached to any hyperplane Mathematical equation. A hyperplane Mathematical equation is a plane of dimension Mathematical equation in a space of dimension N. Its Miller indices pi permit it to be built geometrically in the direct basis by considering its intersection points with the ith axes (in 1/pi). Equivalently the letter Mathematical equation represents the vector of coordinates pi in the reciprocal basis; this vector is normal to the hyperplane. The unit cell attached to the hyperplane Mathematical equation is made of one short vector Mathematical equation pointing to a node of the first layer parallel to the plane Mathematical equation, i.e. such that the scalar product Mathematical equation, and of Mathematical equation short vectors Mathematical equation lying in the plane Mathematical equation, i.e. such that the scalar product Mathematical equation, where `t' means `transpose'. The first vector is a solution of Bézout's identity, and the Mathematical equation vectors are solutions of the integer relation, both with the coordinates pi. Even if the vectors Mathematical equation determined by the algorithm are already quite short, they can be reduced even more, i.e. it is possible to find shorter vectors Mathematical equation defining a smaller and more orthogonal unit cell of the same volume associated with the same hyperplane Mathematical equation, i.e. fulfilling the same Bézout's identity and integer relation. Reducing the length of the vectors in a lattice is related to the general problem called `lattice reduction'.

Let us explain it in a general way. Given a lattice Mathematical equation spanned (freely) by N vectors Mathematical equation, lattice reduction consists of finding new relatively short, nearly orthogonal vectors Mathematical equation spanning the same lattice Mathematical equation. The reduced and initial bases are linked by integers zij such that Mathematical equation = Mathematical equation and Mathematical equation, where the {Mathematical equation} means all linear combinations with integer coefficients. The number of vectors cannot be larger than the space dimension. The coefficients zij form a unimodular matrix Mathematical equation (integer matrix of determinant ±1), and the relation between the vectors of the bases is

Mathematical equation

with Mathematical equation and Mathematical equation, where Mathematical equation and Mathematical equation refer to the vectors themselves, not to their coordinates. Strictly speaking, it is the basis whose vectors generate the lattice that is reduced at constant volume, and not the lattice itself since this remains the same. The most popular algorithm to determine a reduced basis is the Lenstra–Lenstra–Lovász (LLL) algorithm, which relies on Gram–Schmidt orthogonalization (Appendix A[link]). It is usual in lattice reduction problems to present the vectors Mathematical equation as the rows of a matrix. In crystallography, we generally write the coordinates in columns and keep the row notation for planes, i.e. for vectors of the reciprocal space. In order to avoid any confusion, we will write Mathematical equation for a row vector Mathematical equation. With this notation, in a space of dimension N, a vector Mathematical equation is an N×1 matrix, and Mathematical equation a N matrix. All the vectors in this paper are written in a Cartesian orthonormal basis and their coordinates are integers. The relation between the reduced and initial bases can be written in the form of a matrix product Mathematical equation, where

Mathematical equation

and

Mathematical equation

are matrices of Mathematical equation. A typical low-dimensional example of lattice reduction is the set of three vectors in three dimensions, Mathematical equation Mathematical equation and Mathematical equation. They form the matrix

Mathematical equation

The reduced lattice basis is

Mathematical equation

One can check that the three row vectors are Mathematical equation Mathematical equation, Mathematical equation Mathematical equation and Mathematical equation. The integer coefficients of linearity could be found by calculating Mathematical equation.

A direct lattice reduction algorithm, such as LLL, permits the lattice to be reduced but does not preserve the unit cell attached to a given hyperplane Mathematical equation. We are thus looking for an intermediate method such that the vector Mathematical equation continues to point towards a node of the first layer, and the other vectors Mathematical equation remain in the hyperplane Mathematical equation. An intuitive solution to reduce Mathematical equation consists of applying a simple shear parallel to the hyperplane Mathematical equation, as illustrated in Fig. 4 of Cayron (2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]). One could then think of applying the LLL algorithm to reduce the other vectors Mathematical equation lying in the hyperplane Mathematical equation, but it is also possible to reverse the problem and use the intermediate simple shear method to develop a simple geometric algorithm of lattice reduction. This method, which we call `cubification', is different from LLL because it does not require Gram–Schmidt orthogonalization. It is also well adapted to determine a reduced unit cell attached to a hyperplane Mathematical equation, as shown by Cayron (2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]). It consists of applying simple shears parallel to the directions and to the hyperplanes of the lattice. Here, the term `shear' should be understood in its general meaning: for a vector space Mathematical equation and a subspace Mathematical equation, a shear of a vector Mathematical equation fixing Mathematical equation translates Mathematical equation in a direction parallel to Mathematical equation. If Mathematical equation is the direct sum Mathematical equation Mathematical equation, we write Mathematical equation = w + w′, then the image of Mathematical equation by the shear S is Mathematical equation where M is a linear mapping from Mathematical equation onto Mathematical equation. Directional and hyperplanar shears correspond to the case where the dimensions of the subspaces Mathematical equation are 1 and Mathematical equation, respectively.

In general, a parameter called `orthogonality defect' is used to evaluate the degree of reduction. It is defined by P/V where P is the product of the norms of the basis vectors, Mathematical equation, and V is the volume of the cell formed by the vectors, Mathematical equation, which is an invariant of the reduction process. Another parameter to evaluate the norms could be Mathematical equation. In this paper, instead of using P/V, the degree of `cubicity' of a basis Mathematical equation will be evaluated by calculating the `basis rhombicity' defined from the Euclidean scalar products between the vectors:

Mathematical equation

where Mathematical equation is the metric tensor given

Mathematical equation

Mathematical equation

The `basis rhombicity' contains the information on both the norms and the angles between the vectors. A lowest `rhombicity' indicates a more cubic cell. Note that the term `rhombicity' has a specific meaning in a branch of mathematics that deals with symmetric second-rank tensors in three-dimensional Euclidean space, but that is not the one given in the present paper. The `basis rhombicity' R was preferred to the parameter P/V for two reasons:

(a) From a theoretical point of view, although it seems to be common knowledge, we realized that minimizing the norms of the vectors in high dimensions is not exactly equivalent to improving the orthogonality between them. The reader can look at the simple example in dimension 4 in Appendix B[link], which presents two bases of the same lattice, with the same norms S and P, but one with a better orthogonality, i.e. lower R, than the other one. We will also show in Section 4.3[link] an example in dimension 20 in which, for the same lattice, one reduced basis has a better orthogonality (lower R) but a worse norm (larger P and S) than another reduced basis.

(b) From a practical point of view, we noticed that the `cubification' method leads to lower norms in terms of P or S when R is used as driving criterion, and not P or S themselves.

Fig. 1[link](a) gives an example of lattice reduction with the LLL algorithm. The matrix representing the basis to be reduced is nearly the identity except that the last column containing the Nth coordinates of the vectors is constituted of relatively high integers. These types of matrices are often used because they appear in the `knapsack problems' (given a set of items, each with a weight and a value, one has to determine the number of each item to include in the knapsack so that the total weight should not exceed a limit and the value is maximized). Geometrically, the initial basis is highly elongated along the Nth axis. Its initial values are R = 453988268, S = 61580172. They decrease to R = 531, S = 99 with the LLL-reduced basis given in Fig. 1[link](b).

[Figure 1]
Figure 1
Example of the LLL algorithm with a 20×20 matrix representing a list of 20 vectors whose coordinates are written in rows. (a) Input list. (b) Output list determined with the function LatticeReduce of Mathe­matica. (a) Basis before reduction; the values of the rhombicity Mathematical equation and of the sum of the squares of the norms Mathematical equation are R = 453988268, S = 61580172. (b) Basis after reduction; the parameters decreased to R = 531, S = 99.

The principle of directional shear will be presented in Section 2[link]. It helps to obtain a reduced lattice with significantly lower R and S values, although higher than with LLL. The hyperplanar shear will be explained in Section 3[link]; it permits R and S to be decreased further. In Section 4[link], it will be shown how cycling directional and hyperplanar shears permits values of R and S to be obtained that are comparable with those of LLL.

2. Directional shearing

2.1. Lagrange's division

Let us consider two vectors Mathematical equation and Mathematical equation such that Mathematical equation. We introduce the rational number Mathematical equation from the orthogonal projection of Mathematical equation on Mathematical equation (Fig. 2[link]). Practically, as in LLL, q is encoded by a floating-point number. The vector Mathematical equation is rational and can be approximated by the integer vector Mathematical equation, where Mathematical equation is the integer closest to q computed by Mathematical equation. The reduced vector Mathematical equation belongs to the lattice spanned by Mathematical equation and Mathematical equation, and its norm is such that Mathematical equation if the coordinates of Mathematical equation and Mathematical equation are such that Mathematical equation, i.e. Mathematical equation. In the limit case Mathematical equation, the triangle made by (Mathematical equation, Mathematical equation, Mathematical equation) is isosceles, i.e. Mathematical equation. Note that, in some cases, the norm of Mathematical equation that is lower than that of Mathematical equation may even be lower than that of Mathematical equation. The vector Mathematical equation can be considered as the remainder of the vector division of Mathematical equation by Mathematical equation.

[Figure 2]
Figure 2
Directional shear of Mathematical equation along the direction Mathematical equation. Case where (a) Mathematical equation, and (b) Mathematical equation. The orthogonal projection point is noted H and marked by a little orange star.

Now, we consider a basis in N dimensions made of N integer vectors Mathematical equation initially sorted by norms, from the lowest to the highest norms, i.e. such that Mathematical equation. The function `Lagrange's division' consists of applying vector divisions to the pairs of vectors Mathematical equation of the list. It starts with the vectors Mathematical equation and Mathematical equation. Two cases should be distinguished in the algorithm: if Mathematical equation, nothing changes in the list and the next pair of vectors Mathematical equation is considered by iteration with a loop with i containing a loop with j; and if Mathematical equation, the list is modified, and two algorithm variants are proposed:

Variant Append: the vectors Mathematical equation and Mathematical equation are deleted from the list, and the vectors Mathematical equation and Mathematical equation are appended at the end of the list.

Variant Insert: if Mathematical equation, Mathematical equation replaces Mathematical equation, and Mathematical equation replaces Mathematical equation in the list; else, Mathematical equation replaces Mathematical equation in the list.

The process is repeated recursively; the input for the function `Lagrange's division' is the new list of vectors (without sorting them). The recursion stops when all the values Mathematical equation become null for all the pairs of vectors in the basis. The method is quite similar to Lagrange's division described by Nguyen & Vallée (2010[Nguyen, P. Q. & Vallée, B. (2010). The LLL Algorithm. Survey and Applications. Berlin, Heidelberg: Springer-Verlag.]).

The variant Insert gives good results in a short time. The rhombicity and the sum of the squares of the norms of the list in Fig. 1[link](a) that were initially R = 453988268, S = 61580172 are reduced to R = 540, S = 134. These values are not far from those obtained with the LLL algorithm (R = 531, S = 99). With Append, the list of Fig. 1[link](a) is reduced `only' to R = 1199, S = 337, but, as will be shown in the next sections, this will leave more action for the hyperplanar shearing, and better final reduction will be obtained at the end of the process for dimensions approximately Mathematical equation.

2.2. Simplification

Lagrange's division reduces the vectors by pairs without considering the basis as a whole. Now, if one accepts to slightly but only temporarily degrade the value of S of the basis, the rhombicity R can be further improved as follows. Let us consider again a list of integer vectors Mathematical equation sorted by norms from the lowest to the highest norms. For a pair of vectors Mathematical equation and Mathematical equation in the list such that Mathematical equation, we calculate the vector Mathematical equation Mathematical equation, where Mathematical equation if Mathematical equation, Mathematical equation if Mathematical equation and 0 if Mathematical equation. Then, we calculate whether or not replacing Mathematical equation or Mathematical equation by Mathematical equation allows the value of the rhombicity R to be decreased. If the answer is positive, the change is made. Here again, two algorithm variants are proposed

Variant `Append': if replacing Mathematical equation by Mathematical equation allows the value of R to be decreased, the vector Mathematical equation is deleted and the vector Mathematical equation is appended at the end of the list. If not, the vector Mathematical equation is deleted and the vector Mathematical equation is appended at the end of the list.

Variant `Insert': if replacing Mathematical equation by Mathematical equation allows the value of R to be decreased, the vector Mathematical equation is replaced by Mathematical equation at its position i; else, Mathematical equation is replaced by Mathematical equation at its position j. The new list of vectors is then sorted again following the increasing norms.

The variant `Insert' is chosen by default, except for random matrices for which the variant `Append' should be preferred, as will be discussed in Section 4[link]. The process of simplification is repeated recursively until R cannot be reduced anymore. Simplification permits the values obtained in Section 2.1[link] to be decreased a little more. For the list of Fig. 1[link](a), from the lattice reduced by Lagrange's division with R = 1199, S = 337, the lattice is further reduced to R = 1084, S = 330 by simplification with the variant Insert. At this step, the rhombicity cannot be further reduced, even by combining Lagrange's division and simplification. In the rest of the paper, the process described in Section 2[link] will be called `directional shearing'.

3. Hyperplanar shearing

3.1. The hyperplane normal

Let us consider again a list of integer vectors Mathematical equation initially sorted by norms, i.e. such that Mathematical equation. We isolate the first vector Mathematical equation and the subspace of dimension Mathematical equation (hyperplane) constituted by the vectors Mathematical equation. The coordinates of the integer vector Mathematical equation that is normal to this hyperplane can be calculated as follows. We write the coordinates of vectors Mathematical equation in columns to form the Mathematical equation matrix

Mathematical equation

where bi,j means the ith coordinate of the vector Mathematical equation.

If we insert in the matrix a first column made of any vector of the set Mathematical equation, let us say the vector Mathematical equation, then the new set of vectors becomes linearly dependent and the determinant of the N × N matrix is null:

Mathematical equation

Let us write this determinant by its cofactor expansion along the first column. The minors, i.e. the determinants of Mathematical equation, the Mathematical equation submatrices of Mathematical equation obtained by deleting the kth row, form a vector

Mathematical equation

that fulfils the property Mathematical equation In other words, Mathematical equation is the normal to the hyperplane Mathematical equation that we were looking for. Its norm equals the area of the hypersurface formed by the vectors Mathematical equation. The reader can check that in three dimensions Mathematical equation. The coordinates of Mathematical equation are the Miller indices.

Note 1. The calculation of the coordinates of Mathematical equation from the determinants of the square matrices Mathematical equation may appear complicated and computationally expensive, and one may think about other methods. It can be noticed that the coordinates of Mathematical equation are the solution of Mathematical equation, the null row vector, or equivalently Mathematical equation, the null column vector, both of dimension Mathematical equation. This system of equations is underdetermined since it is constituted of Mathematical equation equations with N unknown. It can be solved by matrix inversion by imposing a specific value 0 or 1 to one of the coordinates of Mathematical equation, but such an approach becomes numerically unstable and leads to incorrect solutions in high dimensions Mathematical equation. A more classical way would be to compute Gaussian elimination taking care with the choices of the pivot positions to avoid instabilities, but the complexity is O(N3), which is comparable with that required to calculate N determinants of square matrices of dimension Mathematical equation.

3.2. Hyperplanar shear

Let us consider a cell of the lattice Mathematical equation attached to the hyperplane Mathematical equation generated by the vectors Mathematical equation, i.e. Mathematical equation There are many equivalent cells, but we are looking for a quasi-reduced one. First, we replace the sublattice Mathematical equation by its reduced form Mathematical equation obtained by directional shearing, as described in Section 2[link]. If this reduction in dimension Mathematical equation is not possible, the sublattice Mathematical equation is not changed, i.e. Mathematical equation All the vectors Mathematical equation belong to the hyperplane Mathematical equation; we say that they are in the layer q = 0 of the plane Mathematical equation. Only the vector Mathematical equation points to a node of the layer q of the hyperplane Mathematical equation with Mathematical equation and Mathematical equation. Note that q = 1 for a unit cell. The set Mathematical equation is a cell attached to the hyperplane (Cayron, 2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]). Another vector of the lattice Mathematical equation pointing to the layer q such as Mathematical equation but shorter than Mathematical equation can be determined as follows. We note O the origin of the lattice, and Z the point such that Mathematical equation, as illustrated in Fig. 3[link]. We call H the orthogonal projection of O on the layer q of the hyperplane Mathematical equation. It is such that Mathematical equation and Mathematical equation. Thus, Mathematical equation. Its coordinates are not integer but remain rational.

[Figure 3]
Figure 3
Hyperplanar shear parallel to Mathematical equation. The lattice is `stratified' into different layers parallel to Mathematical equation. The layer to which the vector Mathematical equation points is given by the integer Mathematical equation. The hyperplanar shear is made by calculating the point H (marked by a little orange star) which is the orthogonal projection of the origin O onto the layer q. The node Z such that Mathematical equation can be translated towards another node Z′ closer to H (see text). The vector Mathematical equation has a lower norm and a better `orthogonality' with the hyperplane Mathematical equation.

The vector Mathematical equation is a vector of the hyperplane Mathematical equation, which means that it can be written as a linear combination of the vectors Mathematical equation. In order to get its coordinates, we use again the Mathematical equation matrix formed by writing the reduced vectors in columns, i.e.

Mathematical equation

The Mathematical equation local coordinates of Mathematical equation in the basis Mathematical equation are given by Mathematical equation where Mathematical equation is the left inverse of the matrix Mathematical equation. We recall that a left inverse of a non-square matrix Mathematical equation is Mathematical equation. The vector Mathematical equation is an Mathematical equation-dimensional rational vector in the Mathematical equation subspace. A lattice point Z′ close to H that belongs to the same layer is given by Mathematical equation. The vector Mathematical equation = Mathematical equation is calculated and re-expressed in the N-dimensional space by Mathematical equation. The vector Mathematical equation is a reduced form of the vector Mathematical equation. At this step the cell Mathematical equation attached to the hyperplane Mathematical equation has been reduced; the new vectors defining this cell are Mathematical equation. This is the method used by Cayron (2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]).

Note 2. The calculation of the Mathematical equation local coordinates of Mathematical equation in the basis Mathematical equation from the Mathematical equation matrix Mathematical equation may appear complicated and computationally expensive, and one may think about other methods. One may notice that the coordinates of Mathematical equation form an Mathematical equation vector Mathematical equation that is the solution of Mathematical equation. The system of equations is overdetermined since it is constituted of N equations with Mathematical equation unknown (the coordinates of Mathematical equation). One could ignore one of the equations (i.e. remove one of the rows of Mathematical equation) to solve the system by matrix inversion, but such an approach becomes numerically unstable and leads to incorrect solutions for high dimension Mathematical equation. This problem is induced by the projection. Let us explain it with an arbitrary example in three dimensions. We consider Mathematical equation = [1211, 1423, 1] and Mathematical equation = [−8921, 2389, 1], two vectors nearly perpendicular to the z axis, and the vector Mathematical equation that is in the plane (Mathematical equation, Mathematical equation). If we work with the coordinates (x, y) of Mathematical equation to write it as a linear combination of Mathematical equation and Mathematical equation, a solution is found without any problem. However, if the coordinates (x, z) or (y, z) of Mathematical equation are used, then the system becomes `unbalanced', and it would become completely unsolvable if 0 were chosen in place of 1 for the z coordinates of the vectors Mathematical equation and Mathematical equation. Geometrically, the instability comes from the projection along a direction that makes the rhombus (Mathematical equation, Mathematical equation) appear nearly on its edge, as a segment. To avoid this problem, one could solve the overdetermined system by Gaussian elimination, taking care with the choices of the pivot positions to avoid instabilities, but the complexity would be comparable with that required to calculate the left inverses of matrices.

The function `hyperplanar shear' works as follows. It starts with the list Mathematical equation and it tries to reduce Mathematical equation by a shear on the hyperplane Mathematical equation, as described previously. If the basis rhombicity is reduced when Mathematical equation is substituted by Mathematical equation, the vector Mathematical equation is moved to the end of the list, and the function is called again with Mathematical equation as input. If the rhombicity is not reduced, the function keeps the initial list Mathematical equation and tries to reduce the vector Mathematical equation by a shear on the hyperplane Mathematical equation etc. The process stops when all the vectors Mathematical equation of the list Mathematical equation are screened but none of the vectors Mathematical equation permits the basis rhombicity to be reduced any further. This series of hyperplanar shears will be called `hyperplanar shearing'.

Both directional and hyperplanar shearing imply orthogonal projections followed by numerical rounding in which rational numbers are replaced by their closest integers, which is actually very similar to the operations required in the Gram–Schmidt procedure. The lattice of Fig. 1[link](a) that was previously reduced by directional shearing becomes even more reduced by hyperplanar shearing: the rhombicity and sum of the squares of the norms decreased to R = 451 and S = 113. These values are closer to those obtained by LLL, and they will be improved even more by alternating directional and hyperplanar shearing, as detailed in the next section.

4. Cycling directional and hyperplanar shearing

4.1. Methods and options

The directional and hyperplanar shearing steps can now be repeated in cycles until the rhombicity cannot be decreased anymore. This method is called `cubification'. There is not a unique way to perform a cubification as it can be started by the directional shearing or by the hyperplanar shearing. It also depends on the variant of the algorithms chosen for Lagrange's division (Section 2.1[link]) and for the simplification (Section 2.2[link]). By trial and error, we could identify two cubification methods (Table 1[link]).

Table 1
Two cubification methods – the values of the options are given in Table 2[link]

Method 1 Method 2
Cubification (list, opt.): Cubification (list, opt.):
 newlist = Sort_by_norm (list)  newlist = Sort_by_norm (list)
 newlist = Directional shearing (newlist, opt.)  newlist = Hyperplanar shearing (newlist)
 newlist = Sort_by_norm (list)  newlist = Directional shearing (newlist, opt.)
 newlist = Hyperplanar shearing (newlist)  newlist = Hyperplanar shearing (newlist)
If R (newlist) < R (list): If R (newlist) < R (list):
  Return Cubification (newlist, opt.)   Return Cubification (newlist, opt.)
Else Return list Else Return list

The chosen algorithm variant depends on the type of matrix that is to be reduced (Table 2[link]). We refer to `columnar matrix' as a list of vectors whose matrix (the vectors are written in rows) contains many zeros, and at least one column contains many non-null and generally moderate integer values (here 3 or 4 digits). A typical example is the matrix given in Fig. 1[link](a). We noticed that for matrices of dimensions approximately Mathematical equation, Lagrange's division in its Append variant gives better results than with `Insert'. A `heterogeneous matrix' is a matrix that contains many zeros, and at least one row and one column with many non-null and moderate integer values. We noticed that for some cases of large heterogeneous matrices, with approximately Mathematical equation, the first directional reduction may go beyond the recursion limit of our computer; when this happens, applying first a hyperplanar shearing solves the problem. A `random matrix' is a matrix whose values are randomly computed with integers between 0 and 100. Limits larger than 100, for example 1000, in large random matrices Mathematical equation lead to too high integer values in intermediate calculations and error messages. A `columnar random matrix' is here an identity matrix in which the last column is replaced by random integers in the range 0–100. Columnar random matrices are classified as random matrices and are treated with method 2.

Table 2
Method and option to be used depending on the type of square matrix

We consider `large' a matrix of dimension Mathematical equation. For some large heterogeneous matrices a first step with hyperplanar shearing may be required before starting method 1, as indicated in parentheses.

Type of list of vectors Cubification method Variant for the directional reduction
Lagrange's division Simplification
Small columnar matrix Method 1 Insert Insert
Large columnar matrix Append Insert
Large heterogeneous matrix (Hyperplanar shearing +) method 1 Insert Insert
Random matrix Method 2 Append Append

4.2. Computer program and comparisons

We wrote a computer program called Cubification in Python 3.8 using the Numpy library to perform the matrix calculations (scalar products, matrix products, inverses etc.), generate the random numbers, vectors and matrices, and calculate the reduced lattices. All the results presented in the paper were obtained with a laptop computer equipped with an Intel Core i7-4600 CPU 2.1 GHz, 64-bit Windows system, with a RAM of 8 GB. The recursion limit in our Python program has been fixed to 10 000. We compared the results obtained with our program with those obtained by the LLL method computed in Python 3 by Yonashiro (2020[Yonashiro, N. (2020). OLLL, a Python3 Implementation of LLL, available at https://github.com/orisano/olll.]) in a program called OLLL. All the OLLL calculations were made with α = 3/4. For specific matrices, such as that of Fig. 1[link], we also used the function ReduceLattice of Mathematica. On this example we checked that OLLL and Mathematica give the same result; the only difference is that the calculations are nearly instantaneous with Mathematica, whereas they are longer (a few seconds) with Python language (OLLL and Cubification). This shows that it is difficult to compare the time efficiency of lattice reduction algorithms with computer programs written by different people in different languages. Thus, the execution times will just be given for indication.

4.3. Results on non-random matrices

The cubification algorithm gives results quite similar to those of LLL. For example, the lattice of Fig. 1[link](a) could be reduced in three cycles (in 3.0 s); the output list of vectors is given in Fig. 4[link]. The final basis is characterized by R = 285, S = 87; these values are lower than those obtained by LLL (R = 531, S = 99). Souvignier (2021[Souvignier, B. (2021). Personal communication.]) showed that with the Schnorr–Euchner variant of LLL it is possible to get a reduced basis with R = 335, S = 83, and then, by computing the vectors of norm 4, selecting 18 of them and associating them with two vectors of norms 3, he could obtain a reduced basis with R = 294, S = 78. These solutions are significantly better than those obtained by Mathematica. Compared with the result obtained by cubification, they have a lower norm S (also a lower norm P), but a larger rhombicity R. This example shows that improving only the norms of the vectors does not always permit a better orthogonality (and vice versa) to be obtained, as also shown in Appendix B[link].

[Figure 4]
Figure 4
Cubification by method 1 of the lattice of Fig. 1[link](a). The vectors are written in rows, as in Fig. 1[link]. The reduced basis has values R = 285, S = 87.

For heterogeneous matrices, we have tested only five 20 ×20 matrices, and all of them show that LLL and cubification give similar results (not shown here).

4.4. Results on random matrices

We have tested the performances of Cubification (method 2) and OLLL programs on columnar random matrices and full random matrices. We used matrices of dimensions 10 ×10, 12 ×12 and 14 ×14. Fifty matrices have been generated for each type. The performances on the norms and orthogonalities were measured by the reduction factors R(input)/R(output) and S(input)/S(output). The higher the reduction factors, the better the algorithm. The results are given in Table 3[link].

Table 3
Reduction factors obtained on columnar and full random matrices of dimensions 10 ×10, 12 ×12 and 14 ×14 by testing 50 matrices

The mean deviation estimated by various tests is for OLLL around ± 20% for a 10 × 10 matrix and it decreases down to ±5% for a 14 × 14 matrix. It seems to be larger for Cubification (±25% and ±10%, respectively).

Reduction factor R(input)/R(output) S(input)/S(output)
Columnar random matrices 10 ×10
OLLL 2780 1000
Cubification 3600 1060
Columnar random matrices 12 ×12
OLLL 3120 1060
Cubification 4100 1090
Columnar random matrices 14 ×14
OLLL 3630 1160
Cubification 4370 1070
     
Full random matrices 10 ×10
OLLL 14.3 5.2
Cubification 16.9 5.4
Full random matrices 12 ×12
OLLL 14.1 5.0
Cubification 15.2 4.6
Full random matrices 14 ×14
OLLL 13.6 4.7
Cubification 14.3 4.1

For these moderate dimensions, the reduction of the rhombicity is systematically better with Cubification than with the OLLL algorithm. The norms seem however less reduced by Cubification for large full random matrices. The execution times of Cubification are 0.1, 0.3 and 0.5 s for 10 × 10, 12 × 12 and 14 × 14 columnar random matrices, respectively, and 0.2, 0.7 and 1.3 s for 10 × 10, 12 × 12 and 14 × 14 full random matrices, respectively. They are slightly shorter than with OLLL. We also performed some experiments in higher dimensions. The mean execution times are 14 and 30 s for 30 × 30 columnar and full random matrices, respectively. They are shorter than with OLLL, but ten times longer than those reported with other optimized Python programs (Papachristoudis et al., 2015[Papachristoudis, D. G., Halkidis, S. T. & Stephanides, G. (2015). Int. J. Appl. Comput. Math. 1, 327-342.]). The way the algorithm is implemented, the choice of types of variables, the use of different libraries, the memory management, all play a crucial role in the execution times. In this paper, the code was not optimized to reach the best performances in execution times; its aim was only to show that simple shears along directions and hyperplanes may be interesting tools for lattice reduction.

5. Conclusion and perspectives

A method of lattice reduction called `cubification' is proposed. It is geometrically simple; it is based on the complementary actions of directional shearing and hyperplanar shearing. These two kinds of shears were initially introduced to reduce the unit cells attached to given hyperplanes (Cayron, 2021[Cayron, C. (2021). Acta Cryst. A77, 453-459.]). In contrast to LLL, the cubification algorithm does not require the calculations of Gram–Schmidt bases. The `driving force' of the reduction is the `basis rhombicity', a parameter that encompasses the information on the norms and angles of the basis vectors. A computer program called Cubification was written in Python 3.8. The results are comparable with those of LLL, at least up to moderate dimensions (Mathematical equation. The Python program Cubification is freely available from the author on request.

We foresee margins of progression for the algorithm of cubification. The two methods described in Section 4.1[link] were determined by trial and error; better strategies to alternate the directional and hyperplanar shears seem possible, for example by cross-calling the two processes without necessarily screening all the vectors in the basis. We could also try to generalize the Mathematical equation decrease of dimensions already used in the hyperplanar shearing step with the help of the left inverse matrices to work in spaces of dimensions Mathematical equation, Mathematical equation etc.

APPENDIX A

Brief overview of the LLL algorithm

The most popular algorithm to tackle the lattice reduction problem was proposed nearly 40 years ago by Lenstra–Lenstra–Lovász (Lenstra et al., 1982[Lenstra, A. K., Lenstra, H. W. Jr & Lovász, L. (1982). Math. Ann. 261, 515-534.]), and it is still considered as the main reference in the domain. It should be noted that the LLL algorithm does not give in general a Hermite–Minkowski reduced basis for which the vectors have minimal lengths (Ryshkov, 1976[Ryshkov, S. S. (1976). J. Math. Sci. 6, 651-671.]), but `only' a basis made of short and nearly orthogonal vectors that constitutes a good, approximate solution that is very useful for many applications. It was initially designed to give in polynomial-time a good solution for factorizing polynomials with rational coefficients, and it is also nowadays applied for finding rational approximations to real numbers, and for solving the integer linear programming problems in fixed dimensions; it is applied in global positioning systems (GPS), data detection and communication systems. It is so important that a complete book has been devoted to it (Nguyen & Vallée, 2010[Nguyen, P. Q. & Vallée, B. (2010). The LLL Algorithm. Survey and Applications. Berlin, Heidelberg: Springer-Verlag.]). The reader can also consult Wübben et al. (2011[Wübben, D., Seethaler, D., Jaldén, J. & Matz, G. (2011). IEEE Signal Process. Mag. 28, 70-91.]). We just give here some of its key points. At the core of LLL is the Gram–Schmidt orthogonalization routine in which one attaches to any basis Mathematical equation an orthogonal basis Mathematical equation by a series of projections Mathematical equation = Mathematical equation with Mathematical equation. The vectors Mathematical equation are not integer anymore (i.e. `reticular' in crystallographic language); they remain however rational. Practically, as the numerators and denominators may become huge numbers, floating-point numbers are used for ui,k. The LLL algorithm works in two steps repeated iteratively. The first step is the quasi-orthogonalization. The vectors Mathematical equation are replaced by Mathematical equation, for k between 1 and Mathematical equation, where Mathematical equation means the nearest integer of ui,k. The Gram–Schmidt basis should be actualized during the process. The second step relies on a criterion to determine whether or not the vectors Mathematical equation and Mathematical equation should be swapped: the swap is made when Mathematical equation < Mathematical equation, where Mathematical equation is a constant arbitrarily chosen between ¼ and 1 (and fixed once for all). Often, the value Mathematical equation is chosen. The constant α influences the strength of reduction in the algorithm and by that also the number of required iterations; greater values lead to stronger reductions; it has an effect on the final norms of the reduced vectors, and more precisely it permits the product of the squared norms Mathematical equation to be bound.

APPENDIX B

Example of a lattice with two reduced bases of the same norms but different orthogonalities

This appendix provides an example showing that minimizing the norms of the vectors of a lattice does not necessarily permit their orthogonality to be improved. Let us consider the lattice spanned by the four vectors Mathematical equation whose coordinates are written in rows by

Mathematical equation

The squares of the norms of the four vectors are 2, 2, 2, 3. The parameters that can be used to evaluate the `norm' of the basis B are the sum of the squares of norms Mathematical equation and the products of the squares of norms Mathematical equation. This basis is already reduced if one considers only the norm of B. The output of the LLL algorithm is thus the same basis. However, the same lattice may also be given by the vectors Mathematical equation, Mathematical equation, Mathematical equation, Mathematical equation, written in rows:

Mathematical equation

The squares of the norms of the four vectors are 2, 2, 2, 3, and the new basis Mathematical equation is characterized by the parameters Mathematical equation and Mathematical equation. The two bases B and B′ generate the same lattice and have the same `norm', but their orthogonalities are different. Their metric tensors are

Mathematical equation

and

Mathematical equation

respectively. Their rhombicities are Mathematical equation and Mathematical equation, respectively. The basis Mathematical equation is thus more `orthogonal' than the basis B. This example shows that the term `orthogonality defect' usually attributed to the parameter P/V may not be very appropriate. Since the value Mathematical equation gives the Euclidean scalar products of the vectors with the other ones, the parameter Mathematical equation seems better adapted to characterize the `orthogonality defect'. The cubification method described in the paper aims at reducing both the norms and the orthogonalites of the vectors, which is why the rhombicity R was used as a driving force in the algorithm. The basis Mathematical equation of the example was found by cubification.

Acknowledgements

Professor Roland Logé is warmly acknowledged for the freedom given to our research that sometimes goes beyond metallurgy. I would also like to thank the reviewers, and particularly Professor Souvignier, who showed me the efficiency of the Schnorr–Euchner method on the same examples with the same parameters R and S as those introduced in the paper. The paper was modified and improved thanks to his comments. Professor Palatinus is also thanked for his advice and for putting me in contact with Professor Souvignier.

Funding information

Open access funding provided by Ecole Polytechnique Federale de Lausanne.

References

First citationCayron, C. (2021). Acta Cryst. A77, 453–459.  Web of Science CrossRef IUCr Journals Google Scholar
First citationLenstra, A. K., Lenstra, H. W. Jr & Lovász, L. (1982). Math. Ann. 261, 515–534.  CrossRef Web of Science Google Scholar
First citationNguyen, P. Q. & Vallée, B. (2010). The LLL Algorithm. Survey and Applications. Berlin, Heidelberg: Springer-Verlag.  Google Scholar
First citationPapachristoudis, D. G., Halkidis, S. T. & Stephanides, G. (2015). Int. J. Appl. Comput. Math. 1, 327–342.  CrossRef Google Scholar
First citationRyshkov, S. S. (1976). J. Math. Sci. 6, 651–671.  CrossRef Google Scholar
First citationSouvignier, B. (2021). Personal communication.  Google Scholar
First citationWübben, D., Seethaler, D., Jaldén, J. & Matz, G. (2011). IEEE Signal Process. Mag. 28, 70–91.  Google Scholar
First citationYonashiro, N. (2020). OLLL, a Python3 Implementation of LLL, available at https://github.com/orisano/olllGoogle Scholar

This is an open-access article distributed under the terms of the Creative Commons Attribution (CC-BY) Licence, which permits unrestricted use, distribution, and reproduction in any medium, provided the original authors and source are cited.

Journal logoFOUNDATIONS
ADVANCES
ISSN: 2053-2733
Follow Acta Cryst. A
Sign up for e-alerts
Follow Acta Cryst. on Twitter
Follow us on facebook
Sign up for RSS feeds