Skip to content

Commit c4ee3b0

Browse files
committed
Fix cpp function
1 parent 4815f50 commit c4ee3b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

riskfolio/external/matrix_functions.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
*/
77

88
#include <iostream>
9+
#include <iomanip>
10+
#include <vector>
11+
#include <numeric>
12+
#include <map>
913
#include <Eigen>
1014
#include <Eigen/Core>
1115
#include <Eigen/KroneckerProduct>
@@ -16,6 +20,12 @@ using namespace std;
1620
using namespace Eigen;
1721
using namespace Spectra;
1822

23+
std::vector<int> cumsum(const std::vector<int>& vec) {
24+
std::vector<int> result(vec.size());
25+
std::partial_sum(vec.begin(), vec.end(), result.begin());
26+
return result;
27+
}
28+
1929
/**
2030
* Calculate duplication matrix of size "n" as shown
2131
* in Magnus, J. R., & Neudecker, H. (1980). The Elimination Matrix:

0 commit comments

Comments
 (0)