Skip to content

Commit

Permalink
adjust npca
Browse files Browse the repository at this point in the history
  • Loading branch information
a91quaini committed Jul 29, 2024
1 parent eb6b3e7 commit c20a5d9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/n_pca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ unsigned int NPCA_GiglioXiu2021Cpp(
unsigned int n_max
) {

// minimum between n_assets and n_observations
const unsigned int min_NT = std::min(n_assets, n_observations);

// if n_max <= zero or >= n_assets, set it to n_assets - 1
if (n_max <= 0 || n_max >= min_NT) {
n_max = min_NT - 1;
if (n_max <= 0 || n_max >= evals.n_elem) {
n_max = evals.n_elem - 1;
}

// compute the penalty term
Expand Down

0 comments on commit c20a5d9

Please sign in to comment.