Skip to main content
22 events
when toggle format what by license comment
Jul 16, 2015 at 12:43 comment added LLlAMnYP @ciao after much staring at your construct I have managed to recreate it using Function[{...}... rather than using With with symbols replaced by slots (I find the named-argument approach somewhat easier to follow). I've still created chat room and will be around for the next several hours if you find the time to discuss performance issues.
Jul 15, 2015 at 23:51 comment added ciao @LLlAMnYP: Sure... start one, I'll look for it when I get to lounge.
Jul 15, 2015 at 11:23 comment added LLlAMnYP @ciao Thanks for your effort with explaining, however it was the work of what's inside Fold I had the most trouble understanding from a programmer's viewpoint, algorithmically, your approach is not too different from mine. Maybe we can find time to chat around European evening(?)
Jul 15, 2015 at 4:27 comment added ciao @Mr.Wizard: Try, e.g., FindPermutation[#] & /@ Flatten /@ xformLst[Range@6, genIdx@6]. Nothing jumps out at me as an "a-ha! I can generate that efficiently...", perhaps you'll spy something that eludes me.
Jul 15, 2015 at 4:20 comment added ciao @Mr.Wizard - interesting thought - I'd not considered that. Easy to show the "not" is false - by definition, each member of the results (that is each set, each flattened) is a permutation of the list, or a product of permutations. The question becomes "is the some pattern of cycles we can generate and apply quickly...". I must ponder...
Jul 15, 2015 at 2:20 comment added Mr.Wizard @ciao I'll try to be. In case not I just wanted your help understanding if Cycles and PermutationGroup could be applied to this problem, and if not if there is an easy to understand proof.
Jul 15, 2015 at 2:14 comment added ciao @Mr.Wizard mobile, so no, but will be at cigar lounge in hour or so, happy to then if you're around...
Jul 15, 2015 at 2:05 comment added Mr.Wizard @ciao Do you have time to chat?
Jul 15, 2015 at 0:28 comment added ciao @LLlAMnYP - done
Jul 15, 2015 at 0:28 history edited ciao CC BY-SA 3.0
Added explanation
Jul 14, 2015 at 23:56 comment added LLlAMnYP @ciao If it's not too much trouble, I'd love to see that. Perhaps the most confusing is keeping track of the Slots scoped by With. I'm also curious as to why use Subsets rather than some {1,#}&/@... I suppose it's just you thinking on generalizing this code to other partitions.
Jul 14, 2015 at 23:32 comment added ciao @LLlAMnYP: If you'd like, I can add explanation for genIdx - though I'll have to re-read it and figure it out - it was cowboy-coded and spewed out as I thought of it while lounging... I'd venture the pattern matching and prepending is the main difference.
Jul 14, 2015 at 23:23 comment added LLlAMnYP @ciao as far as Map goes, one can then do idxN = Flatten@function@Range@length and subsequently apply xformLst. The way I see it, it is the efficiency of genIdx in itself that is the breakthrough. I'm still staring at it, trying to figure out how it works and why it is so much faster (and also why my approach is so much slower).
Jul 14, 2015 at 22:35 comment added ciao @LLlAMnYP - that much should be self-evident, just as it should be that the other methods are vastly less efficient at producing said indices, and using Map is a terribly inefficient way to do the second piece.... I'd invite you to take your fastest, use it to work on a list of say length 20, followed by your mapping comment, and time it. Then time the above....
Jul 14, 2015 at 12:49 comment added LLlAMnYP However, the prime benefit is amortization of time over multiple lists to be transformed IMO, this can be done with any of the functions on offer here, by supplying them with a list idxN = function[Range[length]] to partition, then doing Map[list[[#]]&,idxN,{2}]
Jul 14, 2015 at 11:48 comment added LLlAMnYP I like the use of ArrayReshape (an alternative would be nested Partitions). +1. Similarly, e.g. Fold[Partition, genIdx[l], {2, l/2}]
Jul 14, 2015 at 7:49 comment added ciao @Mr.Wizard: Glad you find it interesting - there's performance left in there, and if I get the hankering, I might tweak it, pretty it up, and extend it to arbitrary set sizes (there's a pretty relationship with figurate numbers and the cut-offs for taking the subsets buried here). As for wiki? Part of not giving a poop about "rep".
Jul 14, 2015 at 5:03 comment added Mr.Wizard By the way how is posting something like this as a community wiki helping to improve the admittedly problematic "reputation" system? If you feel your generous bounties improve justice do you not want to build the points necessary to continue them?
Jul 14, 2015 at 5:01 comment added Mr.Wizard Wow, much faster than what I posted. Sometimes it's really not a good idea to force an old solution to fit a new problem. :-/
Jul 14, 2015 at 4:38 history edited ciao CC BY-SA 3.0
typo
S Jul 14, 2015 at 3:31 history answered ciao CC BY-SA 3.0
S Jul 14, 2015 at 3:31 history made wiki Post Made Community Wiki by ciao