Parametric Algorithms
One algorithm, many specialized versions.
One Algorithm, Many Shapes
A parametric algorithm describes the logic once, then lets compile-time parameters mint a specialized version for each size, type, or width you need. ⚙️
Parameters Carry the Variation
Anything that changes the code's structure, like a vector width or element type, becomes a parameter instead of a runtime argument.
fn sum[width: Int](data: SIMD[DType.float32, width]) -> Float32:
return data.reduce_add()All lessons in this course
- Parametric Algorithms
- Compile-Time Loop Unrolling
- Conditional Compilation
- Constraints and Static Checks