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: Jaroslav Hajek
Subject: Re: Efficient code for operating on pairwise vector diffs
Date: Sun, 8 Nov 2009 21:14:52 +0100

On Wed, Nov 4, 2009 at 9:01 PM, Joseph Wakeling
<address@hidden> wrote:
> 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.
>

Hi,
sorry for the late reply. For an OctaveForge file, I think you should
write an Octave-like inline docstring. Error checks (number&type of
arguments) would also be nice. The dim argument also sounds good.
If you target just Octave, the exist("bsxfun") check is pretty unnecessary.

hth

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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