# px4/eigen architecture

> Architecture diagram of the GitHub repository px4/eigen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/px4/eigen
- Repository: https://github.com/px4/eigen

## Overview

#### Purpose and consumption model
Eigen is a C++ template library for dense and sparse linear algebra, decompositions, solvers, geometry, and related numerical algorithms. It is primarily header-based: downstream C++ projects include module entry headers rather than call a standalone service or executable. Public module entry points include `Eigen/Core`, `Eigen/Dense`, `Eigen/Sparse`, and `Eigen/Eigen`.

#### Build and distribution boundary
CMake configures installation, optional targets, test integration, and package discovery from `CMakeLists.txt`; consumers can integrate through generated CMake package config or pkg-config metadata (`cmake/Eigen3Config.cmake.in`, `eigen3.pc.in`). The core library has no required runtime infrastructure. Build-time optional backends and supported integrations are discovered by CMake, including BLAS/LAPACK, SuiteSparse-family solvers, MKL, CUDA, and SYCL.

#### Core expression and storage system
The foundational data model is templated matrices, arrays, views, maps, storage, and expression templates. Public `Eigen/Core` forwards into implementations such as `Eigen/src/Core/Matrix.h`, `Eigen/src/Core/Array.h`, and `Eigen/src/Core/AssignEvaluator.h`. User operations construct typed expression trees; assignment evaluators decide when and how to materialize results into dense storage. `Map` and `Ref` form an important boundary for non-owning access to externally allocated memory.

#### Evaluation and performance layer
Expression evaluation routes arithmetic and products through generic evaluators and specialized kernels. Matrix products are implemented under `Eigen/src/Core/products/GeneralMatrixMatrix.h` and parallel scheduling support is in `Eigen/src/Core/products/Parallelizer.h`. SIMD packet implementations are selected at compile time by platform/compiler capabilities, with architecture-specific paths such as `Eigen/src/Core/arch/SSE/PacketMath.h`, `Eigen/src/Core/arch/AVX/PacketMath.h`, and `Eigen/src/Core/arch/CUDA/PacketMath.h`. This layer is performance-critical and separates user-facing algebra syntax from CPU/GPU-specific execution.

#### Dense algebra modules
Higher-level dense operations are exposed through module headers and specialized implementations: factorizations in `Eigen/Cholesky`, `Eigen/LU`, and `Eigen/QR`; spectral methods in `Eigen/Eigenvalues`; and singular-value decomposition in `Eigen/SVD`. Representative algorithms include `Eigen/src/Cholesky/LDLT.h`, `Eigen/src/LU/FullPivLU.h`, and `Eigen/src/SVD/BDCSVD.h`. The usual flow is dense matrix/expression input → decomposition object/factorization → solve, inverse-related, rank, or spectral result.

#### Sparse algebra and external solver adapters
Sparse matrix storage and lazy sparse operations are centered on `Eigen/SparseCore` and `Eigen/src/SparseCore/SparseMatrix.h`; solvers build on this through `Eigen/SparseCholesky`, `Eigen/SparseLU`, and `Eigen/SparseQR`. Optional adapter modules bridge Eigen sparse types to external native libraries: `Eigen/CholmodSupport`, `Eigen/SuperLUSupport`, and `Eigen/UmfPackSupport` (also KLU, PaStiX, Pardiso, SPQR, and Metis). These are compile-time integration boundaries rather than remotely accessed services.

#### Extended and experimental functionality
Stable geometry types and transformations are exposed by `Eigen/Geometry` with implementation in `Eigen/src/Geometry/Transform.h` and `Eigen/src/Geometry/Quaternion.h`. Experimental/unsupported features are isolated under `unsupported/Eigen`, including tensor execution (`unsupported/Eigen/CXX11/Tensor`, `unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h`) and thread-pool support (`unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h`). CUDA and SYCL tensor device paths are present but remain within this unsupported boundary.

