[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54622] test importdata fails in dev octave wi
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows |
Date: |
Tue, 11 Sep 2018 17:16:58 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0 |
Follow-up Comment #61, bug #54622 (project octave):
The parser has its own rules. See this ancient bug report from 2010
(https://savannah.gnu.org/bugs/?31974). There has been no resolution there.
isalpha is better than tolower because it is checking for a positive
assertion. The default, when given bizarre input such as EOF, will be return
false.
You are correct that '1+j' does not read correctly. The issue is in dlmread
in the final else clause
else
{
double y = octave_read_double (tmp_stream);
if (! iscmplx && y != 0.)
{
iscmplx = true;
cdata = ComplexMatrix (rdata);
}
if (iscmplx)
cdata(i,j++) = Complex (x, y);
else
rdata(i,j++) = x;
}
For a construct like '1+2j' we have already read '1', and determined that the
next character ('+') is not a complex number indicator [iIjJ]. We have also
determined that it is not an alpha character and hence a corrupt text such as
"InfX". So we pass the result to octave_read_double which would read "+2j"
and return 2. That gets made in to a Complex value with the original number
in x and stored. However, for '1+j', octave_read_double() returns 0 (default)
because there is no number in '+j'.
This is definitely a corner case. If there is an easy way to fix it we
should. Otherwise, I wouldn't spend to much time on it. Matlab's dlmread
function is very specific about the format it accepts for complex numbers
dlmread imports any complex number as a whole into a complex numeric field.
This table shows valid forms for a complex number.
Form Example
±<real>±<imag>i|j 5.7-3.1i
±<imag>i|j -7j
Embedded white space in a complex number is invalid and dlmread regards it as
a field delimiter.
Octave can at least handle whitespace like "1 + 2j".
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54622>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, (continued)
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, John Donoghue, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, John Donoghue, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Rik, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, John Donoghue, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Rik, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows,
Rik <=
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Rik, 2018/09/11
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/12
- [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows, Dan Sebald, 2018/09/12