mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 12:08:05 +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:
+2
-10
@@ -17,14 +17,6 @@ CONV applies a sliding dot product between the data window and your custom kerne
|
||||
- **Positive Weights**: Smoothing.
|
||||
- **Mixed Weights**: Differentiation or band-pass filtering.
|
||||
|
||||
### Zero-Allocation Design
|
||||
|
||||
We treat your kernel with the respect it deserves.
|
||||
|
||||
- **RingBuffer**: Stores the price history to avoid array shifting.
|
||||
- **SIMD Dot Product**: The core convolution operation uses hardware intrinsics (`Vector<double>`) to multiply-accumulate the kernel and data window in parallel.
|
||||
- **Branchless Logic**: The circular buffer handling is optimized to minimize branching in the hot path.
|
||||
|
||||
## Mathematical Foundation
|
||||
|
||||
The value at time $t$ is the sum of the element-wise product of the kernel $K$ and the price vector $P$:
|
||||
@@ -34,7 +26,7 @@ $$ \text{CONV}_t = \sum_{i=0}^{N-1} P_{t-i} \cdot K_i $$
|
||||
Where:
|
||||
|
||||
- $N$ is the length of the kernel.
|
||||
- $K_0$ multiplies the most recent price (or oldest, depending on convention; our implementation aligns $K_0$ with the oldest data in the window and $K_{N-1}$ with the newest).
|
||||
- $K_0$ multiplies the most recent price (or oldest, depending on convention; the QuanTAlib implementation aligns $K_0$ with the oldest data in the window and $K_{N-1}$ with the newest).
|
||||
|
||||
## Performance Profile
|
||||
|
||||
@@ -60,5 +52,5 @@ Validated against standard DSP convolution implementations (e.g., SciPy `signal.
|
||||
### Common Pitfalls
|
||||
|
||||
1. **Kernel Direction**: Our implementation applies the kernel such that the last element of the kernel multiplies the most recent data point. If you import kernels from other DSP libraries, you might need to reverse them.
|
||||
2. **Normalization**: We do *not* automatically normalize your kernel. If the sum of your weights is not 1.0, the output scale will be different from the input scale. This is a feature, not a bug (allows for differential filters).
|
||||
2. **Normalization**: Kernel weights are *not* automatically normalized. If the sum of the weights is not 1.0, the output scale will be different from the input scale. This is a feature, not a bug (allows for differential filters).
|
||||
3. **Performance**: A kernel size of 1000 will be 100x slower than a kernel size of 10. Use FFT-based convolution for massive kernels (not implemented here; this is for trading, not searching for extraterrestrial life).
|
||||
|
||||
Reference in New Issue
Block a user