bugGNU Octave - Bugs: bug #48025, io package: read_namelist fails...

 
 

bug #48025: io package: read_namelist fails for complex values

Submitted by:  ryusuke numata <rnumata>
Submitted on:  Thu 26 May 2016 11:33:47 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Philip Nienhuis <philipnienhuis>
Originator Name: Open/Closed: Closed
Release: otherOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 19 Jun 2016 09:42:18 PM UTC, comment #4:

I applied your patch and pushed here:
http://hg.code.sf.net/p/octave/io/rev/fb1d6b365205

Next I cleaned up read_namelist.m and write_namelist.m into Octave coding style, added copyright dates and added your example as a test to read_namelist.m.
I fixed the conversion errors by changing the variables nmlst_bdy and line, if empty, into "" (rather than a numeric []0x0 ).

Thanks very much for your contribution.

Closing report.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Sun 29 May 2016 07:16:06 AM UTC, comment #3:

Philip,

Thanks, please do.

In addition to the reported error, write_namelist gives implicit conversion warning only in version >=4 at line 105. It is great if you fix this at the same time. Maybe you can do

-- ryusuke (is my first name)

ryusuke numata <rnumata>
Sat 28 May 2016 08:07:33 PM UTC, comment #2:

ryusuke (is that your first name?),

The namelist() I/O functions aren't my code (they were contributed) and I don't use them myself; as far as I could see with my rusty FORTRAN skills your patches won't harm other functionality.

I tend to accept your patch more or less verbatim, apart from maybe some style fixes, and credit you.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 26 May 2016 07:51:44 PM UTC, comment #1:

Thanks, I'll have a look.

OS -> any
Release -> other

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 26 May 2016 11:33:47 AM UTC, original submission:

read_namelist and write_namelist in io are the function to read and write Fortran namelist. When reading complex numbers read_namelist gives a syntax error, and when writing write_namelist writes just real parts.

namelist_test.in and namelist_test.m are the sample to reproduce the problem.

A complex value in namelist consists of a pair of parentheses surrounding the real and imaginary parts, separated by a comma. I've written a code to handle this as given in the attached patch. I don't think it'a good code, but at least it works for the test case.

ryusuke numata <rnumata>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #37272:  patch.io added by rnumata (1KiB - application/octet-stream)
file #37273:  namelist_test.m added by rnumata (93B - application/octet-stream)
file #37274:  namelist_test.in added by rnumata (80B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by rnumata (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 19 Jun 2016 09:42:18 PM UTCphilipnienhuisStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 26 May 2016 07:51:44 PM UTCphilipnienhuisAssigned toNone=>philipnienhuis
      Release4.0.2=>other
      Operating SystemMac OS=>Any
    Thu 26 May 2016 04:56:48 PM UTCmtmillerSummaryread_namelist fails for complex values=>io package: read_namelist fails for complex values
    Thu 26 May 2016 11:33:47 AM UTCrnumataAttached File-=>Added patch.io, #37272
      Attached File-=>Added namelist_test.m, #37273
      Attached File-=>Added namelist_test.in, #37274

    Back to the top


    Powered by Savane 3.1-cleanup1