About this question
Medium · low_latency · Quant Developer interview question · simd, avx2, horizontal-sum, low_latency, portfolio, vectorization
Risk engines in quantitative finance require low-latency aggregation of portfolio positions. This is often achieved through a horizontal sum, which reduces a vector of values to a single scalar total. Implementing the scalar equivalent of a SIMD horizontal add (hadd) is a fundamental building block for such high-performance computations. Task Implement the function horizontal_sum(const double p) which accepts a pointer to an array of four double values and returns their sum as a single double.
Keep practicing