Posts

Showing posts from October, 2017

Improve R's Performance using JuliaCall

Image
Improve R's Performance using JuliaCall Improve R's Performance using JuliaCall with Mandel Set Example What is Mandelbrot Set? Mandelbrot set is the set of complex numbers c for which the sequence {0,  f c (0), f c ( f c (0)), …,  f c ( n ) (0),…} remains bounded in absolute value where function f c ( z )= z 2  +  c . For more detailed introduction, you could go to Wikipedia page for Mandelbrot set . The calculation for Mandelbrot set involves heavy computation, and here we will use JuliaCall to speed up the computation by rewriting R function in Julia, and we will also see some easy and useful tips in writing higher performance Julia code. In this example, we will see that JuliaCall actually brings more than 100 times speedup of the calculation. Pure R Implementation The R implementation for the calculation of Mandelbrot set is quite straightforward. Note that it could be proved that if absolute value of one item in the sequence is greater than 2,