[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52953] reshaping "complex(0, 0)" should not m
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #52953] reshaping "complex(0, 0)" should not make it real |
Date: |
Mon, 22 Jan 2018 21:33:26 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #2, bug #52953 (project octave):
@Colin: For a good overview, see bug #52919.
Generally Octave takes the opportunity to narrow (read convert) complex arrays
to real arrays whenever it can because complex arrays require double the
storage.
As an example,
octave:7> x = complex (2,0)
x = 2 + 0i
octave:8> y = x(1)
y = 2
octave:9> y = x + 0
y = 2
In this case, I think using ':' is equivalent to indexing and so Octave has
the opportunity to narrow the result. I'm surprised that the reshape()
function, however, changes the storage class from complex to real.
Which version of Matlab did you use to verify that ':' and reshape don't
change complex results? Also, what happens if you use an intermediate
variable rather than a single expression?
x = complex (0,0)
y = x(:)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52953>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/