Skip to content

Commit

Permalink
Fix cpp function
Browse files Browse the repository at this point in the history
  • Loading branch information
dcajasn committed Jul 10, 2024
1 parent 4815f50 commit c4ee3b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions riskfolio/external/matrix_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
*/

#include <iostream>
#include <iomanip>
#include <vector>
#include <numeric>
#include <map>
#include <Eigen>
#include <Eigen/Core>
#include <Eigen/KroneckerProduct>
Expand All @@ -16,6 +20,12 @@ using namespace std;
using namespace Eigen;
using namespace Spectra;

std::vector<int> cumsum(const std::vector<int>& vec) {
std::vector<int> 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:
Expand Down

0 comments on commit c4ee3b0

Please sign in to comment.