Problems? Is your data what you think it is? PerlMonks

### Comment on

 Need Help??
there are so many ways to skin this cat I'm surprised people worry about the issue of column/row operations in PDL.

The problem is not "can it be done with PDL", more "do you gain anything by using PDL to do it"? Ie. Is it more efficient?

This iterates through all the row and column permutations of a 10x10 matrix in 82 seconds:

```#! perl -slw
use strict;
use Data::Dump qw[ pp ];
use Time::HiRes qw[ time ]; #\$Data::Dump::WIDTH = 1000;
use Algorithm::Combinatorics qw[ permutations ];

my @a = map[ 10 *\$_ .. 10 *\$_ + 9 ], 0 .. 9;

## rows
my \$start = time;

my \$perms = permutations( [ 0 .. 9 ] );
while( my \$p = \$perms->next ) {
my @perm = @a[ @\$p ];
}

printf "All row permutations took %f seconds\n", time - \$start;

## cols
\$start = time;

\$perms = permutations( [ 0 .. 9 ] );
while( my \$p = \$perms->next ) {
my @perm = map[ @{\$_}[ @\$p ] ], @a;
}

printf "All column permutations took %f seconds\n", time - \$start;

__END__
C:\test>PermsMatrix.pl
All row permutations took 17.198000 seconds
All column permutations took 65.284842 seconds
[download]```

The OP mentioned matrices of "hundreds x hundreds".

As I understand the brute force algorithm for the Subgraph Isomorphism Problem, it requires performing all the row permutations for all the column permutations of the smaller of the two adjacency matrix graphs for every equal sized subgraph of the larger adjacency matrix. Ullmann trims the tree somewhat, but essentially still requires many of the iterations and all the transformations to be performed.

I've no doubts that this can be done with PDL; I just wonder if you gain much performance?

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Please read these before you post! —
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.
• Log In?
 Username: Password:

What's my password?
Create A New User
Chatterbox?
 [Corion]: margeas: I'll look at renaming you ;) [markong]: ahah thanks Corion :) [Eily]: Discipulus usually it's while testing that you want the full logs :) [Eily]: anyway, maybe you can ignore STDERR ? (I'm not sure about @CARP_NOT, it looks like it only changes the place the error comes from) [markong]: " Perl: the Markov chain saw" :D aha [Discipulus]: thanks 1nickt but seems i'm not able to use it correctly...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2018-01-22 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How did you see in the new year?

Results (233 votes). Check out past polls.

Notices?