[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex |
Date: |
Wed, 05 Jan 2011 18:47:21 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101028 Iceweasel/3.5.15 (like Firefox/3.5.15) |
Follow-up Comment #3, bug #32053 (project octave):
"I understand that cc and cc(1) are real elements of
a complex array. But, they are allocated storage as if
they were complex (a good thing, of course). "
When you do
complex (1, 0)
you create a complex object (real and imaginary parts both allocated). But
when you write cc(1), the result is subject to a narrowing conversion, so if
the imaginary part is zero, it is discarded and the result is real and the
imaginary part is no longer allocated. That's what isreal is telling you,
since it tests whether the complex part is allocated, not whether the
imaginary part is zero. Is that behavior different in Matlab?
The one strange thing is this part:
octave:26> zz(1) = complex(1,0*j)
zz = 1
octave:27> isreal(zz)
ans = 1
but I think this happens because the narrowing conversion is applied on
assignment. Is this behavior different in Matlab?
The only differences that I see are that Matlab doesn't print the zero
imaginary parts (something I don't think we should copy) and it shows
"complex" as an attributed in the output of whos.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?32053>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Michael Godfrey, 2011/01/05
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, John W. Eaton, 2011/01/05
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Michael Godfrey, 2011/01/05
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex,
John W. Eaton <=
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Michael Godfrey, 2011/01/06
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, John W. Eaton, 2011/01/06
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Michael Godfrey, 2011/01/06
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Jaroslav Hajek, 2011/01/09
- [Octave-bug-tracker] [bug #32053] matlab/Octave differences for complex, Michael Godfrey, 2011/01/09
- [Octave-bug-tracker] Re: [bug #32053] matlab/Octave differences for complex, Jaroslav Hajek, 2011/01/11