|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility |
Date: | Wed, 29 Sep 2021 14:12:31 -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 #40, bug #61199 (project octave): I think that was just an oversight of mine. I was using the test case "nchoosek (63,19)" and hence always going through the branch of code where K was odd. I made a small change here (http://hg.savannah.gnu.org/hgweb/octave/rev/750de16fd35c) so that the branch where K is even uses the same strategy as when K is odd. Specifically, I reverse the order of the second range. As an example, take K = 4. Previously the denominator (1:K) was split into pairs of 1:2 and 3:4 and the pairwise multiplication was [1 2] .* [3 4] = [3 8] where the first entry is odd in the result is odd. Now I compute [1 2] .* [4 3] = [4 6] and the result only contains even numbers which can safely be divided by 2. _______________________________________________________ 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] |