Mercurial > octave
comparison 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 |
comparison
equal
deleted
inserted
replaced
31230:6646f2b5a3d1 | 31231:a026fb2be108 |
---|---|
64 octave_value retval; | 64 octave_value retval; |
65 | 65 |
66 octave_idx_type nr = a.rows (); | 66 octave_idx_type nr = a.rows (); |
67 octave_idx_type nc = a.cols (); | 67 octave_idx_type nc = a.cols (); |
68 | 68 |
69 if (nr == 0 || nc == 0 || nr != nc) | 69 if (nr != nc) |
70 error ("for A^b, A must be a square matrix. Use .^ for elementwise power."); | 70 error ("for A^b, A must be a square matrix. Use .^ for elementwise power."); |
71 | |
72 if (nr == 0 && nc == 0) | |
73 return a; | |
71 | 74 |
72 if (! xisint (b)) | 75 if (! xisint (b)) |
73 error ("use full(a) ^ full(b)"); | 76 error ("use full(a) ^ full(b)"); |
74 | 77 |
75 int btmp = static_cast<int> (b); | 78 int btmp = static_cast<int> (b); |