help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient code for operating on pairwise vector diffs


From: Joseph Wakeling
Subject: Re: Efficient code for operating on pairwise vector diffs
Date: Wed, 04 Nov 2009 21:01:11 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Jaroslav Hajek wrote:
> Code is always better if you want good answers. You can only extract a
> small (but working!) skeleton. Unless your co-workers are idiots, they
> won't bark at you for showing a few lines, especially if you're trying
> to improve your common work.

Further to previous comments -- I wound up implementing pairwisediff()
as a function in its own right (attached).  This actually uses both your
suggested solutions: the version of MATLAB I was using to test MATLAB
compatibility didn't have bsxfun included, so I put in place this check
to use either bsxfun or the alternative.

Looking at this it occurs to me that it would be very easy to modify it
to allow pairwise diffs of either rows or columns (just add a DIM
parameter), and that it would make a nice addition to octave-forge.
This particular code has bugger-all to do with any academic worries, and
could be useful for a lot of people, so would be interested on having
comments on what needs to be added to it to make it a worthwhile submission.

Thanks & best wishes,

    -- Joe

Attachment: pairwisediff.m
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]