# libigl/eigen architecture

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

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

## Overview

##### Project Type and Purpose
- Eigen is a C++ library meant for linear algebra computations. Its purpose is to provide a wide range of mathematical functionality—including but not limited to dense and sparse matrices, solvers (LU, QR, Cholesky, eigenvalue algorithms, etc.), geometry modules, and even some unsupported experimental features (like tensor operations and auto-differentiation).

##### File Structure to Identify Main Components
- Core Library Modules:
- “Eigen/Core”, “Eigen/Dense”: These contain the essential vector and matrix definitions and operations.
- “Eigen/Sparse”, “Eigen/SparseCore”, “Eigen/SparseLU”, “Eigen/SparseQR”, etc.: Represent the sparse matrix functionality.
- “Eigen/Cholesky”, “Eigen/QR”, “Eigen/SVD”, “Eigen/Eigenvalues”: These directories provide various matrix factorizations and solvers.
- “Eigen/Geometry”: Contains the modules for geometric transformations using matrices and quaternions.
- “Eigen/IterativeLinearSolvers”, “Eigen/LU”, “Eigen/Jacobi”, etc.: More specialized solvers and algorithms.
- Supporting Code and Configuration:
- Build and configuration files such as “CMakeLists.txt” and numerous “cmake” subdirectories.
- Documentation (“doc” folder) and examples/demos (“demos” folder) that show how to use the library.
- Test directories (“test”, “bench”, “failtest”) that ensure correctness and performance.
- Unstable/Experimental Components:
- “unsupported”: Contains modules that are experimental or not part of the official core but extend functionality (e.g., tensor support, auto-differentiation).

##### Relationship and Interactions
- The core modules depend on one another. For example, the “Core” module supplies the basic types that every other module (solvers, geometry, iterative methods) will use.
- Solver modules like “Cholesky”, “QR”, “SVD”, and “Eigenvalues” use and extend the capabilities of the Core/dense module.
- The sparse modules have their own substructure (such as “SparseCore” and specialized sparse solver routines) and often interface with the dense modules.
- Build configuration (via CMake and cmake scripts) underpins the whole library, integrating testing, benchmarking, and demo executions.
- Documentation and example directories are separate from the library’s runtime components but are crucial for understanding and verifying usage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CORE["Core Linear Algebra Types"]:::core
    DENSE["Dense Matrix Operations"]:::dense
    SPARSE_TYPES["Sparse Matrix Types"]:::sparse
    SPARSE_CORE["Sparse Core Operations"]:::sparse
    GEOM["Geometric Transformations"]:::geometry

    %% Solver Modules Subgraph
    subgraph "Solver Modules"
        SOL_CHOL["Cholesky Solver"]:::solver
        SOL_LU["LU Solver"]:::solver
        SOL_QR["QR Solver"]:::solver
        SOL_SVD["SVD Solver"]:::solver
        SOL_EIG["Eigenvalue Computations"]:::solver
        SOL_ITER["Iterative Solvers"]:::solver
        SOL_JAC["Jacobi Methods"]:::solver
    end

    %% Auxiliary Components Subgraph
    subgraph "Auxiliary Components"
        BUILD["Build System"]:::aux
        CMAKE["CMake Scripts"]:::aux
        DOC["Documentation"]:::aux
        DEMO["Examples/Demos"]:::aux
        TEST["Tests"]:::aux
        BENCH["Benchmarks"]:::aux
        EXPERIMENTAL["Experimental Features"]:::experimental
    end

    %% Component Dependencies
    CORE --> DENSE
    CORE --> SPARSE_TYPES
    CORE --> SPARSE_CORE
    CORE --> GEOM

    DENSE --> SOL_CHOL
    DENSE --> SOL_LU
    DENSE --> SOL_QR
    DENSE --> SOL_SVD
    DENSE --> SOL_EIG
    DENSE --> SOL_ITER
    DENSE --> SOL_JAC

    %% Build System integrates core components
    BUILD --> CORE
    BUILD --> DENSE
    BUILD --> SPARSE_TYPES
    BUILD --> SPARSE_CORE
    BUILD --> GEOM
    BUILD --> SOL_CHOL
    BUILD --> SOL_LU
    BUILD --> SOL_QR
    BUILD --> SOL_SVD
    BUILD --> SOL_EIG
    BUILD --> SOL_ITER
    BUILD --> SOL_JAC

    %% Build system also relates to auxiliary assets
    BUILD --> DOC
    BUILD --> DEMO
    BUILD --> TEST
    BUILD --> BENCH
    BUILD --> EXPERIMENTAL

    %% Click Events
    click CORE "https://github.com/libigl/eigen/tree/master/Eigen/Core"
    click DENSE "https://github.com/libigl/eigen/tree/master/Eigen/Dense"
    click SPARSE_TYPES "https://github.com/libigl/eigen/tree/master/Eigen/Sparse"
    click SPARSE_CORE "https://github.com/libigl/eigen/tree/master/Eigen/SparseCore"
    click SOL_CHOL "https://github.com/libigl/eigen/tree/master/Eigen/Cholesky"
    click SOL_LU "https://github.com/libigl/eigen/tree/master/Eigen/LU"
    click SOL_QR "https://github.com/libigl/eigen/tree/master/Eigen/QR"
    click SOL_SVD "https://github.com/libigl/eigen/tree/master/Eigen/SVD"
    click SOL_EIG "https://github.com/libigl/eigen/tree/master/Eigen/Eigenvalues"
    click SOL_ITER "https://github.com/libigl/eigen/tree/master/Eigen/IterativeLinearSolvers"
    click SOL_JAC "https://github.com/libigl/eigen/tree/master/Eigen/Jacobi"
    click GEOM "https://github.com/libigl/eigen/tree/master/Eigen/Geometry"
    click BUILD "https://github.com/libigl/eigen/blob/master/CMakeLists.txt"
    click CMAKE "https://github.com/libigl/eigen/tree/master/cmake/"
    click DOC "https://github.com/libigl/eigen/tree/master/doc/"
    click DEMO "https://github.com/libigl/eigen/tree/master/demos/"
    click TEST "https://github.com/libigl/eigen/tree/master/test/"
    click BENCH "https://github.com/libigl/eigen/tree/master/bench/"
    click EXPERIMENTAL "https://github.com/libigl/eigen/tree/master/unsupported/"

    %% Styles
    classDef core fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef dense fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef sparse fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef solver fill:#FAD7A0,stroke:#B9770E,stroke-width:2px;
    classDef geometry fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef aux fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef experimental fill:#F5CBA7,stroke:#CA6F1E,stroke-width:2px;
```
