# huffedkerd1/nabla architecture

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

- Interactive diagram: https://gitdiagram.com/huffedkerd1/nabla
- Repository: https://github.com/huffedkerd1/nabla

## Overview

This is a small C++ tensor library. Its demonstrated workflow constructs a tensor from values and a shape, then exposes shape and view operations; the sample entry point calls `expand` and `shape`. Tensor storage owns the underlying float buffer, while arithmetic operators and standalone broadcasting utilities provide additional capabilities. The excerpts show no use of broadcasting by the sample or arithmetic operators, so those are represented separately. `nn/base/operation.hpp` is only an empty stub. The graph reflects sampled code; the README is empty.

Main entry points: [`tensor/src/tensor.cpp`](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/tensor.cpp) (Tensor core), [`tensor/src/operators/arithmetic.cpp`](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/operators/arithmetic.cpp) (Arithmetic operators), [`tensor/main.cpp`](https://github.com/huffedkerd1/nabla/blob/master/tensor/main.cpp) (Tensor sample), [`tensor/src/storage.cpp`](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/storage.cpp) (Float storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry point"]
  node_sample["Tensor sample<br/>[main.cpp]"]
end

subgraph group_tensor["Tensor operations"]
  node_tensor_core["Tensor core<br/>[tensor.cpp]"]
  node_arithmetic["Arithmetic operators<br/>[arithmetic.cpp]"]
end

subgraph group_memory["Memory storage"]
  node_storage[("Float storage<br/>[storage.cpp]")]
end

subgraph group_shape["Shape utilities"]
  node_broadcasting["Broadcasting utilities<br/>[broadcasting.cpp]"]
end

node_user(("Caller"))

node_user -->|"runs"| node_sample
node_sample -->|"constructs and expands"| node_tensor_core
node_tensor_core -->|"allocates and reads"| node_storage
node_arithmetic -->|"reads values"| node_storage
node_arithmetic -->|"constructs results"| node_tensor_core

click node_sample "https://github.com/huffedkerd1/nabla/blob/master/tensor/main.cpp"
click node_tensor_core "https://github.com/huffedkerd1/nabla/blob/master/tensor/src/tensor.cpp"
click node_arithmetic "https://github.com/huffedkerd1/nabla/blob/master/tensor/src/operators/arithmetic.cpp"
click node_storage "https://github.com/huffedkerd1/nabla/blob/master/tensor/src/storage.cpp"
click node_broadcasting "https://github.com/huffedkerd1/nabla/blob/master/tensor/src/broadcasting.cpp"

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_sample toneBlue
class node_tensor_core,node_arithmetic toneAmber
class node_storage toneMint
class node_broadcasting toneRose
class node_user toneIndigo
```

## Components

### Entry point

- [Tensor sample](https://github.com/huffedkerd1/nabla/blob/master/tensor/main.cpp): `tensor/main.cpp`

### Tensor operations

- [Tensor core](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/tensor.cpp): `tensor/src/tensor.cpp`
- [Arithmetic operators](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/operators/arithmetic.cpp): `tensor/src/operators/arithmetic.cpp`

### Memory storage

- [Float storage](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/storage.cpp): `tensor/src/storage.cpp`

### Shape utilities

- [Broadcasting utilities](https://github.com/huffedkerd1/nabla/blob/master/tensor/src/broadcasting.cpp): `tensor/src/broadcasting.cpp`

### Other components

- **Caller**

## Connections

- Caller → Tensor sample: runs (evidence: `tensor/main.cpp`)
- Tensor sample → Tensor core: constructs and expands (evidence: `tensor/main.cpp`)
- Tensor core → Float storage: allocates and reads (evidence: `tensor/src/tensor.cpp`)
- Arithmetic operators → Float storage: reads values (evidence: `tensor/src/operators/arithmetic.cpp`)
- Arithmetic operators → Tensor core: constructs results (evidence: `tensor/src/operators/arithmetic.cpp`)
