Help testing max() function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help testing max() function

Rik-4
All,

During OctConf 2014 I started trying to improve the line coverage on the
file max.cc and have come across all sorts of issues.  Could someone test
the following code in Matlab to see how they order arguments with equal
magnitude, but different phase angle.  Octave should order results by phase
angle, but sometimes it doesn't.

max ([2, 2i])
max (sparse ([2, 2i])
max (2, 2i)
sort ([1 i -1 -i].', 'ascend')
sort ([1 i -1 -i]', 'ascend')

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Help testing max() function

Julien Bect
Le 25/09/2014 20:25, Rik a écrit :

> During OctConf 2014 I started trying to improve the line coverage on the
> file max.cc and have come across all sorts of issues.  Could someone test
> the following code in Matlab to see how they order arguments with equal
> magnitude, but different phase angle.  Octave should order results by phase
> angle, but sometimes it doesn't.
>
> max ([2, 2i])
> max (sparse ([2, 2i])
> max (2, 2i)
> sort ([1 i -1 -i].', 'ascend')
> sort ([1 i -1 -i]', 'ascend')

Hello Rik,

Here it is (R2012a) :

 >> max ([2, 2i])

ans =

         0 + 2.0000i

 >> max (sparse ([2, 2i]))

ans =

    (1,1)           0 + 2.0000i

 >> max (2, 2i)

ans =

         0 + 2.0000i

 >> sort ([1 i -1 -i].', 'ascend')

ans =

         0 - 1.0000i
    1.0000
         0 + 1.0000i
   -1.0000

 >> sort ([1 i -1 -i]', 'ascend')

ans =

         0 - 1.0000i
    1.0000
         0 + 1.0000i
   -1.0000


@++
Julien


Reply | Threaded
Open this post in threaded view
|

Re: Help testing max() function

steph
In reply to this post by Rik-4

Results on Win 7 R2014a

 >> max ([2, 2i])

ans =

    0.0000 + 2.0000i

 >> max (sparse ([2, 2i])
  max (sparse ([2, 2i])
                       |
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

 >> max (sparse ([2, 2i]))

ans =

    (1,1)      0.0000 + 2.0000i

 >> sort ([1 i -1 -i].', 'ascend')

ans =

    0.0000 - 1.0000i
    1.0000 + 0.0000i
    0.0000 + 1.0000i
   -1.0000 + 0.0000i

 >> sort ([1 i -1 -i]', 'ascend')

ans =

    0.0000 - 1.0000i
    1.0000 + 0.0000i
    0.0000 + 1.0000i
   -1.0000 + 0.0000i

 >>