-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eafd229
commit 4456e6f
Showing
124 changed files
with
10,200 additions
and
1,214 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
.setup/cpp/cTMed-total-cov.cpp → .setup/cpp/cTMed-exp-cov.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// ----------------------------------------------------------------------------- | ||
// edit .setup/cpp/cTMed-total-cov.cpp | ||
// edit .setup/cpp/cTMed-exp-cov.cpp | ||
// Ivan Jacob Agaloos Pesigan | ||
// ----------------------------------------------------------------------------- | ||
|
||
#include <RcppArmadillo.h> | ||
// [[Rcpp::depends(RcppArmadillo)]] | ||
// [[Rcpp::export(.TotalCov)]] | ||
arma::mat TotalCov(const arma::mat& phi, const arma::mat& sigma, | ||
const double& delta_t) { | ||
// [[Rcpp::export(.ExpCov)]] | ||
arma::mat ExpCov(const arma::mat& phi, const arma::mat& sigma, | ||
const double& delta_t) { | ||
arma::mat I = arma::eye(phi.n_rows, phi.n_cols); | ||
arma::mat J = arma::eye(phi.n_rows * phi.n_cols, phi.n_rows * phi.n_cols); | ||
arma::mat total = arma::expmat(delta_t * phi); | ||
arma::mat beta = arma::expmat(delta_t * phi); | ||
arma::mat phi_hashtag = arma::kron(phi, I) + arma::kron(I, phi); | ||
arma::vec sigma_vec = arma::vectorise(sigma); | ||
arma::vec psi_vec = arma::inv(phi_hashtag) * | ||
(arma::expmat(phi_hashtag * delta_t) - J) * sigma_vec; | ||
return arma::reshape(arma::inv(J - arma::kron(total, total)) * psi_vec, | ||
return arma::reshape(arma::inv(J - arma::kron(beta, beta)) * psi_vec, | ||
phi.n_rows, phi.n_cols); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// ----------------------------------------------------------------------------- | ||
// edit .setup/cpp/cTMed-exp-mean.cpp | ||
// Ivan Jacob Agaloos Pesigan | ||
// ----------------------------------------------------------------------------- | ||
|
||
#include <RcppArmadillo.h> | ||
// [[Rcpp::depends(RcppArmadillo)]] | ||
// [[Rcpp::export(.ExpMean)]] | ||
Rcpp::NumericVector ExpMean(const arma::mat& phi, const arma::vec& iota, | ||
const double& delta_t) { | ||
if (arma::all(iota == 0)) { | ||
return Rcpp::NumericVector(phi.n_rows, 0.0); | ||
} | ||
arma::mat I = arma::eye(phi.n_rows, phi.n_cols); | ||
arma::mat beta = arma::expmat(delta_t * phi); | ||
arma::vec alpha = arma::solve(phi, (beta - I) * iota); | ||
arma::vec mu = arma::solve((I - beta), alpha); | ||
Rcpp::NumericVector output(mu.begin(), mu.end()); | ||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.