Skip to content

Commit 9cbd53c

Browse files
authored
Merge pull request #9 from JuliaMath/anj/06
Update to work on 0.6
2 parents 9a292f7 + c5231c0 commit 9cbd53c

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: julia
2+
os:
3+
- linux
4+
- osx
5+
julia:
6+
- 0.5
7+
- nightly
8+
notifications:
9+
email: false
10+
sudo: false
11+
after_success:
12+
- julia -e 'cd(Pkg.dir("VML")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'

src/VML.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module VML
22

3+
import Base: .^, ./
4+
35
# TODO detect CPU architecture
46
const lib = :libmkl_vml_avx
57
Libdl.dlopen(:libmkl_rt)
@@ -49,7 +51,7 @@ function vml_prefix(t::DataType)
4951
end
5052

5153
function def_unary_op(tin, tout, jlname, jlname!, mklname)
52-
mklfn = Base.Meta.quot(symbol("$(vml_prefix(tin))$mklname"))
54+
mklfn = Base.Meta.quot(Symbol("$(vml_prefix(tin))$mklname"))
5355
exports = Symbol[]
5456
isa(jlname, Expr) || push!(exports, jlname)
5557
isa(jlname!, Expr) || push!(exports, jlname!)
@@ -80,7 +82,7 @@ function def_unary_op(tin, tout, jlname, jlname!, mklname)
8082
end
8183

8284
function def_binary_op(tin, tout, jlname, jlname!, mklname, broadcast)
83-
mklfn = Base.Meta.quot(symbol("$(vml_prefix(tin))$mklname"))
85+
mklfn = Base.Meta.quot(Symbol("$(vml_prefix(tin))$mklname"))
8486
exports = Symbol[]
8587
isa(jlname, Expr) || push!(exports, jlname)
8688
isa(jlname!, Expr) || push!(exports, jlname!)
@@ -113,8 +115,8 @@ for t in (Float32, Float64, Complex64, Complex128)
113115
def_unary_op(t, t, :(Base.log), :log!, :Ln)
114116

115117
# Binary, real or complex
116-
def_binary_op(t, t, :(Base.(:.^)), :pow!, :Pow, true)
117-
def_binary_op(t, t, :(Base.(:./)), :divide!, :Div, true)
118+
def_binary_op(t, t, :(.^), :pow!, :Pow, true)
119+
def_binary_op(t, t, :(./), :divide!, :Div, true)
118120
end
119121

120122
for t in (Float32, Float64)
@@ -153,7 +155,7 @@ for t in (Float32, Float64)
153155
def_unary_op(t, t, :(Base.log10), :log10!, :Log10)
154156

155157
# .^ to scalar power
156-
mklfn = Base.Meta.quot(symbol("$(vml_prefix(t))Powx"))
158+
mklfn = Base.Meta.quot(Symbol("$(vml_prefix(t))Powx"))
157159
@eval begin
158160
export pow!
159161
function pow!{N}(out::Array{$t,N}, A::Array{$t,N}, b::$t)
@@ -162,7 +164,7 @@ for t in (Float32, Float64)
162164
vml_check_error()
163165
out
164166
end
165-
function Base.(:(.^)){N}(A::Array{$t,N}, b::$t)
167+
function (.^){N}(A::Array{$t,N}, b::$t)
166168
out = similar(A)
167169
ccall(($mklfn, lib), Void, (Int, Ptr{$t}, $t, Ptr{$t}), length(A), A, b, out)
168170
vml_check_error()

test/common.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const base_unary_real = (
3535
const base_binary_real = (
3636
(Base.atan2, (-1, 1), (-1, 1)),
3737
(Base.hypot, (-1000, 1000), (-1000, 1000)),
38-
(Base.(:./), (-1000, 1000), (-1000, 1000)),
39-
(Base.(:.^), (0, 100), (-5, 20))
38+
(getfield(Base, :./), (-1000, 1000), (-1000, 1000)),
39+
(getfield(Base, :.^), (0, 100), (-5, 20))
4040
)
4141

4242
const base_unary_complex = (
@@ -62,7 +62,7 @@ const base_unary_complex = (
6262
)
6363

6464
const base_binary_complex = (
65-
(Base.(:./), (-1000, 1000), (-1000, 1000)),
65+
(getfield(Base, :./), (-1000, 1000), (-1000, 1000)),
6666
# (Base.(:.^), (0, 100), (-2, 10))
6767
)
6868

test/runtests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
run(`$(joinpath(JULIA_HOME, "julia")) $(joinpath(dirname(@__FILE__), "real.jl"))`)
2-
run(`$(joinpath(JULIA_HOME, "julia")) $(joinpath(dirname(@__FILE__), "complex.jl"))`)
1+
include("common.jl")

0 commit comments

Comments
 (0)