Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Start here

This is the recommended learning path for matten.

The goal is to learn tensor-shaped computation in small, readable steps: first numeric tensors, then messy-data cleanup, then visual summaries when shapes or axes become hard to reason about from code alone.

Numeric tensors

If your data is already clean numeric values, follow these examples in order:

StepExampleWhat you learn
1cargo run --example 00_quickstartCreate, add, reshape
2cargo run --example 01_create_tensorAll construction APIs
3cargo run --example 02_shape_and_sizeShape inspection
4cargo run --example 04_elementwise_opsElement-wise arithmetic
5cargo run --example 06_broadcastingNumPy-style broadcasting
6cargo run --example 08_slicing_builderSlice builder API
7cargo run --example 22_matrix_multiplicationdot / matmul
8cargo run --example 27_axis_reductionsRow/column reductions
9cargo run --example 57_visual_shape_axis_summaryShape and axis readability
10cargo run --example 12_boundary_error_handlingSafe error handling

After these ten examples you understand the numeric core.

For the visual side of the same path, see Visual understanding examples. Use that page when you want to check a shape before reading values:

QuestionVisual path
Which dimensions expand during broadcasting?Broadcasting shape alignment
Did reshape change values or only grouping?Reshape, flatten, and transpose
Which matmul dimensions must match?Matmul shape flow
Which dynamic values block numeric conversion?Dynamic readiness

Dynamic ingestion: messy data with dynamic

If your input has missing values, mixed types, or dirty CSV/JSON:

StepExampleWhat you learn
1cargo run --example dynamic_00_quickstart --features dynamic,json,csvDynamic lifecycle
2cargo run --example dynamic_02_missing_values --features dynamic,csvMissing values
3cargo run --example dynamic_05_dirty_csv_cleanup --features dynamic,csvDirty CSV
4cargo run --example dynamic_07_on_ramp_summary --features dynamicFull on-ramp
5cargo run --example dynamic_06_numeric_policy --features dynamicConversion policy
6cargo run --example dynamic_09_visual_readiness_summary --features dynamicReadiness summary

The lifecycle rule

Always follow this pattern with dynamic data:

messy input
  → ingest as dynamic tensor    (from_json_dynamic / from_csv_dynamic)
  → inspect                     (schema_summary, numeric_mask, count_none)
  → clean                       (fill_none, forward_fill_none)
  → convert                     (try_numeric / try_numeric_with)
  → numeric tensor computation  (&a + &b, matmul, sum_axis, …)

Never call arithmetic, reductions, or slicing on a dynamic tensor directly — those APIs reject dynamic tensors with a clear message directing you to try_numeric() first.

Read the two main learning paths like this:

clean numeric values
        |
        v
Tensor<f64>
        |
        v
shape ops, broadcasting, matmul, reductions

messy values
        |
        v
dynamic Tensor<Element>
        |
        v
inspect -> clean -> try_numeric
        |
        v
Tensor<f64>
        |
        v
shape ops, broadcasting, matmul, reductions

If an operation feels confusing, first ask which shape is being kept and which axis is being collapsed. For example, mean_axis(0) on a [rows, columns] matrix collapses rows and leaves one value per column.

When to graduate from matten

matten is the family car: easy to start, honest about its limits. When you need performance, static shapes, or advanced linear algebra, see Migration to specialised libraries.