[Mlir-commits] [mlir] [MLIR][Presburger] Add LLL basis reduction (PR #75565)
Arjun P
llvmlistbot at llvm.org
Fri Dec 15 09:08:12 PST 2023
================
@@ -377,4 +377,51 @@ TEST(MatrixTest, gramSchmidt) {
gs = mat.gramSchmidt();
EXPECT_EQ_FRAC_MATRIX(gs, FracMatrix::identity(10));
-}
\ No newline at end of file
+}
+
+TEST(MatrixTest, LLL) {
+ FracMatrix mat =
+ makeFracMatrix(3, 3,
+ {{Fraction(1, 1), Fraction(1, 1), Fraction(1, 1)},
+ {Fraction(-1, 1), Fraction(0, 1), Fraction(2, 1)},
+ {Fraction(3, 1), Fraction(5, 1), Fraction(6, 1)}});
+ mat.LLL(Fraction(3, 4));
+
+ FracMatrix LLL =
+ makeFracMatrix(3, 3,
+ {{Fraction(0, 1), Fraction(1, 1), Fraction(0, 1)},
+ {Fraction(1, 1), Fraction(0, 1), Fraction(1, 1)},
+ {Fraction(-1, 1), Fraction(0, 1), Fraction(2, 1)}});
+
+ for (unsigned row = 0; row < 3; row++)
+ for (unsigned col = 0; col < 3; col++)
+ EXPECT_EQ(mat(row, col), LLL(row, col));
----------------
Superty wrote:
just make a function EXPECT_EQ_MAT or add operator== to matrix
https://github.com/llvm/llvm-project/pull/75565
More information about the Mlir-commits
mailing list