#### Validation and performance artifacts
CMake-driven validation is organized from `test/CMakeLists.txt`, while compile-failure cases enforce template API constraints in `failtest/CMakeLists.txt`. Benchmarks measure kernels, solvers, sparse paths, and accelerator tensor operations under `bench/` and `bench/tensors/`. These are development targets, not library runtime entry points.

Main entry points: [`Eigen/src/Core/Matrix.h`](https://github.com/px4/eigen/blob/master/Eigen/src/Core/Matrix.h) (Matrix, Array, views, storage), [`Eigen/Eigen`](https://github.com/px4/eigen/blob/master/Eigen/Eigen) (Public module headers), [`CMakeLists.txt`](https://github.com/px4/eigen/blob/master/CMakeLists.txt) (CMake build and install), [`Eigen/src/SparseCore/SparseMatrix.h`](https://github.com/px4/eigen/blob/master/Eigen/src/SparseCore/SparseMatrix.h) (Sparse storage and expressions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_distribution["Distribution"]
  node_cmake["CMake build and install<br/>build system<br/>[CMakeLists.txt]"]
  node_cmake_package["CMake package config<br/>package metadata"]
  node_pkg_config["pkg-config metadata<br/>package metadata<br/>[eigen3.pc.in]"]
end

subgraph group_core["Core evaluation"]
  node_core_types["Matrix, Array, views, storage<br/>template data model<br/>[Matrix.h]"]
  node_nonowning["Map and Ref<br/>memory access boundary"]
  node_assignment["Assignment evaluators<br/>expression evaluator<br/>[AssignEvaluator.h]"]
  node_product_kernels["Matrix product kernels<br/>compute kernel"]
  node_simd_parallel["SIMD and parallel execution<br/>platform backend<br/>[Parallelizer.h]"]
end

subgraph group_dense["Dense algebra"]
  node_dense_modules["Dense decompositions<br/>dense module API"]
  node_dense_algorithms["Dense factorization algorithms<br/>algorithm implementations<br/>[LDLT.h]"]
end

subgraph group_sparse["Sparse algebra"]
  node_sparse_core["Sparse storage and expressions<br/>sparse data model<br/>[SparseMatrix.h]"]
  node_sparse_solvers["Sparse solvers<br/>sparse module API"]
  node_external_adapters{{"External sparse adapters<br/>optional native integration"}}
end

subgraph group_extended["Extended features"]
  node_geometry["Geometry transforms<br/>stable module<br/>[Transform.h]"]
  node_unsupported_tensor["Unsupported tensor execution<br/>experimental module<br/>[TensorExecutor.h]"]
end

subgraph group_quality["Development targets"]
  node_validation["Tests and compile-fail checks<br/>validation targets<br/>[CMakeLists.txt]"]
  node_benchmarks["Benchmarks<br/>performance targets"]
end

node_consumer(("Downstream C++ project<br/>consumer"))
node_module_headers["Public module headers<br/>header API"]

node_consumer -->|"includes"| node_module_headers
node_cmake -->|"generates"| node_cmake_package
node_cmake -->|"generates"| node_pkg_config
node_cmake_package -.->|"package discovery"| node_consumer
node_pkg_config -.->|"package discovery"| node_consumer
node_module_headers -->|"exposes"| node_core_types
node_module_headers -->|"exposes"| node_nonowning
node_module_headers -->|"includes"| node_dense_modules
node_module_headers -->|"includes"| node_sparse_core
node_core_types -->|"expression assignment"| node_assignment
node_nonowning -->|"views external memory as"| node_core_types
node_assignment -->|"dispatches products"| node_product_kernels
node_product_kernels -->|"uses"| node_simd_parallel
node_core_types -->|"dense input"| node_dense_algorithms
node_dense_modules -->|"selects"| node_dense_algorithms
node_core_types -.->|"interoperates"| node_sparse_core
node_sparse_core -->|"solver input"| node_sparse_solvers
node_sparse_solvers -.->|"optionally delegates to"| node_external_adapters
node_core_types -->|"supports"| node_geometry
node_core_types -->|"extends"| node_unsupported_tensor
node_cmake -->|"configures"| node_validation
node_cmake -->|"configures"| node_benchmarks

click node_module_headers "https://github.com/px4/eigen/blob/master/Eigen/Eigen"
click node_cmake "https://github.com/px4/eigen/blob/master/CMakeLists.txt"
click node_cmake_package "https://github.com/px4/eigen/blob/master/cmake/Eigen3Config.cmake.in"
click node_pkg_config "https://github.com/px4/eigen/blob/master/eigen3.pc.in"
click node_core_types "https://github.com/px4/eigen/blob/master/Eigen/src/Core/Matrix.h"
click node_nonowning "https://github.com/px4/eigen/blob/master/Eigen/Core"
click node_assignment "https://github.com/px4/eigen/blob/master/Eigen/src/Core/AssignEvaluator.h"
click node_product_kernels "https://github.com/px4/eigen/blob/master/Eigen/src/Core/products/GeneralMatrixMatrix.h"
click node_simd_parallel "https://github.com/px4/eigen/blob/master/Eigen/src/Core/products/Parallelizer.h"
click node_dense_modules "https://github.com/px4/eigen/blob/master/Eigen/Cholesky"
click node_dense_algorithms "https://github.com/px4/eigen/blob/master/Eigen/src/Cholesky/LDLT.h"
click node_sparse_core "https://github.com/px4/eigen/blob/master/Eigen/src/SparseCore/SparseMatrix.h"
click node_sparse_solvers "https://github.com/px4/eigen/blob/master/Eigen/SparseCholesky"
click node_external_adapters "https://github.com/px4/eigen/blob/master/Eigen/CholmodSupport"
click node_geometry "https://github.com/px4/eigen/blob/master/Eigen/src/Geometry/Transform.h"
click node_unsupported_tensor "https://github.com/px4/eigen/blob/master/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
click node_validation "https://github.com/px4/eigen/blob/master/test/CMakeLists.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmake,node_cmake_package,node_pkg_config toneBlue
class node_core_types,node_nonowning,node_assignment,node_product_kernels,node_simd_parallel toneAmber
class node_dense_modules,node_dense_algorithms toneMint
class node_sparse_core,node_sparse_solvers,node_external_adapters toneRose
class node_geometry,node_unsupported_tensor toneIndigo
class node_validation,node_benchmarks toneTeal
class node_consumer,node_module_headers toneNeutral
```

## Components

### Distribution

- [CMake build and install](https://github.com/px4/eigen/blob/master/CMakeLists.txt): build system · Configures installation, optional integrations, and development targets. · `CMakeLists.txt`
- [CMake package config](https://github.com/px4/eigen/blob/master/cmake/Eigen3Config.cmake.in): package metadata · `cmake/Eigen3Config.cmake.in`
- [pkg-config metadata](https://github.com/px4/eigen/blob/master/eigen3.pc.in): package metadata · `eigen3.pc.in`

### Core evaluation

- [Matrix, Array, views, storage](https://github.com/px4/eigen/blob/master/Eigen/src/Core/Matrix.h): template data model · Typed dense objects and expression nodes. · `Eigen/src/Core/Matrix.h`
- [Map and Ref](https://github.com/px4/eigen/blob/master/Eigen/Core): memory access boundary · Non-owning access to externally allocated memory. · `Eigen/Core`
- [Assignment evaluators](https://github.com/px4/eigen/blob/master/Eigen/src/Core/AssignEvaluator.h): expression evaluator · Materializes expression trees into dense storage. · `Eigen/src/Core/AssignEvaluator.h`
- [Matrix product kernels](https://github.com/px4/eigen/blob/master/Eigen/src/Core/products/GeneralMatrixMatrix.h): compute kernel · Generic and specialized matrix multiplication evaluation. · `Eigen/src/Core/products/GeneralMatrixMatrix.h`
- [SIMD and parallel execution](https://github.com/px4/eigen/blob/master/Eigen/src/Core/products/Parallelizer.h): platform backend · Compile-time packet selection and product scheduling. · `Eigen/src/Core/products/Parallelizer.h`

### Dense algebra

- [Dense decompositions](https://github.com/px4/eigen/blob/master/Eigen/Cholesky): dense module API · Cholesky, LU, QR, eigenvalue, and SVD algorithms. · `Eigen/Cholesky`
- [Dense factorization algorithms](https://github.com/px4/eigen/blob/master/Eigen/src/Cholesky/LDLT.h): algorithm implementations · Produce solves, ranks, inverses, and spectral results. · `Eigen/src/Cholesky/LDLT.h`

### Sparse algebra

- [Sparse storage and expressions](https://github.com/px4/eigen/blob/master/Eigen/src/SparseCore/SparseMatrix.h): sparse data model · `Eigen/src/SparseCore/SparseMatrix.h`
- [Sparse solvers](https://github.com/px4/eigen/blob/master/Eigen/SparseCholesky): sparse module API · Sparse Cholesky, LU, and QR solvers. · `Eigen/SparseCholesky`
- [External sparse adapters](https://github.com/px4/eigen/blob/master/Eigen/CholmodSupport): optional native integration · Compile-time bridges to SuiteSparse-family and other solvers. · `Eigen/CholmodSupport`

### Extended features

- [Geometry transforms](https://github.com/px4/eigen/blob/master/Eigen/src/Geometry/Transform.h): stable module · Transform and quaternion types. · `Eigen/src/Geometry/Transform.h`
- [Unsupported tensor execution](https://github.com/px4/eigen/blob/master/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h): experimental module · Tensor execution with optional CUDA and SYCL device paths. · `unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h`

### Development targets

- [Tests and compile-fail checks](https://github.com/px4/eigen/blob/master/test/CMakeLists.txt): validation targets · CMake-driven API and template constraint validation. · `test/CMakeLists.txt`
- **Benchmarks**: performance targets · Measures kernels, solvers, sparse, and tensor paths.

### Other components

- **Downstream C++ project**: consumer · Includes Eigen headers and instantiates templates.
- [Public module headers](https://github.com/px4/eigen/blob/master/Eigen/Eigen): header API · Core, Dense, Sparse, and umbrella entry points. · `Eigen/Eigen`

## Connections

- Downstream C++ project → Public module headers: includes
- CMake build and install → CMake package config: generates
- CMake build and install → pkg-config metadata: generates
- CMake package config → Downstream C++ project: package discovery
- pkg-config metadata → Downstream C++ project: package discovery
- Public module headers → Matrix, Array, views, storage: exposes
- Public module headers → Map and Ref: exposes
- Public module headers → Dense decompositions: includes
- Public module headers → Sparse storage and expressions: includes
- Matrix, Array, views, storage → Assignment evaluators: expression assignment
- Map and Ref → Matrix, Array, views, storage: views external memory as
- Assignment evaluators → Matrix product kernels: dispatches products
- Matrix product kernels → SIMD and parallel execution: uses
- Matrix, Array, views, storage → Dense factorization algorithms: dense input
- Dense decompositions → Dense factorization algorithms: selects
- Matrix, Array, views, storage → Sparse storage and expressions: interoperates
- Sparse storage and expressions → Sparse solvers: solver input
- Sparse solvers → External sparse adapters: optionally delegates to
- Matrix, Array, views, storage → Geometry transforms: supports
- Matrix, Array, views, storage → Unsupported tensor execution: extends
- CMake build and install → Tests and compile-fail checks: configures
- CMake build and install → Benchmarks: configures
