Re: [OctDev] complex error function

2012-11-21 Thread Steven G. Johnson
On 11/20/12 5:54 PM, Michael D. Godfrey wrote:
 Also keep in mind that this will need to be compatible with
 the Matlab complex erf(z).

The Matlab erf function does not support complex arguments:

 http://www.mathworks.com/help/matlab/ref/erf.html

(There are several complex erf implementations in the Matlab Central 
repository.)

However, any erf(z) for complex arguments will be compatible with my 
implementation because the extension to the complex plane is unique. 
(erf is an analytic function in the entire complex plane.)

--SGJ


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-20 Thread Jordi Gutiérrez Hermoso
On 4 November 2012 00:34, Steven G. Johnson stev...@alum.mit.edu wrote:
 There is an updated version of my package
 (http://ab-initio.mit.edu/Faddeeva) which computes not only the Faddeeva
 function (the scaled complex error function) but also the ordinary erf
 and erfc functions of complex arguments, as well as the erfcx and erfi
 variants and the Dawson function (a scaled erfi).

 This should make it relatively painless to drop it in as a replacement
 for the Octave erf and erfc functions in order to support complex arguments.

I'm still not sure what to do with this code... It sounds useful,
sure, but you didn't write it for Octave except for a small wrapper.
Since you're trying to overwrite Octave functions, it should go in
Octave core but you also want to provide a bunch of other special
functions, so those should go in the specfun package in OF.

I'm also not sure how committed you are to maintaining this code for
Octave. If this is a one-time code dump and it's up to us to maintain
this code in the future, I'm less inclined to accept it into Octave
core, since it's a relatively rare request. I have never heard of our
users clamouring for the Faddeeva function or its relatives.

What do you think, how committed are you feeling?

- Jordi G. H.

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-20 Thread Daniel J Sebald
Hi Steven,

Some comments below with regards to Jordi's observations on integration.


On 11/20/2012 03:33 PM, Jordi Gutiérrez Hermoso wrote:
 On 4 November 2012 00:34, Steven G. Johnsonstev...@alum.mit.edu  wrote:
 There is an updated version of my package
 (http://ab-initio.mit.edu/Faddeeva) which computes not only the Faddeeva
 function (the scaled complex error function) but also the ordinary erf
 and erfc functions of complex arguments, as well as the erfcx and erfi
 variants and the Dawson function (a scaled erfi).

 This should make it relatively painless to drop it in as a replacement
 for the Octave erf and erfc functions in order to support complex arguments.

 I'm still not sure what to do with this code... It sounds useful,
 sure, but you didn't write it for Octave except for a small wrapper.
 Since you're trying to overwrite Octave functions, it should go in
 Octave core but you also want to provide a bunch of other special
 functions, so those should go in the specfun package in OF.

How much of this is the Faddeeva function and how much of it is 
supporting code?  One concern I would have, just looking at the code for 
a few minutes, is all the repetitive routines for square root, sinc, 
etc.  I would think the preference should be to utilize such algorithms 
from Octave's core or utilize the library that Octave is using.  That 
way things remain consistent.

The issue for integration is then what hunks to integrate and how.  The 
package can certainly remain in the current form.

For reference, the current erf and erfc appear to come from the standard 
math library:

# gl_COMMON_DOUBLE_MATHFUNC(FUNC)
# ---
# tests whether the function FUNC is available in libc or libm.
# It sets FUNC_LIBM to empty or -lm accordingly.
# FUNC must be one of the following functions, that are present on all 
systems
# and provided by libm on all systems except Mac OS X, BeOS, Haiku:
#   acos asin atan atan2 cbrt cos cosh erf erfc exp fmod hypot j0 j1 jn 
lgamma
#   log log10 log1p pow remainder sin sinh sqrt tan tanh y0 y1 yn


 I'm also not sure how committed you are to maintaining this code for
 Octave. If this is a one-time code dump and it's up to us to maintain
 this code in the future, I'm less inclined to accept it into Octave
 core, since it's a relatively rare request. I have never heard of our
 users clamouring for the Faddeeva function or its relatives.

Certainly error function and complimentary error function find general 
use, but Faddeeva function seems like something particular to wave 
theory or Fourier analysis.  Whether that belongs in the special 
functions category or a wave-theory (or similar) package, I don't know.

This has an MIT license, correct?  Is that compatible with GPL?  From my 
brief browsing of the code, it does seem to be original and reference 
up-to-date papers on the algorithm and its limitations.

It seems to me the first question is whether to replace erf/erfc in the 
core source with something that handles complex inputs.  I'm not sure 
Faddeeva function on its own warrants core code.  But there might be a 
better way to put Faddeeva function in a package, script code being one 
possibility if that turns out to not be too slow.

Dan

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-20 Thread Michael D. Godfrey
Also keep in mind that this will need to be compatible with
the Matlab complex erf(z).



--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-20 Thread Nir Krakauer
Can the contributed functions be given names that don't conflict with
the current Octave ones, like erf_complex? That way there should be no
problem with putting them either in specfun or as their own Octave
package.

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-20 Thread Daniel J Sebald
On 11/20/2012 07:43 PM, Nir Krakauer wrote:
 Can the contributed functions be given names that don't conflict with
 the current Octave ones, like erf_complex? That way there should be no
 problem with putting them either in specfun or as their own Octave
 package.

That's an alternative.  Yet it might be desired to have complex error 
function family of functions:

octave-cli:3 erfc(complex(1,pi))
error: erfc: not defined for complex scalar

Will this code work for that?

If Steven's code were released as a mini C library that could be 
accessed easily and had some compile switches to use internal square 
root, sinc, etc. functions or external, that might address Jordi's 
concern about maintaining the code.

Dan

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-11-03 Thread Steven G. Johnson
There is an updated version of my package 
(http://ab-initio.mit.edu/Faddeeva) which computes not only the Faddeeva 
function (the scaled complex error function) but also the ordinary erf 
and erfc functions of complex arguments, as well as the erfcx and erfi 
variants and the Dawson function (a scaled erfi).

This should make it relatively painless to drop it in as a replacement 
for the Octave erf and erfc functions in order to support complex arguments.

I would also strongly recommend providing user-callable interfaces for 
the erfcx, erfi, Dawson, and Faddeeva functions as well.  (The scaled 
variants are especially important to work with error functions in the 
regimes where they are exponentially small or large, in order to avoid 
overflow/underflow limitations.)

Let me know if there is anything else I can do to help.

Steven


--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-10-27 Thread Steven G. Johnson
Jordi Gutiérrez Hermoso wrote:
 On 24 October 2012 23:34, Steven G. Johnson stev...@alum.mit.edu wrote:
 Hi all, in case there is interest I wanted to let you know that I've
 written a free complex-argument error function in C++ with an Octave
 wrapper at:

 http://ab-initio.mit.edu/wiki/index.php/Faddeeva_w
 
 Thanks. This belongs in core Octave since that's where the current
 implementation of erf and friends is. I would need to modify your
 source to fit our style. Besides stylistic issues, there's also the
 issue that it should not be a dynamically loaded function, but
 built-in, so your wrapper needs to be rewritten. I am happy to do this
 myself. Do you have a DVCS somewhere, preferrably Mercurial, where we
 could keep your style on one branch and ours in another? Hopefully you
 plan to keep working on this function, so it's worthwhile to version
 your code. If you don't already have a repository set up, I would be
 most pleased to get you started with Mercurial.

I have a private git repository, but I can't make it public because it 
contains a couple of semi-free programs for performance and accuracy 
comparisons.  It wouldn't be hard for me to check in my changes to a 
public Mercurial repository as well, however, if that is much easier for 
you than just grabbing the file from my web site periodically.

I do plan to keep updating my code as needed (e.g. right now I am 
tweaking it to compute Re[w] more accurately in regions close to the 
real-z axis where Re[w] is small), so it would be nice if you could 
track my changes.

 Do you recommend replacing the current implementation of erf for real
 arguments with your implementation? Currently for real arguments we
 rely on the C library's math.h implementation, and for complex
 arguments we error out.

Probably it is better to stick with the libc erf and erfc for real 
arguments.  What my code computes is the scaled error function w(z), 
equivalent to erfcx(x) = exp(x^2) erfc(x) = w(ix) on the real axis. 
This means that my code has to work over a vastly greater domain, even 
on the real axis (where both erf and erfc are trivial except for small 
|x|), with a corresponding sacrifice of performance (a factor of 2-10 on 
my machine).

You might use my code to provide an erfcx function even for real 
arguments, however.  There are also a few other important special 
functions that can be computed from w(z), like the Voigt functions and 
Dawson's integral.

--SGJ


--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev


Re: [OctDev] complex error function

2012-10-27 Thread Steven G. Johnson
Juan Pablo Carbajal wrote:
 You can upload your function to the feature request forum
 https://sourceforge.net/p/octave/feature-requests/
 
 Then we can look at your code and suggest improvements, etc..., if needed.

I've created a ticket:

https://sourceforge.net/p/octave/feature-requests/42/

I didn't attach the code but instead gave the link, mainly because I'll 
probably be posting an updated version of the code shortly with some 
accuracy improvements.

--SGJ


--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev