changeset 25247:db31e068f4db stable

Rewrite incorrect assert statement in colloc calculation (bug #53653) * colloc.cc (jcobi, dfopr): Correct assert statement to be nt >= 1 to match original Fortran. * CollocWt.cc (Fcolloc): Add a few BIST tests.
author Rik <rik@octave.org>
date Sat, 14 Apr 2018 09:12:40 -0700
parents b20d0736f322
children dd33fea906f6
files libinterp/corefcn/colloc.cc liboctave/numeric/CollocWt.cc
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/colloc.cc	Sat Apr 14 05:51:42 2018 -0700
+++ b/libinterp/corefcn/colloc.cc	Sat Apr 14 09:12:40 2018 -0700
@@ -89,3 +89,12 @@
 
   return ovl (r, A, B, q);
 }
+
+/*
+
+%!assert (colloc (1), 0.5)
+%!assert (colloc (1, "left"), [0; 0.5])
+%!assert (colloc (1, "right"), [0.5; 1])
+%!assert (colloc (1, "left", "right"), [0; 0.5; 1])
+
+*/
--- a/liboctave/numeric/CollocWt.cc	Sat Apr 14 05:51:42 2018 -0700
+++ b/liboctave/numeric/CollocWt.cc	Sat Apr 14 09:12:40 2018 -0700
@@ -153,7 +153,7 @@
 
   octave_idx_type nt = n + n0 + n1;
 
-  assert (nt > 1);
+  assert (nt >= 1);
 
 // -- first evaluation of coefficients in recursion formulas.
 // -- recursion coefficients are stored in dif1 and dif2.
@@ -315,7 +315,7 @@
 
   octave_idx_type nt = n + n0 + n1;
 
-  assert (nt > 1);
+  assert (nt >= 1);
 
   assert (id == 1 || id == 2 || id == 3);