Well, nothing dedicated -- but it's a trivial application of the threading
engine:
$npp = $np->(:,:,*1) - $np->(:,*1,:);
Here, "*1" inserts a dummy dimension, so you're comparing an NxPx1 matrix with
an Nx1xP array -- giving (by the threading rules) an NxPxP output.
Incidentally, if you just want a PxP matrix of distances, you just collapse:
$ppdist = ( $npp * $npp ) -> sumover -> sqrt;
Cheers,
Craig
On Sep 22, 2011, at 9:08 AM, vividsnow wrote:
> Hello, everyone!
>
> I have a (N, P) matrix which represents coordinates of P points in N-d space.
> Is there single function which creates (N, P, P) matrix which represents
> coordinate difference between each point?
>
> Best regards
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl