# ttk592/spline architecture

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

- Interactive diagram: https://gitdiagram.com/ttk592/spline
- Repository: https://github.com/ttk592/spline

## Overview

This is a header-only C++ cubic-spline interpolation library. A caller supplies strictly increasing x/y samples and optional spline type, boundary conditions, and monotonicity settings; the library constructs a piecewise polynomial that can be evaluated, differentiated, or solved against a target value. The graph keeps construction, its numerical solver, and the distinct query capabilities separate. The README documents the public workflow; the sampled header excerpt supports construction, evaluation, and solver responsibilities, but does not show every internal call.

Main entry points: [`src/spline.h`](https://github.com/ttk592/spline/blob/master/src/spline.h) (Spline construction)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_spline_api["Spline API<br/>[spline.h]"]
node_boundary_config["Boundary conditions<br/>[spline.h]"]
node_spline_builder["Spline construction<br/>[spline.h]"]
node_band_solver["Band matrix solver<br/>[spline.h]"]
node_monotonicity["Monotonic adjustment<br/>[spline.h]"]
node_evaluation["Value and derivatives<br/>[spline.h]"]
node_extrapolation["Extrapolation<br/>[spline.h]"]
node_root_solving["Spline root solving<br/>[spline.h]"]
node_polynomial_roots["Polynomial root helpers<br/>[spline.h]"]

node_caller -->|"supplies samples"| node_spline_api
node_caller -->|"sets boundaries"| node_boundary_config
node_spline_api -->|"constructs spline"| node_spline_builder
node_boundary_config -->|"configures construction"| node_spline_builder
node_spline_builder -.->|"solves system"| node_band_solver
node_caller -->|"requests adjustment"| node_monotonicity
node_caller -->|"queries value or derivative"| node_evaluation
node_evaluation -->|"evaluates outside range"| node_extrapolation
node_caller -->|"requests roots"| node_root_solving
node_root_solving -.->|"uses root helpers"| node_polynomial_roots

click node_spline_api "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_boundary_config "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_spline_builder "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_band_solver "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_monotonicity "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_evaluation "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_extrapolation "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_root_solving "https://github.com/ttk592/spline/blob/master/src/spline.h"
click node_polynomial_roots "https://github.com/ttk592/spline/blob/master/src/spline.h"

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_caller toneIndigo
class node_spline_api toneMint
class node_boundary_config,node_spline_builder,node_band_solver,node_monotonicity,node_evaluation,node_extrapolation,node_root_solving,node_polynomial_roots toneTeal
```

## Components

### Other components

- **Library caller**
- [Spline API](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Boundary conditions](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Spline construction](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Band matrix solver](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Monotonic adjustment](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Value and derivatives](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Extrapolation](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Spline root solving](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`
- [Polynomial root helpers](https://github.com/ttk592/spline/blob/master/src/spline.h): `src/spline.h`

## Connections

- Library caller → Spline API: supplies samples (evidence: `README.md`)
- Library caller → Boundary conditions: sets boundaries (evidence: `README.md`)
- Spline API → Spline construction: constructs spline (evidence: `README.md`)
- Boundary conditions → Spline construction: configures construction (evidence: `README.md`)
- Spline construction → Band matrix solver: solves system (evidence: `src/spline.h`)
- Library caller → Monotonic adjustment: requests adjustment (evidence: `README.md`)
- Library caller → Value and derivatives: queries value or derivative (evidence: `README.md`)
- Value and derivatives → Extrapolation: evaluates outside range (evidence: `src/spline.h`)
- Library caller → Spline root solving: requests roots (evidence: `README.md`)
- Spline root solving → Polynomial root helpers: uses root helpers (evidence: `src/spline.h`)
