Skip to content

Commit

Permalink
more tweaks for empty matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
AllinCottrell committed Dec 3, 2024
1 parent 0c35a98 commit 8212954
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/usermat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,8 @@ gretl_matrix *matrix_get_submatrix (const gretl_matrix *M,
if (M->rows == 1 && M->cols == 1) {
if (spec->ltype == SEL_EXCL && spec->rtype == SEL_NULL) {
r = c = 0;
} else if (spec->ltype == SEL_EXCL && spec->rtype == SEL_EXCL) {
r = c = 0;
} else if (spec->ltype == SEL_EXCL && spec->rtype == SEL_ALL) {
r = 0; c = 1;
} else if (spec->ltype == SEL_ALL && spec->rtype == SEL_EXCL) {
Expand All @@ -1042,8 +1044,8 @@ gretl_matrix *matrix_get_submatrix (const gretl_matrix *M,

if (S == NULL) {
*err = E_ALLOC;
} else if (r == 0 && c == 0) {
/* nothing more to be done */
} else if (r * c == 0) {
/* empty matrix: nothing more to be done */
return S;
} else {
int j, mj;
Expand Down

0 comments on commit 8212954

Please sign in to comment.