bugGNU Octave - Bugs: bug #31491, save produces unloadable output...

 
 

bug #31491: save produces unloadable output for nested anonymous functions

Submitter:  None
Submitted:  Fri 29 Oct 2010 01:25:38 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Brandon Bensel Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.4
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 10 Nov 2010 09:10:54 AM UTC, comment #4: 

I checked in the following change:

  http://hg.savannah.gnu.org/hgweb/octave/rev/64e7538db12a

This seems to fix the problem for me, so I'm closing this report.

John W. Eaton <jwe>
Group administrator
Fri 29 Oct 2010 04:36:47 PM UTC, comment #3: 

This is confirmed on a recent tip (2010-10-29).  The bug seems to be the parsing of the comma, which can ordinarily be a break between statements.  In this case, the comma is separating arguments in a function call but it appears that the parser for printing out the function has gotten confused. 

Below is a slightly simpler example to show the problem.

f1 = @(x1,x2) x1+x2;
f2 = @(y1,y2) arrayfun ( @(z) f1(y1, z) , y2)
f2 =

@(y1, y2) arrayfun (@(z) f1 (y1, z);
, y2)


Rik <rik5>
Group administrator
Fri 29 Oct 2010 02:25:07 AM UTC, comment #2: 


> c = @(f, T, n, t) (1/T)*trapz(t, f(t).*exp(-j.*2.*pi./T.*n.*t))
> four = @(f, T, n, t) sum(arrayfun(@(N) c(f, T, N, linspace(0, T,
100)).*exp(j*2*pi/T*N*t), [-n:n]))
> afour = @(f, T, N, t) arrayfun(@(x) four(f, T, N, x), t)
> save fourier



Anonymous
Fri 29 Oct 2010 01:49:38 AM UTC, comment #1: 

The bug report environment uses markup text and the multiplication symbols in your submitted example have disappeared and been replaced by bolded text.

Could you re-post your sample function and use the '+verbatim+' and '-verbatim-' keywords to outline your code?  A reference for verbatim is here: https://savannah.gnu.org/cookbook/?func=detailitem&item_id=125

Rik <rik5>
Group administrator
Fri 29 Oct 2010 01:25:38 AM UTC, original submission:  


> c = @(f, T, n, t) (1/T)*trapz(t, f(t).*exp(-j.*2.*pi./T.*n.*t))
> four = @(f, T, n, t) sum(arrayfun(@(N) c(f, T, N, linspace(0, T, 100)).*exp(j*2*pi/T*N*t), [-n:n]))
> afour = @(f, T, N, t) arrayfun(@(x) four(f, T, N, x), t)
> save fourier


The printed representation of four/afour is incorrect, for instance:

afour =

@(f, T, N, t) arrayfun (@(x) four (f, T, N, x);
, t)

This of course prohibits loading the file; the file will only load after manual correction to the entries for four/afour.

octave:1> load fourier
parse error:

  syntax error

>>> @(f, T, N, t) arrayfun (@(x) four (f, T, N, x);


Attached is the file "fourier" produced by the command "save fourier".

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #21854:  fourier added by None (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-11-10 jwe StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2010-10-29 rik5 StatusNeed Info Confirmed
    2010-10-29 rik5 StatusNone Need Info
    2010-10-29 None Attached File- Added fourier, #21854

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code