bugGNU Octave - Bugs: bug #42528, textscan: complex numbers are...

 
 

bug #42528: textscan: complex numbers are incorrectly processed when format is empty

Submitted by:  sergey plotnikov <nul0m>
Submitted on:  Mon 09 Jun 2014 09:57:07 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sat 25 Apr 2015 05:46:50 AM UTC, comment #7:

The patch was applied a long time ago back in 2014. This bug is fixed. Closing report.

Rik <rik5>
Project Administrator
Fri 04 Jul 2014 12:57:39 PM UTC, comment #6:

Better cs attached (commit message adapted)

(file #31673)

Philip Nienhuis <philipnienhuis>
Project Member
Sun 15 Jun 2014 09:22:29 PM UTC, comment #5:

Thanks for suggestion!

Attached is a changeset (I found some time during train delays).

(file #31559)

Philip Nienhuis <philipnienhuis>
Project Member
Thu 12 Jun 2014 02:20:11 PM UTC, comment #4:

Why not use the transpose operator (.') instead?

John W. Eaton <jwe>
Project Administrator
Wed 11 Jun 2014 09:04:26 PM UTC, comment #3:

I had a brief look:

The culprit is a matrix transpose operator that also invokes the complex transpose (as per the definition of the transpose operator BTW, see the docs).

Quick & dirty fix: replace L. 332:
C(1) = reshape (C{1}, ncols, numel (C{1}) / ncols)';
by
C(1) = conj (reshape (C{1}, ncols, numel (C{1}) / ncols))';

textscan passes all tests then, but I'm not sure yet whether this is a reliable fix. More investigation is needed for other data types - but I have not time for that now.

Note that Matlab doesn't accept "textscan ('1i')" (it complains about a missing format string).

Philip Nienhuis <philipnienhuis>
Project Member
Mon 09 Jun 2014 07:31:29 PM UTC, comment #2:

Hmmm well just one thing: strread.m (textscan's workhorse-behind-the-scenes) does it right. That's at least a clue.:

Philip Nienhuis <philipnienhuis>
Project Member
Mon 09 Jun 2014 07:28:49 PM UTC, comment #1:

Confirmed.

I'll look into it, but the next weeks I'll have almost no time for Octave stuff. Maybe someone will beat me to it.

Thanks for reporting

Philip Nienhuis <philipnienhuis>
Project Member
Mon 09 Jun 2014 09:57:07 AM UTC, original submission:

Transpose at around line 332 of textscan.m transforms complex numbers to their complex conjugates, which may cause weird results (see below).

sergey plotnikov <nul0m>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31673:  bug42528_v2.cs added by philipnienhuis (1KiB - text/x-csharp)
file #31559:  textscan_bug42528.cs added by philipnienhuis (1KiB - text/x-csharp)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by nul0m (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 25 Apr 2015 05:46:50 AM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Fri 04 Jul 2014 12:57:39 PM UTCphilipnienhuisAttached File-=>Added bug42528_v2.cs, #31673
    Sun 15 Jun 2014 09:22:29 PM UTCphilipnienhuisAttached File-=>Added textscan_bug42528.cs, #31559
      StatusConfirmed=>Patch Submitted
    Mon 09 Jun 2014 07:28:49 PM UTCphilipnienhuisStatusNone=>Confirmed
      Operating SystemGNU/Linux=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1