Created
September 24, 2017 16:54
-
-
Save Non-Contradiction/4d087da7d6bf2caf6a0f3076c6468929 to your computer and use it in GitHub Desktop.
Remez in R
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
fRunge = function(x) 1 / (1 + (5*x)^2) | |
library(JuliaCall) | |
julia_setup() | |
julia_install_package_if_needed("Remez") | |
julia_library("Remez") | |
## the following works for me with the latest version of JuliaCall | |
julia_call('R"fRunge"', 0) | |
## and this should also work | |
julia_assign("fRunge", fRunge) | |
julia_call("fRunge", 0) | |
## this will cause some warning with deprecation which is related to Remez package, | |
## and in one julia session, the same kind of deprecation warning | |
## only appears once, so it should be fine with the second run. | |
julia_command("N,D,E,X = ratfn_minimax(fRunge, (-1, 1), 10, 0)") | |
julia_eval_string("N") | |
julia_eval_string("D") | |
julia_eval_string("E") | |
## a quick and dirty fix for the type conversion | |
julia_command("X1 = vcat([[row[1] row[2]] for row in X]...);") | |
X <- julia_eval_string("X1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment