[Mlir-commits] [mlir] [MLIR][Presburger] Add Gram-Schmidt (PR #70843)
Arjun P
llvmlistbot at llvm.org
Fri Dec 8 04:34:04 PST 2023
================
@@ -548,4 +548,25 @@ Fraction FracMatrix::determinant(FracMatrix *inverse) const {
determinant *= m.at(i, i);
return determinant;
+}
+
+FracMatrix FracMatrix::gramSchmidt() const {
+ // Create a copy of the argument to store
+ // the orthogonalised version.
+ FracMatrix orth(*this);
+
+ // For each vector (row) in the matrix, subtract its unit
+ // projection along each of the previous vectors.
+ // This ensures that it has no component in the direction
+ // of any of the previous vectors.
+ for (unsigned i = 1, e = getNumRows(); i < e; i++) {
+ for (unsigned j = 0; j < i; j++) {
+ Fraction jDotProd = dotProduct(orth.getRow(j), orth.getRow(j));
----------------
Superty wrote:
"jDotProd" -> `jNormSquared`
https://github.com/llvm/llvm-project/pull/70843
More information about the Mlir-commits
mailing list