mode returns a wrong answer for row vectors

David Bateman David.Bateman at motorola.com
Mon Mar 17 04:51:24 CDT 2008


David Bateman wrote:
> David Bateman wrote:
>
>   
>> However, while looking at the way this failed, it points to another
>> issue. Consider the indexing case
>>
>> t = ones(3,3,3);
>> t(:,4)
>> t(true(3,1),4)
>>
>> which with both Octave 3.1.x and MatlabR2007b return [1;1;1], where as
>>
>> t(false(3,1),4)
>> t([],4)
>>
>> both return a 0-by-1 matrix in MatlabR2007b, but fail with an indexing
>> error in Octave. My solution to this was to use the short_freeze
>> indexing function even if one of the indices are empty. Is there a
>> reason not to do this?
>>
>>     
>
> Ok, I can see why. If the trailing dimension is empty, my patch can't
> work. Alternative fix attached..
>
> D.
>   
and yet a third version as this really should include some tests to
avoid a reversion..

D.


-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch7709
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080317/83f20f43/attachment-0001.ksh 


More information about the Bug-octave mailing list