Mercurial > octave
diff libinterp/corefcn/sparse-xpow.cc @ 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 | 0dec459a4064 |
children | a1318deb4584 |
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)");