netlib-java icon indicating copy to clipboard operation
netlib-java copied to clipboard

Add FITPACK to netlib-java

Open randallwhitman opened this issue 9 years ago • 4 comments

Is there interest in adding FITPACK to netlib-java, as in SciPy? https://github.com/scipy/scipy/tree/master/scipy/interpolate/fitpack

randallwhitman avatar Mar 17 '16 16:03 randallwhitman

depends on #76 and possibly significant extra work if the APU uses callbacks.

fommil avatar Mar 17 '16 17:03 fommil

Is the dependency on #76 the reason I get near-empty F2jFITPACK.{java,class} when I made a brief attempt at it - as opposed to missing something other than core/pom.xml that would need to be changed?

$ ls netlib/FITPACK/
bispeu.f  curfit.f  fpbacp.f   fpcoco.f  fpdeno.f  fpinst.f  fpperi.f  fprppo.f  fptrnp.f  percur.f  sphere.f
bispev.f  dblint.f  fpbfout.f  fpcons.f  fpdisc.f  fpintb.f  fppocu.f  fprpsp.f  fptrpe.f  pogrid.f  splder.f
clocur.f  evapol.f  fpbisp.f   fpcosp.f  fpfrno.f  fpknot.f  fppogr.f  fpseno.f  insert.f  polar.f   splev.f
cocosp.f  fourco.f  fpbspl.f   fpcsin.f  fpgivs.f  fpopdi.f  fppola.f  fpspgr.f  Makefile  profil.f  splint.f
concon.f  fpader.f  fpchec.f   fpcurf.f  fpgrdi.f  fpopsp.f  fprank.f  fpsphe.f  parcur.f  README    sproot.f
concur.f  fpadno.f  fpched.f   fpcuro.f  fpgrpa.f  fporde.f  fprati.f  fpsuev.f  parder.f  regrid.f  surev.f
cualde.f  fpadpo.f  fpchep.f   fpcyt1.f  fpgrre.f  fppara.f  fpregr.f  fpsurf.f  pardeu.f  spalde.f  surfit.f
curev.f   fpback.f  fpclos.f   fpcyt2.f  fpgrsp.f  fppasu.f  fprota.f  fpsysy.f  parsur.f  spgrid.f
       <execution>
           <id>fitpack-interface</id>
           <goals>
               <goal>interface</goal>
           </goals>
           <configuration>
               <outputName>com/github/fommil/netlib/FITPACK.java</outputName>
               <scan>org.netlib.fitpack</scan>
               <fallback>com.github.fommil.netlib.F2jFITPACK</fallback>
               <impls>com.github.fommil.netlib.NativeSystemFITPACK,com.github.fommil.netlib.NativeRefFITPACK,com.github.fommil.netlib.F2jFITPACK</impls>
           </configuration>
       </execution>
       <execution>
           <id>fitpack-f2j-implementation</id>
           <goals>
               <goal>f2j</goal>
           </goals>
           <configuration>
               <outputName>com/github/fommil/netlib/F2jFITPACK.java</outputName>
               <scan>org.netlib.fitpack</scan>
               <implementing>com.github.fommil.netlib.FITPACK</implementing>
           </configuration>
       </execution>

mvn package

$ ls -sh ./core/target/classes/com/github/fommil/netlib/
 12K ARPACK.class   36K F2jARPACK.class  4.0K F2jFITPACK.class  4.0K FITPACK.class
 12K BLAS.class     32K F2jBLAS.class    444K F2jLAPACK.class   112K LAPACK.class

$ wc -l core/target/generated-sources/netlib-java/com/github/fommil/netlib/*a 
  13534 core/target/generated-sources/netlib-java/com/github/fommil/netlib/ARPACK.java
  12606 core/target/generated-sources/netlib-java/com/github/fommil/netlib/BLAS.java
    592 core/target/generated-sources/netlib-java/com/github/fommil/netlib/F2jARPACK.java
    722 core/target/generated-sources/netlib-java/com/github/fommil/netlib/F2jBLAS.java
     38 core/target/generated-sources/netlib-java/com/github/fommil/netlib/F2jFITPACK.java
   7037 core/target/generated-sources/netlib-java/com/github/fommil/netlib/F2jLAPACK.java
     86 core/target/generated-sources/netlib-java/com/github/fommil/netlib/FITPACK.java
 158016 core/target/generated-sources/netlib-java/com/github/fommil/netlib/LAPACK.java

randallwhitman avatar Mar 17 '16 17:03 randallwhitman

if by "near empty" you mean "completely empty". We need to compile the fortran code for the JVM before we can even think about adding it to netlib-java.

fommil avatar Mar 17 '16 17:03 fommil

For my purposes I got interpolation matching SciPy output, by adapting FITPACK code translated by f2j. https://github.com/randallwhitman/netlib-java/tree/fitpack-interpolation-f2j Up to you whether to keep this issue open for more general interest in FITPACK.

randallwhitman avatar Mar 29 '16 15:03 randallwhitman