octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex


From: Michael Godfrey
Subject: [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex
Date: Wed, 05 Jan 2011 06:16:39 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.6.13-1.fc14 Firefox/3.6.13

URL:
  <http://savannah.gnu.org/bugs/?32053>

                 Summary: matlab/Octave differences for complex
                 Project: GNU Octave
            Submitted by: godfrey
            Submitted on: Wed 05 Jan 2011 06:16:38 AM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Improvement/Optimization
                  Status: None
             Assigned to: None
         Originator Name: godfrey
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

There are differences between matlab (R2009b) and Octave for
complex variables:

Octave:
octave:18> cc =  complex (zeros(2,2), zeros(2,2))
cc =

   0 + 0i   0 + 0i
   0 + 0i   0 + 0i
octave:20> cc(1,1)
ans = 0
octave:25> whos('cc')
Variables in the current scope:

  Attr Name        Size                     Bytes  Class
  ==== ====        ====                     =====  ===== 
       cc          2x2                         64  double

Total is 4 elements using 64 bytes
===========================================
Matlab:
 cc =  complex (zeros(2,2), zeros(2,2))  

cc =

     0     0
     0     0
 cc(1,1)

ans =

     0
 whos('cc')
  Name      Size            Bytes  Class     Attributes

  cc        2x2                64  double    complex   

================================================

Both can be comfusing:
1. cc(1,1)  answer appears to indicate double not complex
   for both Octave and Matlab.

2. cc       answer for Octave seems best. Matlab seems
            to indicate double.

Note: the cases above apply only is the imaginary part is
      zero.

Output of who('cc') is better from Matlab. The 'attribute'
column is useful, particularly since if the imaginary parts are
all zero the variable appears to be double.

It is not clear how to deal with compatibility in the case.
The "best" change would be to make cc(1,1) show 0 + 0i,
as it does for cc even though matlab does not do this,
and add the correct Attribute column for whos('cc').

If this does not pass the compatibility test, at least make
some changes to make it clearer that a complex variable
with zero value for the imaginary part is actually complex.

This is partly just to have the Matlab/Octave differences
recorded in case this issue comes up again.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32053>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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