Mercurial > octave
changeset 31231:a026fb2be108
sparse-xpow.cc: Return empty matrix for empty input (bug #63080)
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Mon, 19 Sep 2022 07:05:31 -0400 |
parents | 6646f2b5a3d1 |
children | 95fa3182f00c |
files | libinterp/corefcn/sparse-xpow.cc |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/sparse-xpow.cc Sat Sep 17 04:22:38 2022 -0400 +++ b/libinterp/corefcn/sparse-xpow.cc Mon Sep 19 07:05:31 2022 -0400 @@ -66,9 +66,12 @@ octave_idx_type nr = a.rows (); octave_idx_type nc = a.cols (); - if (nr == 0 || nc == 0 || nr != nc) + if (nr != nc) error ("for A^b, A must be a square matrix. Use .^ for elementwise power."); + if (nr == 0 && nc == 0) + return a; + if (! xisint (b)) error ("use full(a) ^ full(b)");