Summary
Add the Triangular distribution. The PDF and CDF are piecewise linear with no transcendental functions — pure arithmetic, trivially SIMD-vectorisable via blend/select operations.
Parametrisation
Lower bound a, upper bound b, mode c (a ≤ c ≤ b). Support: [a, b].
PDF(x) = 2(x-a) / ((b-a)(c-a)) for a ≤ x ≤ c
2(b-x) / ((b-a)(b-c)) for c < x ≤ b
CDF(x) = (x-a)² / ((b-a)(c-a)) for a ≤ x ≤ c
1 - (b-x)² / ((b-a)(b-c)) for c < x ≤ b
Properties
- Mean = (a + b + c) / 3
- Variance = (a² + b² + c² - ab - ac - bc) / 18
- Skewness: closed form
- MLE: a = min, b = max, c = mode (sample mode). Often used as a three-point estimate distribution where only min/mode/max are available.
- Entropy = 0.5 + log((b-a)/2)
- Use cases: PERT project scheduling, risk modelling (three-point estimates), simulation when data is scarce
Implementation notes
- No transcendental functions; the batch path is pure arithmetic with a branch on x ≤ c. This is the SIMD blend candidate —
vector_blend(x ≤ c, left_arm, right_arm) — but the vector_blend primitive is currently deferred (see AGENTS.md §Deferred Items). Until vector_blend is added, use a scalar loop or two-pass approach (compute both arms, select).
- Even without
vector_blend, the vectorised approach (compute both arms with SIMD arithmetic, then blend with _mm256_blendv_pd) is straightforward to implement inline within the Triangular batch method without needing a generic primitive.
- Dispatch thresholds: trivially arithmetic — likely NEVER for parallel dispatch (similar to Uniform); calibrate after implementation.
is_delegation_wrapper = false; standalone implementation.
- Quantile (PPF): two closed-form branches, invertible directly.
- Note:
c = (a + b) / 2 gives the symmetric triangular distribution.
Summary
Add the Triangular distribution. The PDF and CDF are piecewise linear with no transcendental functions — pure arithmetic, trivially SIMD-vectorisable via blend/select operations.
Parametrisation
Lower bound a, upper bound b, mode c (a ≤ c ≤ b). Support: [a, b].
Properties
Implementation notes
vector_blend(x ≤ c, left_arm, right_arm)— but thevector_blendprimitive is currently deferred (see AGENTS.md §Deferred Items). Untilvector_blendis added, use a scalar loop or two-pass approach (compute both arms, select).vector_blend, the vectorised approach (compute both arms with SIMD arithmetic, then blend with_mm256_blendv_pd) is straightforward to implement inline within the Triangular batch method without needing a generic primitive.is_delegation_wrapper = false; standalone implementation.c = (a + b) / 2gives the symmetric triangular distribution.