Avoiding potential licensing issues

I’ve stumbled upon a function in the Stan math library that I’d like to modify for my own personal use. I see that this library is open-source licensed under the BSD 3-Clause license. However, at the top of the file, it mentions copyrights that I’ve seen in the Boost code that it’s likely derived from.

So, what are the rules I have to follow? Sorry if this question is off-topic. If it is, let me know where I should ask it.

The stan file is https://github.com/stan-dev/math/blob/9b2e93ba58fa00521275b22a190468ab22f744a3/stan/math/prim/fun/log_modified_bessel_first_kind.hpp

All of the math library is under the bsd-3 license

* and the tbb library we use is under the mozilla license, which is not compatible with GPL-3

Go ahead. I wrote that function, but the special cases at the top I took from Boost.