Skip to content

Commit 2b27939

Browse files
committed
in case there is no entries in the matrix
1 parent d13ea2a commit 2b27939

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bindings/Modules/src/SofaPython3/SofaLinearSystem/Binding_LinearSystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void bindLinearSystems(py::module &m)
8787
{
8888
if (CRS* matrix = self.getSystemMatrix())
8989
{
90+
if (matrix->colsValue.empty()) //null matrix: contains no entries
91+
{
92+
return EigenSparseMatrix<Real>{matrix->rows(), matrix->cols()};
93+
}
9094
return toEigen(*matrix);
9195
}
9296
return {};

0 commit comments

Comments
 (0)