# HG changeset patch # User Rik # Date 1664928321 25200 # Node ID fa4bb329a51a32869624d7b69c13b7459d713c37 # Parent 43068d904d9df49d122c4e1741feb2d97e509061 Allow empty sparse matrix inputs to qr() (bug #63069) * qr.cc (Fqr): Add BIST tests for bug #63069. * sparse-qr.cc (sparse_qr::sparse_qr_rep::sparse_qr_rep, sparse_qr::sparse_qr_rep::C, sparse_qr::sparse_qr_rep::tall_solve, Matrix>, sparse_qr::sparse_qr_rep::sparse_qr_rep, sparse_qr::sparse_qr_rep::C, sparse_qr::solve): Change input validation from "<= 0" to "< 0". Change error message to "matrix dimension with negative size" from "matrix dimension with negative or zero size". diff -r 43068d904d9d -r fa4bb329a51a libinterp/corefcn/qr.cc --- a/libinterp/corefcn/qr.cc Tue Oct 04 16:58:14 2022 -0400 +++ b/libinterp/corefcn/qr.cc Tue Oct 04 17:05:21 2022 -0700 @@ -800,11 +800,17 @@ %! assert (r, re, sqrt (eps)); %! assert (q'*b, c, sqrt (eps)); +## Empty matrices %!test %! assert (qr (zeros (0, 0)), zeros (0, 0)) %! assert (qr (zeros (1, 0)), zeros (1, 0)) %! assert (qr (zeros (0, 1)), zeros (0, 1)) +%!test <*63069> +%! assert (qr (sparse (0, 0)), sparse (0, 0)) +%! assert (qr (sparse (1, 0)), sparse (1, 0)) +%! assert (qr (sparse (0, 1)), sparse (0, 1)) + %!error qr () %!error qr ([1, 2; 3, 4], 0, 2) %!error