Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
language: cpp
compiler:
- clang
language: julia
os:
- linux
- osx
julia:
- 0.3
- 0.4
- nightly
notifications:
email: false
env:
matrix:
- JULIAVERSION="juliareleases"
- JULIAVERSION="julianightlies"
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
script:
- julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.test("Calculus")'
12 changes: 6 additions & 6 deletions src/derivative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ function derivative(f::Function, ftype::Symbol, dtype::Symbol)
end
return g
end
derivative{T <: Number}(f::Function, x::Union(T, Vector{T}), dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
Compat.@compat derivative{T <: Number}(f::Function, x::Union{T, Vector{T}}, dtype::Symbol = :central) = finite_difference(f, float(x), dtype)
derivative(f::Function, dtype::Symbol = :central) = derivative(f, :scalar, dtype)

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

ctranspose(f::Function) = derivative(f)
Expand All @@ -35,16 +35,16 @@ function second_derivative(f::Function, g::Function, ftype::Symbol, dtype::Symbo
end
return h
end
function second_derivative{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}), dtype::Symbol)
Compat.@compat function second_derivative{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}}, dtype::Symbol)
finite_difference_hessian(f, g, x, dtype)
end
function hessian{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}), dtype::Symbol)
Compat.@compat function hessian{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}}, dtype::Symbol)
finite_difference_hessian(f, g, x, dtype)
end
function second_derivative{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}))
Compat.@compat function second_derivative{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}})
finite_difference_hessian(f, g, x, :central)
end
function hessian{T <: Number}(f::Function, g::Function, x::Union(T, Vector{T}))
Compat.@compat function hessian{T <: Number}(f::Function, g::Function, x::Union{T, Vector{T}})
finite_difference_hessian(f, g, x, :central)
end
function second_derivative(f::Function, x::Number, dtype::Symbol)
Expand Down
6 changes: 3 additions & 3 deletions src/differentiate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,6 @@ function differentiate(ex::Expr, targets::Vector{Symbol})
end

differentiate(ex::Expr) = differentiate(ex, :x)
differentiate(s::String, target...) = differentiate(parse(s), target...)
differentiate(s::String, target::String) = differentiate(parse(s), symbol(target))
differentiate{T <: String}(s::String, targets::Vector{T}) = differentiate(parse(s), map(symbol, targets))
differentiate(s::Compat.AbstractString, target...) = differentiate(parse(s), target...)
differentiate(s::Compat.AbstractString, target::Compat.AbstractString) = differentiate(parse(s), symbol(target))
differentiate{T <: Compat.AbstractString}(s::Compat.AbstractString, targets::Vector{T}) = differentiate(parse(s), map(symbol, targets))
5 changes: 2 additions & 3 deletions src/symbolic.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

export Symbolic, AbstractVariable, SymbolicVariable, BasicVariable, processExpr, @sexpr
export SymbolParameter, simplify
export SymbolParameter, simplify
import Base.show, Base.(==)

#################################################################
Expand All @@ -15,7 +14,7 @@ import Base.show, Base.(==)

abstract Symbolic
abstract AbstractVariable <: Symbolic
typealias SymbolicVariable Union(Symbol, AbstractVariable)
Compat.@compat typealias SymbolicVariable Union{Symbol, AbstractVariable}


#################################################################
Expand Down