diff --git a/.travis.yml b/.travis.yml index e31b6b9..5aca9ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ before_install: - curl http://julialang.org/install-julia.sh | sh -s $JULIAVERSION - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi script: - - julia -e 'versioninfo(); Pkg.init(); Pkg.clone(pwd()); Pkg.clone("FactCheck"); Pkg.test("OSXAccelerate")' \ No newline at end of file + - julia -e 'versioninfo(); Pkg.init(); Pkg.clone(pwd()); Pkg.clone("FactCheck"); Pkg.test("AppleAccelerate")' diff --git a/LICENSE.md b/LICENSE.md index 079115d..8d739b0 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -The Accelerate.jl package is licensed under the MIT "Expat" License: +The AppleAccelerate.jl package is licensed under the MIT "Expat" License: > Copyright (c) 2014: Simon Byrne. > diff --git a/README.md b/README.md index e9c1358..10a72a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# OSXAccelerate.jl +# AppleAccelerate.jl -[![Build Status](https://travis-ci.org/simonbyrne/OSXAccelerate.jl.svg?branch=master)](https://travis-ci.org/simonbyrne/OSXAccelerate.jl) +[![Build Status](https://travis-ci.org/simonbyrne/AppleAccelerate.jl.svg?branch=master)](https://travis-ci.org/simonbyrne/AppleAccelerate.jl) This provides a Julia interface to some of [OS X's Accelerate framework](https://developer.apple.com/library/mac/documentation/Accelerate/Reference/AccelerateFWRef/). At @@ -36,29 +36,29 @@ Some additional functions that are also available: To avoid naming conflicts with Base, methods are not exported and so need to be accessed via the namespace: ```julia -using OSXAccelerate +using AppleAccelerate X = randn(1_000_000) @time Y = exp(X) # standard libm function -@time Y = OSXAccelerate.exp(X) # OSXAccelerate array-oriented function +@time Y = AppleAccelerate.exp(X) # AppleAccelerate array-oriented function ``` The `@replaceBase` macro replaces the relevant Base methods directly ```julia -OSXAccelerate.@replaceBase sin cos tan -OSXAccelerate.@replaceBase(.^, ./) # use parenthesised form for infix ops -@time sin(X) # will use OSXAccelerate methods for vectorised operations +AppleAccelerate.@replaceBase sin cos tan +AppleAccelerate.@replaceBase(.^, ./) # use parenthesised form for infix ops +@time sin(X) # will use AppleAccelerate methods for vectorised operations ``` Output arrays can be specified as first arguments of the functions suffixed with `!`: ```julia out = Array(Float64,1_000_000) -@time OSXAccelerate.exp!(out, X) +@time AppleAccelerate.exp!(out, X) ``` **Warning**: no dimension checks are performed on the `!` functions, so ensure your input and output arrays are of the same length. Operations can be performed in-place by specifying the output array as the -input array (e.g. `OSXAccelerate.exp!(X,X)`), but this is not mentioned in the -OSXAccelerate docs, so do this at your own risk! +input array (e.g. `AppleAccelerate.exp!(X,X)`), but this is not mentioned in the +AppleAccelerate docs, so do this at your own risk! diff --git a/src/OSXAccelerate.jl b/src/AppleAccelerate.jl similarity index 99% rename from src/OSXAccelerate.jl rename to src/AppleAccelerate.jl index 2f77938..355c961 100644 --- a/src/OSXAccelerate.jl +++ b/src/AppleAccelerate.jl @@ -1,4 +1,4 @@ -module OSXAccelerate +module AppleAccelerate const libacc = "/System/Library/Frameworks/Accelerate.framework/Accelerate" diff --git a/test/runtests.jl b/test/runtests.jl index bcfbe3a..28ae757 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using OSXAccelerate +using AppleAccelerate using FactCheck srand(7) @@ -9,7 +9,7 @@ facts("Rounding") do X = 100*randn(N) for f in [:floor,:ceil,:trunc,:round] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => fb(X) "Mismatch for $f" end end @@ -19,19 +19,19 @@ facts("Logarithmic/exponential") do X = 100*randn(N) for f in [:exp,:exp2,:expm1] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end X = exp(10*randn(N)) for f in [:log,:log2,:log10] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end X = expm1(10*randn(N)) for f in [:log1p] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end end @@ -40,21 +40,21 @@ facts("Trigonometric") do X = 10*randn(N) for f in [:sin,:sinpi,:cos,:cospi,:tan,:atan] # tanpi not defined in Base @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end Y = 10*randn(N) for f in [:atan2] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X,Y) => roughly(fb(X,Y)) "Mismatch for $f" end X = 2*rand(N)-1 for f in [:asin,:acos] # tanpi not defined in Base @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end end @@ -64,21 +64,21 @@ facts("Hyperbolic") do X = 10*randn(N) for f in [:sinh,:cosh,:tanh,:asinh] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end X = exp(10*randn(N))+1 for f in [:acosh] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end X = 2*rand(N)-1 for f in [:atanh] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end end @@ -88,37 +88,37 @@ facts("Misc.") do X = exp(10*randn(N)) for f in [:sqrt] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end X = 10*randn(N) for f in [:exponent, :abs] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X) => roughly(fb(X)) "Mismatch for $f" end Y = 10*randn(N) for f in [:copysign] @eval fb = $f - @eval fa = OSXAccelerate.$f + @eval fa = AppleAccelerate.$f @fact fa(X,Y) => roughly(fb(X,Y)) "Mismatch for $f" end - @fact OSXAccelerate.rem(X,Y) => [rem(X[i], Y[i]) for i=1:length(X)] # no vectorized rem + @fact AppleAccelerate.rem(X,Y) => [rem(X[i], Y[i]) for i=1:length(X)] # no vectorized rem end facts("Extra") do X = randn(N) Y = abs(randn(N)) - @fact OSXAccelerate.rec(X) => roughly(1./X) - @fact OSXAccelerate.rsqrt(Y) => roughly(1./sqrt(Y)) - @fact OSXAccelerate.pow(Y,X) => roughly(Y.^X) - @fact OSXAccelerate.div(X,Y) => roughly(X./Y) + @fact AppleAccelerate.rec(X) => roughly(1./X) + @fact AppleAccelerate.rsqrt(Y) => roughly(1./sqrt(Y)) + @fact AppleAccelerate.pow(Y,X) => roughly(Y.^X) + @fact AppleAccelerate.div(X,Y) => roughly(X./Y) - @fact [OSXAccelerate.sincos(X)...] => roughly([sin(X),cos(X)]) - @fact OSXAccelerate.cosisin(X) => roughly(cos(X)+im*sin(X)) + @fact [AppleAccelerate.sincos(X)...] => roughly([sin(X),cos(X)]) + @fact AppleAccelerate.cosisin(X) => roughly(cos(X)+im*sin(X)) end @@ -126,11 +126,11 @@ facts("Replace Base") do X = randn(N) Y = abs(randn(N)) - OSXAccelerate.@replaceBase(sin,atan2,./,.^) - @fact sin(X) => OSXAccelerate.sin(X) - @fact atan2(X,Y) => OSXAccelerate.atan2(X,Y) - @fact X ./ Y => OSXAccelerate.div(X,Y) - @fact Y ./ X => OSXAccelerate.div(Y,X) + AppleAccelerate.@replaceBase(sin,atan2,./,.^) + @fact sin(X) => AppleAccelerate.sin(X) + @fact atan2(X,Y) => AppleAccelerate.atan2(X,Y) + @fact X ./ Y => AppleAccelerate.div(X,Y) + @fact Y ./ X => AppleAccelerate.div(Y,X) end FactCheck.exitstatus()