Skip to content

Commit

Permalink
Handle zero vectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuDutSik committed Aug 9, 2024
1 parent 05bf091 commit 91da868
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src_matrix/MAT_MatrixInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ template <typename T> struct FractionMatrix {

template <typename T>
FractionMatrix<T> RemoveFractionMatrixPlusCoeff(MyMatrix<T> const &M) {
if (IsZeroMatrix(M)) {
return {1, M};
}
int nbRow = M.rows();
int nbCol = M.cols();
using Tring = typename underlying_ring<T>::ring_type;
Expand Down Expand Up @@ -422,6 +425,9 @@ MyMatrix<T> ScalarCanonicalizationMatrix(MyMatrix<T> const &M) {

template <typename T>
FractionVector<T> RemoveFractionVectorPlusCoeff(MyVector<T> const &V) {
if (IsZeroVector(V)) {
return {1, V};
}
int n = V.size();
std::vector<T> eVect(n);
T eLCM = GetDenominator(V(0));
Expand Down

0 comments on commit 91da868

Please sign in to comment.