Help with levin2d & fpm & stdlib

Dear all,

I’m lost little bit in various options & general picture.

What I need: I want to use Levin integration method for a rapidly oscillating function. This is for Henkel-Bessel integral for a diffraction problem, Eq. 4 from Aime (2020) (some years ago I already implemented it using Lommel series & numerical integration; now I want it faster).

There exist Levin method for such types of integrals, with a realization here. They provide a makefile, which after some efforts I managed to compile. I need 1D integral which is provided by levin.f90, which relies on provided utils.f90; linalg0.f90; chebyshev.f90; chebpw.f90 (all provided); but then during linking it requires also dgeem (or something from BLAS/LAPACK)

I thought it’s time to try to learn something new for me, trying to check out fpm and stdlib. If I understand correctly, in an ideal case everything missing will be downloaded & complied & path’s automatically. I just need to create a manifest … with which I’m currently struggling.

Is it correct?

Now I have fpm installed, the first example from the manual works. But not further :slight_smile:

Should I install stdlib separately system-wide? How to specify in the manifest that I just need few files to be compiled? (if I’m correct, there are some missing files). I actually need levin.f90 …

name = "levin2d"
version = "0.1.0"
license = "license"
author = "Murdock Aurby"
maintainer = "murdock-aurby@email.com"
copyright = "Copyright 2026"

[library]
source-dir="./"
build-script="make with options?"

Thanks in advance for help & suggestions.

Maybe the discussions in this thread can come in handy with respect to your needs:

you could start testing using stdlib as a meta-package with the stdlib = "*" declaration in the dependencies of your manifest, and if you are happy, then go for a local registry or system-wide installation. All options are possible, for prototyping maybe the first is faster.

Have you tried adding

[build]
link = ["blas", "lapack"]

to your toml file?

Well, yes/no. No, I did not put this line to my toml file; but it looks if I remove levin dependency from my project and keep stdlib, the latter appears there in dependencies with its BLAS/LAPACK implementation/interfaces.

What is the problem in my case (I think) is that I can not compile the levin “library” with fpm. If I try to compile it separately (not from within my project) with fpm it fails for several reasons: there are clearly some missing files, thus all the included f90 files can not be compiled. I have not figured out how to specify to fpm that only some files need to be compiled. Second, when I modify its own makefile (I need only levin.f90, which depends only on few others - utils.f90, linalg0.f90, chebyshev.f90) I can get modules and *o files; but when I manually try to link levin.o to my program, it turns out it requires BLAS/LAPACK. Which I did not specify, because I thought initially it would be done by fpm.

So I’m not sure if fpm is capable of compiling just few files from a repository (please point if it’s written somewhere) and if I still should use fpm