Re: libcerf function voigt_hwhm not suitable for external use

Joachim Wuttke <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
Dear Ethan,

thank you very much for the kind mail you wrote me more than a year ago.

Today, finally, I looked into the issue.  I wrote a new test that computes
voigt_hwhm for 100'000 different ratios gamma/sigma.  As expected, the Newton
algorithm did not fail a single time.  The deviation of the final result from
the initial estimate is always smaller then 1E-2.  The cases I had guarded
with messages to stderr and an exit statement will never happen.  Therefore
I converted them to assert statements.  These improvements are available
in the freshly released v1.15.

Sorry for not answering earlier.

Kind greetings, Joachim



On 25/02/2020 20.03, Ethan A Merritt wrote:
> In response to a gnuplot feature request, I added a wrapper in
> gnuplot to find the width of the Voight profile by calling libcerf function
> voigt_hwhm().
> 
> However on further evaluation this has turned out to be problematic.
> The current libcerf source for this function deals badly with out-of-range
> input.  It prints to stderr (problematic by itself) and then either
> - returns an incorrect value
> - calls exit(-1)
> 
> A call to exit() from a library routine is almost never a good thing to 
do,
> since it prevents error-handling and possible recovery by the calling
> program.  Limiting error reporting to a message on stderr also prevents
> detection and recovery by the calling program.
> 
> I suggest that it would be preferable to return NaN whenever the
> input is out of range or the function does not converge.
> 
> Alternatively libcerf could provide an error-check routine or status variable,
> but then you would run into issues of thread-safety and so on.
> 
> I am hoping that the libcerf function can be improved in a subsequent
> version, but for now I will consider implementing equivalent code
> directly in gnuplot.
> 
> 	Ethan
> 
>

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
smime.p7s (application/pkcs7-signature, 5.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.