[Mlir-commits] [mlir] [MLIR][Presburger] Add LLL basis reduction (PR #75565)
Arjun P
llvmlistbot at llvm.org
Sat Dec 16 05:31:49 PST 2023
================
@@ -576,4 +576,73 @@ FracMatrix FracMatrix::gramSchmidt() const {
}
}
return orth;
-}
\ No newline at end of file
+}
+
+// Convert the matrix, interpreted (row-wise) as a basis
+// to an LLL-reduced basis.
+//
+// This is an implementation of the algorithm described in
+// "Factoring polynomials with rational coefficients" by
+// A. K. Lenstra, H. W. Lenstra Jr., L. Lovasz.
+//
+// Let {b_1, ..., b_n} be the current basis and
+// {b_1*, ..., b_n*} be the Gram-Schmidt orthogonalised
+// basis (unnormalized).
+// Define the Gram-Schmidt coefficients μ_ij as
+// (b_i • b_j*) / (b_j* • b_j*), where (•) represents the inner product.
+//
+// We iterate starting from the second row to the last row.
+//
+// For the kth row, we first check μ_kj for all rows j < k.
+// If it is more than 1/2, we subtract b_j (scaled by μ_kj)
+// from b_k.
+//
+// Now, we update k.
+// If b_k and b_{k-1} satisfy the Lovasz condition, we are done
----------------
Superty wrote:
write what the lovasz condition is
https://github.com/llvm/llvm-project/pull/75565
More information about the Mlir-commits
mailing list