octave-maintainers
[Top][All Lists]
Advanced

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

intersect - rows - bug


From: Levente Torok
Subject: intersect - rows - bug
Date: Fri, 19 Sep 2008 20:22:17 +0200
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

Hi All,

I found a bug in the new intersect implementation. (I did the same in my code, 
too).

octave:63> a
a =

   3   3

octave:64> b
b =

   1   1
   2   2
   3   3
   4   4

octave:65> [I,ili,iri] = intersect( a(:,1), b(:,1) )
I =  3
ili =  1
iri =  3

which is correct, however

octave:66> [I,ili,iri] = intersect_jaroslav( a,b, 'rows' )
I =

   3   3

ili =  1
iri =  2

which is not correct.

The reason is in intersect.m line #71:

    if (nargout > 1)
      ia = ja(ic(ii));                  ## a(ia) == c
      ib = jb(ic(ii+1) - length (a));   ## b(ib) == c      
    endif

Here the "length(a)" doest not work for the case of 'rows'.
In this case it should be replaced by size( a, 1 ).


Levente

-- 
Blogger of http://fapuma.blogspot.com


reply via email to

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