Background & Problem formulation
I'm trying to write a simple program in C++ that performs adaptive numerical integration of vector valued integrands (in one variable), i.e.
$$\int_a^b \bar{f}(x) \ dx $$
where $\bar{f} = \{f_1, f_2, ..., f_n\}$.
I know that there are good libraries that can do this (for example GSL or Cubature) but I cannot use any of these because they are under GNU GPL. On the other hand I think these libraries are a bit to involved for my simple problems. But if there is library that I can use I will probably use it!
What I need is something simple like an adaptive Gauss-Kronrod or Gauss-Lobatto solver, but Newton-Cotes probably suffices.
I have been using a Gauss-Lobatto algorithm before that is inspired by this code and ideally I would just modify that one to be able to handle vector integrands.
Before doing so I tried to "vectorize" a simpler algorithm, namely an adaptive mid-point rule algorithm (i.e. is a rectangular Newton-Cotes). While doing so I realized that it is very difficult to "vectorize" the algorithm and maintain tail-recursion. And I noticed significant loss of performance (~30%) when removing the tail-recursion in this simple algorithm. So I imagine the impact can be even bigger in an adaptive Gauss-Lobatto algorithm.
So to summarize, here are some of my questions:
Q1
When writing my own adaptive algorithm should I avoid using recursion if I cannot maintain the tail-recursion?
Q2
Is there a library I can use that solves my problem and is under a less restrictive license than GNU GPL? (LGPL should be fine).
Thanks in advance!