in reply to Re: counting instances of one array in another array
in thread counting instances of one array in another array
Thank you for this approach! This is about 10x faster than the next best approach that was suggested here that I tried implementing (which was this code from an AnonymousMonk):
my %seen; $seen{$_}++ for @observed; @permCounts = map { $seen{$_} || 0 } @perms;
This is good enough to get me going, but I will follow the other advice that was offered and learn about fleximal, PDL::Sparse, and hash-fu. I am very grateful for the generous advice from all of you!
best,
jim
ps -- Slight tweak: abc=(0,1,2), and then 0+(1*26^1)+(2*26^2), etc. (i.e., a=0, z=25, and when string position > 0 you multiply the index of the character in that position by 26 raised to the power of the position).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: counting instances of one array in another array
by MidLifeXis (Monsignor) on Feb 24, 2012 at 13:53 UTC |