Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions M2/Macaulay2/e/mutablemat-defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ class MutableMat : public MutableMatrix
n_cols() - 1);
return 0;
}
MutableMat* result =
new MutableMat(*this); // zero matrix, over the same ring
MutableMat* result = makeZeroMatrix(rows->len, cols->len);
MatOps::setFromSubmatrix(getMat(), rows, cols, result->getMat());
return result;
}
Expand All @@ -534,8 +533,7 @@ class MutableMat : public MutableMatrix
n_cols() - 1);
return 0;
}
MutableMat* result =
new MutableMat(*this); // zero matrix, over the same ring
MutableMat* result = makeZeroMatrix(n_rows(), cols->len);
MatOps::setFromSubmatrix(getMat(), cols, result->getMat());
return result;
}
Expand Down
5 changes: 5 additions & 0 deletions M2/Macaulay2/tests/normal/mutmat.m2
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ assert(ring mutableMatrix(ZZ/101, {{1,2,3}}) === ZZ/101)
M = mutableMatrix {{1, 2, 3}, {4, 5, 6}}
assert Equation(target M, ZZ^2)
assert Equation(source M, ZZ^3)

-- issue #997
A = mutableMatrix {{10}}
B = submatrix(A, {0}, {0})
assert(hash A != hash B)
Loading