mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 13:08:04 +00:00
Refactor documentation to remove "Zero-Allocation Design" sections across various trend indicators and implement a PowerShell script for automated cleanup
- Updated mathematical foundations and performance profiles where necessary to maintain clarity and coherence.
This commit is contained in:
+1
-14
@@ -14,7 +14,7 @@ The naive implementation of SMA sums $N$ numbers at every step, resulting in $O(
|
||||
|
||||
### O(1) Running Sum
|
||||
|
||||
We maintain a running `Sum` and a `RingBuffer` of history.
|
||||
A running `Sum` and a `RingBuffer` of history are maintained.
|
||||
$$ Sum_{new} = Sum_{old} - Value_{oldest} + Value_{new} $$
|
||||
$$ SMA = \frac{Sum_{new}}{N} $$
|
||||
|
||||
@@ -38,19 +38,6 @@ $$ SMA_t = \frac{1}{N} \sum_{i=0}^{N-1} P_{t-i} $$
|
||||
|
||||
The implementation is optimized for both streaming (latency) and batch (throughput) scenarios.
|
||||
|
||||
### Zero-Allocation Design
|
||||
|
||||
The `RingBuffer` is pre-allocated at initialization. All updates are performed in-place using scalar operations or SIMD intrinsics, ensuring no heap allocations occur during the hot path.
|
||||
|
||||
| Metric | Score | Notes |
|
||||
| :--- | :--- | :--- |
|
||||
| **Throughput** | High | Optimized running sum |
|
||||
| **Complexity** | O(1) | Constant time update |
|
||||
| **Accuracy** | 5/10 | Baseline accuracy, unweighted |
|
||||
| **Timeliness** | 4/10 | Significant lag (N/2) |
|
||||
| **Overshoot** | 8/10 | Generally stable, no projection |
|
||||
| **Smoothness** | 6/10 | Susceptible to "drop-off" effect |
|
||||
|
||||
## Validation
|
||||
|
||||
Validated against TA-Lib (`TA_SMA`) and Skender.Stock.Indicators.
|
||||
|
||||
Reference in New Issue
Block a user