#264 status message from gslmroot_fsolver

closed-accepted
nobody
other (94)
5
2011-04-27
2011-04-12
Joel Berger
No

In PDL::GSL::MROOT and specifically in Lib/GSL/MROOT/FUNC.c function "fsolver" (if I understand the source tree correctly) the status of the solver routine is printf'ed rather than returned in some useful way. If the message was carp'ed for example then one could trap it and use it, i.e. $SIG{__WARN__} = sub{warn $_[0] unless $_[0]=~/success/}. As it is I get lots of output that I cannot suppress when successful or use when unsuccessful.

The offending line is line 209 from http://pdl.git.sourceforge.net/git/gitweb.cgi?p=pdl/pdl;a=blob;f=Lib/GSL/MROOT/FUNC.c;h=2f525f913bfa55a3201354d9cb8b2606b8e981e4;hb=HEAD

printf ("Final status = %s\n", gsl_strerror (status));

If I knew C/diff/perl internals better I would make a patch for you, but sadly I'm not that far yet.

Thanks

Discussion

  • Chris Marshall

    Chris Marshall - 2011-04-12

    I'm not familiar with the details of the GSL MROOT solver.

    If you could generate a simple exmple to demonstrate the
    current performance and then show what the improved
    performance should be that would help. Maybe a comparison
    with the Math::GSL::Multiroots or Math::GSL::Roots implementations
    could suggest an approach....

    --Chris

     
  • Joel Berger

    Joel Berger - 2011-04-13

    Thanks for the reply. I have attached an example. The message that is seen before the result is the message in question. I also attaching an untested patch (again, I am learning this as I go, so please be sure that this works before committing it). In my patch I change two things: 1) it does not warn on on success 2) calls warn rather than printf. The perldoc perlapi says that warn can be used like printf so I hope that my syntax was correct.

     
  • Joel Berger

    Joel Berger - 2011-04-13

    Example of current and desired (commented) performance

     
  • Joel Berger

    Joel Berger - 2011-04-13

    I have submitted a more clear example of current performance. Further it now includes (commented out) examples of how the desired behavior would be better.

    I can also add that part of my desire to see this behavior changed is that I loop over this function, possibly hundreds of times, giving me hundreds of lines telling me that "something worked" before I see an answer.

    The package Math::GSL::Multiroots is not actually implemented yet and as both are made with SWIG I am finding it harder to read. Still I can say that I think my patch shows the more Perl-ish behavior. One might even want to set $! to the error code as well.

     
  • Chris Marshall

    Chris Marshall - 2011-04-13

    Thanks for the patch and for working with me to
    understand the problem. It will be included in
    the next CPAN Developers release or you can
    get it directly from our git repository. Marking
    this Pending to close in a couple of weeks unless
    another update in status occurs before then...

     
  • Chris Marshall

    Chris Marshall - 2011-04-13

    Bug fixed in Git.
    Thanks for reporting the problem!

     
  • Chris Marshall

    Chris Marshall - 2011-04-13
    • labels: 101696 --> other
    • status: open --> pending-accepted
     
  • SourceForge Robot

    • status: pending-accepted --> closed-accepted
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks