On Sep 2, 11:45 pm, John Fingerhut <andy.finger...@gmail.com> wrote: > Most likely. That one I found somewhat annoying in that the checksum > computation does depend upon the permutations being generated in a > particular order.
Fannkuch has required the permutations to be generated in a particular order for years because too many programmers contributed programs that did not generate some of the permutations or used faster algorithms to generate the permutations. At first the requirement was met simply by printing the first 30 permutations but too many programmers contributed programs that used the accepted algorithm for the first 30 permutations and then did not generate some of the permutations or used faster algorithms for the bulk of the work - somewhat annoying. > It also seems to depend upon the sign flipping being done > for every permutation, even those beginning with a '1', for which the > pfannkuch function returns 0. "The checksum is computed as follows: checkSum += permutationIndex % 2 == 0 ? flipsCount : -flipsCount; where permutationIndex is determined by a fixed order in which all n! permutations are to be generated. The goal is to prevent programs from questionable optimizations when significant permutation subsets were excluded from processing, in contradiction with an explicitly stated rule prohibiting such shortcuts, thus giving those programs unfair advantage. The cheksum is very lightweight and can be computed in parallel." To which I'll add - "At least one person noticed that the isEven test reduces what needs to be known about permutationIndex - so they simply toggle between -1 and 1." > One way to find out what the order is is to download the Java benchmark, add > some debug print statements, and run it with a small argument like 6 or 7. > Either that, or read and understand its permutation generating code. > > Andy > > On Thu, Sep 2, 2010 at 11:01 PM, Miki <miki.teb...@gmail.com> wrote: > > Hello, > > > I've tried writing a a solution to shootout "fannkuch" (http:// > > shootout.alioth.debian.org/u32/performance.php?test=fannkuchredux), > > however I seem to have a bug in the checksum. Is it just the order of > > permutations or am I missing something? > > > Code athttp://bitbucket.org/tebeka/shootout-clj/src/tip/fannkuch.clj > > > All the best, > > -- > > Miki > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en