ugh, not really. (also make sure to cc the list on your replies). Too many
$b's floating around, and no clue what $a is in your concept function. I think
it is one of your slices there? How about this:
pdl> use PDL::Stats
pdl> p $input
[
[1 0 3 0]
[0 1 0 1]
[1 3 1 3]
[0 1 0 1]
]
pdl> for $i(0..$input->dim(1)-1){
$y = $input(:,($i));
for $j(0..$input->dim(1)-1){
$z = $input(:,($j));
($a,$b) = where($y,$z,($y<3) & ($z<3));
$c = cov($a,$b);
print "$i, $j: $c\n";
}
}
0, 0: 0.222222222222222
0, 1: -0.222222222222222
0, 2: 0
0, 3: -0.222222222222222
1, 0: -0.222222222222222
1, 1: 0.25
1, 2: 0
1, 3: 0.25
2, 0: 0
2, 1: 0
2, 2: 0
2, 3: 0
3, 0: -0.222222222222222
3, 1: 0.25
3, 2: 0
3, 3: 0.25
Is that what you are trying to get, but without the two for loops?
Derek
On Dec 22, 2011, at 11:34 AM, zev wrote:
> http://stackoverflow.com/questions/8595244/pdl-pairwise-row-comparison
>
> On Thu, Dec 22, 2011 at 11:30 AM, zev <[email protected]> wrote:
> Thank you for your help.
>
>
> Here is some sudo 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.
>
>
>
> --
> Zev Kronenberg
> Graduate Student
> University of Utah
> phone: 208-629-6224
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl