From lemming at henning-thielemann.de Sat Dec 16 11:13:08 2017 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Sat, 16 Dec 2017 12:13:08 +0100 (CET) Subject: [Numeric] autogenerated BLAS and LAPACK interfaces Message-ID: I have just uploaded these packages: https://hackage.haskell.org/package/netlib-ffi-0.0 https://hackage.haskell.org/package/netlib-carray-0.0 https://hackage.haskell.org/package/blas-ffi-0.0 https://hackage.haskell.org/package/blas-carray-0.0 https://hackage.haskell.org/package/lapack-ffi-0.0 https://hackage.haskell.org/package/lapack-carray-0.0 https://hackage.haskell.org/package/lapack-ffi-tools-0.0 The netlib packages provide definitions used by the other packages. The "ffi" packages provide foreign imports of all functions from the corresponding netlib package. The "carray" packages contain mid-level functions that use CArrays for vectors and matrices and try to get input and output values right according to the FORTRAN comments. CArrays might not be really appropriate since we always use zero-based arrays but this cannot be expressed in the type. A zero-based variant of CArrays might be better in the future. I use closed-world classes for generalizing functions that are generalizable. This way, I can add "methods" without extending the class. The packages use very basic techniques. No C code, no HSC, no C2HS, no template Haskell, only plain Haskell 2010 with ForeignFunctionInterface. I still have no good idea how to cope with Characters. They are used like enumeration elements, thus the enumerations deserve custom newtype wrappers. But not all enumeration elements are allowed everywhere. I am also uncertain whether to use these wrappers already in the "ffi" packages or only in "carray". I have also not included the FORTRAN comments in the Haskell packages. I have only included links to online docs where available. From zocca.marco at gmail.com Sat Dec 16 13:08:43 2017 From: zocca.marco at gmail.com (Marco Zocca) Date: Sat, 16 Dec 2017 14:08:43 +0100 Subject: [Numeric] Numeric Digest, Vol 8, Issue 1 Message-ID: Very interesting! This is a great foundation for higher-level libraries. I also very much appreciate the use of bare FFI calls as a way of future-proofing this library, since the various binding DSLs are quite impervious to Haskell newcomers. Would you see `vector` as more fitting than `CArray` ? Also, I'm guessing that the original comments would help bring up to speed other developers on the internals. Last thing, would you be interested in jointly developing bindings to the sparse netlib functionality ( http://www.netlib.org/sparse/) ? Thanks, Marco > I have just uploaded these packages: > > https://hackage.haskell.org/package/netlib-ffi-0.0 > https://hackage.haskell.org/package/netlib-carray-0.0 > https://hackage.haskell.org/package/blas-ffi-0.0 > https://hackage.haskell.org/package/blas-carray-0.0 > https://hackage.haskell.org/package/lapack-ffi-0.0 > https://hackage.haskell.org/package/lapack-carray-0.0 > https://hackage.haskell.org/package/lapack-ffi-tools-0.0 > > The netlib packages provide definitions used by the other packages. The > "ffi" packages provide foreign imports of all functions from the > corresponding netlib package. The "carray" packages contain mid-level > functions that use CArrays for vectors and matrices and try to get input > and output values right according to the FORTRAN comments. CArrays might > not be really appropriate since we always use zero-based arrays but this > cannot be expressed in the type. A zero-based variant of CArrays might be > better in the future. I use closed-world classes for generalizing > functions that are generalizable. This way, I can add "methods" without > extending the class. > > The packages use very basic techniques. No C code, no HSC, no C2HS, no > template Haskell, only plain Haskell 2010 with ForeignFunctionInterface. > > I still have no good idea how to cope with Characters. They are used like > enumeration elements, thus the enumerations deserve custom newtype > wrappers. But not all enumeration elements are allowed everywhere. I am > also uncertain whether to use these wrappers already in the "ffi" packages > or only in "carray". > > I have also not included the FORTRAN comments in the Haskell packages. I > have only included links to online docs where available. > From lemming at henning-thielemann.de Sat Dec 16 14:26:38 2017 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Sat, 16 Dec 2017 15:26:38 +0100 (CET) Subject: [Numeric] autogenerated BLAS and LAPACK interfaces In-Reply-To: References: Message-ID: On Sat, 16 Dec 2017, Marco Zocca wrote: > Would you see `vector` as more fitting than `CArray` ? 'vector' would have the advantage that it is already zero-based. Unfortunately, for matrices it is missing the second dimension. :-( Sure, 'hmatrix' is based on 'vector', too. > Last thing, would you be interested in jointly developing bindings to > the sparse netlib functionality ( http://www.netlib.org/sparse/) ? It looks like a C interface, right? My automatic generator is bound to parsing FORTRAN headers and their comments in the special format found in LAPACK and BLAS.