Skip to content

Commit 012b695

Browse files
committed
Introduce some additional functions.
1 parent 3e7a18c commit 012b695

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src_matrix/MAT_MatrixInt.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,9 @@ void ComputeRowHermiteNormalForm_Kernel(MyMatrix<T> &H, F f) {
688688
ListIdx.push_back(iRow);
689689
T eVal = H(iRow, iCol);
690690
ListX.push_back(eVal);
691-
if (eVal != 0)
691+
if (eVal != 0) {
692692
HasNonZero = true;
693+
}
693694
}
694695
if (HasNonZero) {
695696
//
@@ -765,6 +766,19 @@ ComputeRowHermiteNormalForm(MyMatrix<T> const &M) {
765766
return {std::move(U), std::move(H)};
766767
}
767768

769+
template <typename T>
770+
MyMatrix<T> ComputeRowHermiteNormalForm_first(MyMatrix<T> const &M) {
771+
int nbRow = M.rows();
772+
MyMatrix<T> H = M;
773+
MyMatrix<T> U = IdentityMat<T>(nbRow);
774+
auto f = [&](auto g) -> void {
775+
g(H); // We need to update H because that is what we work on
776+
g(U);
777+
};
778+
ComputeRowHermiteNormalForm_Kernel(H, f);
779+
return U;
780+
}
781+
768782
template <typename T>
769783
MyMatrix<T> ComputeRowHermiteNormalForm_second(MyMatrix<T> const &M) {
770784
MyMatrix<T> H = M;
@@ -794,8 +808,9 @@ void ComputeColHermiteNormalForm_Kernel(MyMatrix<T> &H, F f) {
794808
ListIdx.push_back(iCol);
795809
T eVal = H(iRow, iCol);
796810
ListX.push_back(eVal);
797-
if (eVal != 0)
811+
if (eVal != 0) {
798812
HasNonZero = true;
813+
}
799814
}
800815
if (HasNonZero) {
801816
//

0 commit comments

Comments
 (0)