From c4ee3b06164be3fa9196dab6ce8c819643b55a2d Mon Sep 17 00:00:00 2001 From: Riskfolio Date: Tue, 9 Jul 2024 19:55:44 -0500 Subject: [PATCH] Fix cpp function --- riskfolio/external/matrix_functions.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/riskfolio/external/matrix_functions.cpp b/riskfolio/external/matrix_functions.cpp index 3d494da7..a74ee7d9 100644 --- a/riskfolio/external/matrix_functions.cpp +++ b/riskfolio/external/matrix_functions.cpp @@ -6,6 +6,10 @@ */ #include +#include +#include +#include +#include #include #include #include @@ -16,6 +20,12 @@ using namespace std; using namespace Eigen; using namespace Spectra; +std::vector cumsum(const std::vector& vec) { + std::vector result(vec.size()); + std::partial_sum(vec.begin(), vec.end(), result.begin()); + return result; +} + /** * Calculate duplication matrix of size "n" as shown * in Magnus, J. R., & Neudecker, H. (1980). The Elimination Matrix: