Mercurial > octave
view test/bug-35881/bug35881.m @ 31240:bf8f33249e86
delaunayn simplex check consistency and performance improvement (bug #60818)
* delaunayn.m: Apply consistent volume calculation across all trivial simplex
removal code paths. Vectorize 3D simplex removal code path and minimize
function calls within >3D loop for performance improvement. Update FIXME note
for future performance improvement. Add input type validation checks. Add BISTs
for dimensions other than 2D, simplex removal, and input validation.
* etc/News.8.md: Describe function improvements under General Improvements.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Wed, 28 Sep 2022 14:35:30 -0400 |
parents | eec262017c6a |
children | 8e4f14837db2 |
line wrap: on
line source
function bug35881 (flag = 0) persistent a; global _tstvar_; if (isempty (a)) a = 1; endif _tstvar_.init1 = subf (); _tstvar_.a1 = a; ##ML:fprintf ('a=%d\n', a); switch (flag) case 0 clear subf; case 1 clear functions; case 2 clear all; endswitch _tstvar_.init2 = subf (); _tstvar_.a2 = a; ##ML:fprintf ('a=%d\n', a); ##ML:fprintf ('------\n\n'); endfunction function retval = subf () persistent x; retval = false; ##ML:fprintf ('subf: '); if (isempty (x)) x = 1; retval = true; ##ML:fprintf ('INIT, '); endif endfunction ## Expected results from Matlab 2016A ## Uncomment "##ML:" #{ >> clear all; bug35881 (0) subf: INIT, a=1 subf: a=1 ------ >> clear all; bug35881 (1) subf: INIT, a=1 subf: a=1 ------ >> clear all; bug35881 (2) subf: INIT, a=1 subf: Reference to a cleared variable a. Error in test_clear_inside_function (line 13) subf (); fprintf ('a=%d\n', a); #}