Skip to content

Commit

Permalink
Don't call LAPACK when LU-decomposing empty real/complex matrices
Browse files Browse the repository at this point in the history
Otherwise, Macaulay2 crashes

Fixes bug reported by Joel Louwsma in Zulip
  • Loading branch information
d-torrance committed May 15, 2024
1 parent 1b27bd8 commit 2d9afc3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions M2/Macaulay2/e/dmat-lu-inplace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ inline void DMatLUinPlace<M2::ARingRR>::computeLU()
int info;
int min = (rows <= cols) ? rows : cols;

if (min == 0)
return;

// printf("entering DMatLUinPlace::computeLUNaive for RR\n");

int* perm = newarray_atomic(int, min);
Expand Down Expand Up @@ -345,6 +348,9 @@ inline void DMatLUinPlace<M2::ARingCC>::computeLU()
int info;
int min = (rows <= cols) ? rows : cols;

if (min == 0)
return;

// printf("entering DMatLUtemplate::computeLUNaive for RR\n");

int* perm = newarray_atomic(int, min);
Expand Down

0 comments on commit 2d9afc3

Please sign in to comment.