Skip to content

Commit ae9ab47

Browse files
Merge pull request #75 from yuyichao/0.4-binding
0.4 binding
2 parents 7723130 + fbb7d9c commit ae9ab47

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
lines changed

.travis.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
language: cpp
2-
compiler:
3-
- clang
1+
language: julia
2+
os:
3+
- linux
4+
- osx
5+
julia:
6+
- 0.3
7+
- 0.4
8+
- nightly
49
notifications:
510
email: false
6-
env:
7-
matrix:
8-
- JULIAVERSION="juliareleases"
9-
- JULIAVERSION="julianightlies"
10-
before_install:
11-
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
12-
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
13-
- sudo apt-get update -qq -y
14-
- sudo apt-get install libpcre3-dev julia -y
15-
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
16-
script:
17-
- julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.test("Calculus")'

src/derivative.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ function derivative(f::Function, ftype::Symbol, dtype::Symbol)
88
end
99
return g
1010
end
11-
derivative{T <: Number}(f::Function, x::Union(T, Vector{T}), dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
11+
Compat.@compat derivative{T <: Number}(f::Function, x::Union{T, Vector{T}}, dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
1212
derivative(f::Function, dtype::Symbol = :central) = derivative(f, :scalar, dtype)
1313

14-
gradient{T <: Number}(f::Function, x::Union(T, Vector{T}), dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
14+
Compat.@compat gradient{T <: Number}(f::Function, x::Union{T, Vector{T}}, dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
1515
gradient(f::Function, dtype::Symbol = :central) = derivative(f, :vector, dtype)
1616

1717
ctranspose(f::Function) = derivative(f)
@@ -35,16 +35,16 @@ function second_derivative(f::Function, g::Function, ftype::Symbol, dtype::Symbo
3535
end
3636
return h
3737
end
38-
function second_derivative{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}), dtype::Symbol)
38+
Compat.@compat function second_derivative{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}}, dtype::Symbol)
3939
finite_difference_hessian(f, g, x, dtype)
4040
end
41-
function hessian{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}), dtype::Symbol)
41+
Compat.@compat function hessian{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}}, dtype::Symbol)
4242
finite_difference_hessian(f, g, x, dtype)
4343
end
44-
function second_derivative{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}))
44+
Compat.@compat function second_derivative{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}})
4545
finite_difference_hessian(f, g, x, :central)
4646
end
47-
function hessian{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}))
47+
Compat.@compat function hessian{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}})
4848
finite_difference_hessian(f, g, x, :central)
4949
end
5050
function second_derivative(f::Function, x::Number, dtype::Symbol)

src/differentiate.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,6 @@ function differentiate(ex::Expr, targets::Vector{Symbol})
270270
end
271271

272272
differentiate(ex::Expr) = differentiate(ex, :x)
273-
differentiate(s::String, target...) = differentiate(parse(s), target...)
274-
differentiate(s::String, target::String) = differentiate(parse(s), symbol(target))
275-
differentiate{T <: String}(s::String, targets::Vector{T}) = differentiate(parse(s), map(symbol, targets))
273+
differentiate(s::Compat.AbstractString, target...) = differentiate(parse(s), target...)
274+
differentiate(s::Compat.AbstractString, target::Compat.AbstractString) = differentiate(parse(s), symbol(target))
275+
differentiate{T <: Compat.AbstractString}(s::Compat.AbstractString, targets::Vector{T}) = differentiate(parse(s), map(symbol, targets))

src/symbolic.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
export Symbolic, AbstractVariable, SymbolicVariable, BasicVariable, processExpr, @sexpr
3-
export SymbolParameter, simplify
2+
export SymbolParameter, simplify
43
import Base.show, Base.(==)
54

65
#################################################################
@@ -15,7 +14,7 @@ import Base.show, Base.(==)
1514

1615
abstract Symbolic
1716
abstract AbstractVariable <: Symbolic
18-
typealias SymbolicVariable Union(Symbol, AbstractVariable)
17+
Compat.@compat typealias SymbolicVariable Union{Symbol, AbstractVariable}
1918

2019

2120
#################################################################

0 commit comments

Comments
 (0)