Skip to content

Commit 3a9f593

Browse files
committed
[RVec] Forward declare VDT functions in RVec.hxx header
Introduce forward declarations of the vdt functions int `RVec.hxx` so we don't rely on the `<vdt/vdtMath.h>` header always being in the include path. Closes #9736, because now there is no builtin library left that ends up included in ROOT modules.
1 parent 436cedd commit 3a9f593

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

math/vecops/inc/ROOT/RVec.hxx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,28 @@
4747
#include <vector>
4848

4949
#ifdef R__HAS_VDT
50-
#include <vdt/vdtMath.h>
50+
// Forward declarations of the vdt functions used by the fast_* helpers below.
51+
// We deliberately avoid including <vdt/vdtMath.h> from this public header so
52+
// that we don't rely on this header always being in the include path.
53+
namespace vdt {
54+
inline double fast_exp(double);
55+
inline double fast_log(double);
56+
inline double fast_sin(double);
57+
inline double fast_cos(double);
58+
inline double fast_tan(double);
59+
inline double fast_asin(double);
60+
inline double fast_acos(double);
61+
inline double fast_atan(double);
62+
63+
inline float fast_expf(float);
64+
inline float fast_logf(float);
65+
inline float fast_sinf(float);
66+
inline float fast_cosf(float);
67+
inline float fast_tanf(float);
68+
inline float fast_asinf(float);
69+
inline float fast_acosf(float);
70+
inline float fast_atanf(float);
71+
} // namespace vdt
5172
#endif
5273

5374

@@ -1411,7 +1432,7 @@ RVecs as arguments.
14111432
- erf, erfc
14121433
- lgamma, tgamma
14131434
1414-
If the VDT library is available, the following functions can be invoked. Internally the calculations
1435+
If the VDT library is available and the `<vdt/vdtMath.h>` header included, the following functions can be invoked. Internally the calculations
14151436
are vectorized:
14161437
- fast_expf, fast_logf, fast_sinf, fast_cosf, fast_tanf, fast_asinf, fast_acosf, fast_atanf
14171438
- fast_exp, fast_log, fast_sin, fast_cos, fast_tan, fast_asin, fast_acos, fast_atan

math/vecops/src/RVec.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
*************************************************************************/
1212

1313
#include "ROOT/RVec.hxx"
14+
15+
#ifdef R__HAS_VDT
16+
#include <vdt/vdtMath.h>
17+
#endif
18+
1419
using namespace ROOT::VecOps;
1520

1621
// Check that no bytes are wasted and everything is well-aligned.

tutorials/math/vecops/vo002_VectorCalculations.C

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
/// \date May 2018
1111
/// \author Danilo Piparo
1212

13+
#ifdef R__HAS_VDT
14+
#include <vdt/vdtMath.h>
15+
#endif
16+
1317
void vo002_VectorCalculations()
1418
{
1519

0 commit comments

Comments
 (0)