|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility |
Date: | Tue, 28 Sep 2021 20:18:53 -0400 (EDT) |
User-agent: | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 |
Follow-up Comment #36, bug #61199 (project octave): I did some more benchmarking and checked in the final changeset here: http://hg.savannah.gnu.org/hgweb/octave/rev/f5aba4d7e651. Benchmark times (in microseconds) Original code: 113 New code w/gcd loop: 484 New code w/gcd loop & pairwise multiplication: 371 New code w/gcd loop, pairwise multiplication, factor 2 removal: 339 I was able to get another 8.5% improvement by realizing that pairwise multiplication of an odd and an even number will always produce an even number. Hence, one can take out a factor of 2 immediately from the numerator and denominator. Overall, I'm happy with the result. It is more accurate and no human is going to notice the difference between 0.1 millisecond and 0.3 milliseconds given that reaction times are on the order of 750 milliseconds. I'm ready to close this bug if everyone else is. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61199> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |