mlubin / ReverseDiffSparse.jl

Reverse-mode automatic differentiation for sparse Hessians
Other
24 stars 12 forks source link

WIP: Overwrite ^() so that is doesn't throw DomainError #6

Closed davidanthoff closed 10 years ago

davidanthoff commented 10 years ago

This is meant to address this JuliaOpt/JuMP.jl#318

There is still a problem with this: this patch overwrites the general ^ function, which we don't want.

When I use the package with this patch I get this:

julia> using ReverseDiffSparse
Warning: Method definition ^(Float64,Float64) in module Math at math.jl:252 overwritten in module ReverseDiffSparse at C:\Users\anthoff\.julia\v0.3\ReverseDiffSparse\src\revmode.jl:291.

I actually don't understand why that happens for the ^ method, but not for log, which is overwritten in the line above it? Essentially we should have this overwrite ONLY apply for the ReverseDiff package, nothing else, i.e. this should work in the same way as the existing line above it.

@mlubin can you take a look? Thanks!

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.0%) when pulling d948df39f29549cedce7359453481a2af880f8aa on davidanthoff:patchexponent into 5cc7d9abe0e41e8c93fe4824220a1612bf6a4963 on mlubin:master.

mlubin commented 10 years ago

Operators from base are automatically imported into modules, which is why defining ^ replaces the built-in while defining log doesn't.