I have created a PDL matrix. I need to do a pairwise comparison between each row. Currently I am using the 'where' and 'cov' command to return the pairwise comparison for two slices (generated in a perl loop).
My question: How can I use 'range' and 'slice' to loop over the rows in a pairwise fashion? How can I return my index position? I have looped over the matrix using perl. I have read that looping with perl really cripples the power of PDL.
Desired output:
indexA indexB Value
pos1 pos5 1
pos1 pos6 5
pos1 pos0 7
To be clear I only want to use PDL functionality.
Here is some pseudo code that will (hopeful) illustrate my point better.
p $b
[
[1 0 3 0]
[0 1 0 1]
[1 3 1 3] <- example piddle y
[0 1 0 1] <- example piddle z
]
my concept function{
slice $b (grab row z) - works fine
slice $b (grab row y) - works fine
($a, $b) = where($a,$b, $a < 3 && $b < 3 ) - works fine
p $a [1 1]
p $b [0 0]
cov($a $b) - works just fine.
}
I just need a way to execute pairwise across all rows. I will need to do factorial(n rows) comparisons.