Created
January 24, 2016 10:26
-
-
Save r9y9/20fb3ab5c4a1fccc3150 to your computer and use it in GitHub Desktop.
Julia and C++
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
julia> using ProgressMeter | |
julia> cxx""" | |
#include <iostream> | |
#include <cmath> | |
double FooBar(size_t N) { | |
double result = 0.0; | |
$:(global progress_meter = Progress(icxx"return N;", 1); nothing); | |
for (size_t i = 0; i < N; ++i) { | |
result = log(1+i) + log(2+i); | |
$:(next!(progress_meter); nothing); | |
} | |
return result; | |
} | |
""" | |
true | |
julia> @cxx FooBar(100000000) | |
Progress: 100% Time: 0:00:17 | |
36.84136149790473 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment