Created
January 21, 2019 20:34
-
-
Save jsams/c3635de3179518b2ee0b62644ab5ee26 to your computer and use it in GitHub Desktop.
jessica's slowdown
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
function getprobs(x, a, b) | |
ea = exp.(x * a) | |
eb = exp.(x * b) | |
denom = 1 .+ ea .+ eb | |
proba = ea ./ denom | |
probb = eb ./ denom | |
return proba, probb, 1 .- proba, 1 .- probb | |
end | |
N = 5000000 | |
P = 25 | |
X = randn(N, P) | |
A = rand(P) | |
B = rand(P) | |
@time ans = getprobs(X, A, B); #0.5s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment