-
Notifications
You must be signed in to change notification settings - Fork 3
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
add exercise05 with julia without for/if #8
base: master
Are you sure you want to change the base?
Conversation
Hi @Shunsuke-Hori, I added the loops as the exercise mentions. Do you have any thoughts on the differences in computing time? |
@vikjam Now, loop version is using dense matrix while vectorized one is using sparse matrix. Let's use the same one and compare them again. Also, we should try with huge data as well. (Having said that, I am not sure if the performance is a serious concern for HP filter because we don't iterate filtering. Typically, we use it just once, right?) |
@vikjam OK, I figured out. My code with sparse matrix is performing very poorly now because it is type unstable.
I'll fix it and push. |
Fixed. Now, even with |
One more note: the vectorized dense matrix code is not so efficient. I am creating a bunch of garbage by |
Hi @Shunsuke-Hori, could you explain this cell? I wanted to add a bit more explanation to the notebook:
|
@vikjam I am making use of multiple dispatch. I wanted to avoid repeating the same code for loop/vectorize/dense/sparse but Thanks to multiple dispatch, Julia recognizes functions differently if input types are different. So, by defining those types, I let julia to construct four functions with same name and same first two arguments but different 3rd and 4th arguments. |
It is not exactly what is asked for because I don't use
for
/if