Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorized RVineSim #69

Closed
wants to merge 1 commit into from
Closed

Vectorized RVineSim #69

wants to merge 1 commit into from

Conversation

notEvil
Copy link
Contributor

@notEvil notEvil commented Feb 28, 2020

See #68

Its intentionally not ready for merge!

  • the code is duplicated to simplify validation
  • the original code is commented out to show that the implementation is very close to the existing one
  • the implementation uses the existing variable names
  • the implementation replaces the C-code (which was not the main goal)
r_vine_matrix = VineCopula::RVineMatrix(matrix(c(2, 0, 0, 2, 3, 0, 2, 3, 1), nrow=3), family=matrix(c(0, 0, 0, 1, 0, 0, 1, 1, 0), nrow=3), par=matrix(c(0, 0, 0, 0.3, 0, 0, 0.2, 0.1, 0), nrow=3))
r_vine_matrix
VineCopula::RVineMatrixNormalize(r_vine_matrix)

n = 1e4
seed = as.numeric(Sys.time())

set.seed(seed)
a = VineCopula::RVineSim(n, r_vine_matrix)

set.seed(seed)
b = VineCopula::RVineSim2(n, r_vine_matrix)

all.equal(a, b)

@tnagler
Copy link
Owner

tnagler commented Mar 2, 2020

see #70.

I cleaned the code and only call the vectorized version when necessary. Your R-version had a 1.5x-2x overhead in the "usual" case, which I would like to avoid. Maybe you can check briefly if everything works as expected.

@tnagler tnagler closed this Mar 2, 2020
tnagler added a commit that referenced this pull request Mar 3, 2020
* - added vectorized RVineSim as RVineSim2

* cleanup

Co-authored-by: notEvil <a_rappold@gmx.at>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants