From: Erik L. <eri...@gm...> - 2025-07-09 01:55:28
|
Hi, I found the code on https://dl.acm.org/doi/abs/10.1145/78928.78934; the supplementary material contains all the subroutines concatenated into one file (https://dl.acm.org/doi/suppl/10.1145/78928.78934/suppl_file/683.gz). It is also available on https://www.netlib.org/toms-2014-06-10/ (scroll to algorithm 683). The fact that it is on netlib tells me it is likely free to use. However, the ACM TOMS license agreement is here: https://www.acm.org/publications/policies/software-copyright-notice . I am not sure if this conflicts with Gnuplot's license? Whether a more permissive license applies to cexint_.f than to zexint_.f is also unclear to me. An awkward point, to the best of my understanding, is that an unmodified version of cexint will not work with the Gnuplot source code, as it expects single-precision arguments. Yet, changing cexint is not completely straightforward: Comparing cexint and zexint (and the accompanying routines cexent and zexent), I noticed the more subtle point that cexint uses r1mach.f and zexint uses d1mach.f; moreover, they use different constants from i1mach to establish precision (elements 12,13 vs. 15,16). Also, in zexint all constants are replaced by their double-precision counterparts. For all these reasons, I would argue that if copyright restrictions are the same for cexint and zexint, it would be better to use the latter - a user could then directly download this subroutine and use it without modifications. Lastly, a tricky point that is easily overlooked is that i1mach, r1mach, d1mach need to be configured for x86. Moreover, since openspecfun is built as a library, it already contains i1mach and d1mach, opening the door for conflicting functions if one gathers cexint/zexint into a separate library... I am attaching my modified version of amos_airy.c, in case you are swayed by my argument... Best, Erik On Tue, Jul 8, 2025 at 7:26 PM Ethan A Merritt <me...@uw...> wrote: > On Tuesday, 8 July 2025 14:21:01 PDT Erik Luijten wrote: > > Hi Ethan, > > > > In amos_airy.c, you write: > > > > * The cexint_() routine is also from the AMOS collection, but is not > part > > * of the Bessel function subset and not included in libopenspecfun. > > * I could not find source for a version of the source that splits the > > * real and imaginary parts of the arguments as with the zxxxx.f Bessel > > * routines; this one accepts and returns a CMPLX argument rather than > > separate > > * real and imaginary parts. > > * D. E. Amos, ALGORITHM 683 A Portable FORTRAN Subroutine > > * for Exponential Integrals of a Complex Argument > > * ACM Trans. Math. Software 16:178-182 (1990) > > > > This confuses me for two reasons: > > - You invoke CEXINT as a double precision function, even though this > > Fortran function is single precision. > > > - The algorithm 683 you quote DOES provide a separate double precision > > function, ZEXINT. Moreover, that function does exactly what you were > > looking for, namely taking and returning separate real and imaginary > parts. > > There is some history behind this due to IMHO over-zealous, or at least > overly pessimistic, concern about license contamination with non-free code. > I cited a publication in ACM/TMS that describes the implementation. > However, people have assserted that code obtained through the ACM > journal is non-free because the journal claims copyright. > I believe this to be factually incorrect; the published article may be > subject > to copyright but not the code it describes. In any case, rather than pursue > the argument I instead used copies of the code obtained from US national > lab repositories. I found source there for cexint.f but not for zexint.f, > so that is what I use myself to build libamos and what I invoked from the > gnuplot code. > > Even so that was apparently not sufficient by itself to convince hard-core > "free licenses only" gatekeepers. > There is an explicit statement of the [non]copyright status of the code > in the cited 1985 Sandia National Laboratory report, but that report > predated development of the expint routines (1990?) and I did not find a > separate Sandia report that mentions them specifically. > That is probably why neither routine is included in libopenspec, > and why inclusion in gnuplot is a configuration option. > > > I changed f_amos_cexint to use ZEXINT (just for my own edification) and > it > > works properly. However, before submitting it, I wonder what am I > missing? > > Where did you obtain a copy of the source? > Can you document the relevant claim or non-claim of copyright or > licensing? > > And, out of curiosity, is there anything in the zexint.f code that would > differentiate it from a single-precision version other than declaration > of the variables as Fortran DOUBLE PRECISION? > > Ethan > > > > > > Thank you, > > > > Erik > > > > > > |