Skip to content

Commit

Permalink
Deprecate DiffEqBase.fastpow for FastPower.fastpower
Browse files Browse the repository at this point in the history
This requires the registration to finish but will finally make it more accessible to Symbolics and other tooling.
  • Loading branch information
ChrisRackauckas committed Oct 5, 2024
1 parent 6bce332 commit 35aa77a
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 126 deletions.
4 changes: 1 addition & 3 deletions ext/DiffEqBaseEnzymeExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module DiffEqBaseEnzymeExt

using DiffEqBase
import DiffEqBase: value, fastpow
import DiffEqBase: value
using Enzyme
import Enzyme: Const
using ChainRulesCore
Expand Down Expand Up @@ -53,6 +53,4 @@ function Enzyme.EnzymeRules.reverse(config::Enzyme.EnzymeRules.RevConfigWidth{1}
return ntuple(_ -> nothing, Val(length(args) + 4))
end

Enzyme.Compiler.known_ops[typeof(DiffEqBase.fastpow)] = (:pow, 2, nothing)

end
2 changes: 0 additions & 2 deletions ext/DiffEqBaseMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ DiffEqBase.promote_u0(u0, p::AbstractArray{<:Measurements.Measurement}, t0) = el
value(x::Type{Measurements.Measurement{T}}) where {T} = T
value(x::Measurements.Measurement) = Measurements.value(x)

@inline DiffEqBase.fastpow(x::Measurements.Measurement, y::Measurements.Measurement) = x^y

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
5 changes: 0 additions & 5 deletions ext/DiffEqBaseMonteCarloMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ end
DiffEqBase.value(x::Type{MonteCarloMeasurements.AbstractParticles{T, N}}) where {T, N} = T
DiffEqBase.value(x::MonteCarloMeasurements.AbstractParticles) = mean(x.particles)

@inline function DiffEqBase.fastpow(x::MonteCarloMeasurements.AbstractParticles,
y::MonteCarloMeasurements.AbstractParticles)
x^y
end

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
1 change: 0 additions & 1 deletion ext/DiffEqBaseTrackerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ end
DiffEqBase.promote_u0(u0, p::Tracker.TrackedArray, t0) = Tracker.track(u0)
DiffEqBase.promote_u0(u0, p::AbstractArray{<:Tracker.TrackedReal}, t0) = eltype(p).(u0)

@inline DiffEqBase.fastpow(x::Tracker.TrackedReal, y::Tracker.TrackedReal) = x^y
@inline Base.any(f::Function, x::Tracker.TrackedArray) = any(f, Tracker.data(x))

# Support adaptive with non-tracked time
Expand Down
4 changes: 3 additions & 1 deletion src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ end

import PrecompileTools

import FastPower
@deprecate fastpow(x,y) Fastpower.fastpower(x,y)

using ArrayInterface

using StaticArraysCore # data arrays
Expand Down Expand Up @@ -128,7 +131,6 @@ abstract type DECostFunction end
import SciMLBase: Void, unwrapped_f

include("utils.jl")
include("fastpow.jl")
include("stats.jl")
include("calculate_residuals.jl")
include("tableaus.jl")
Expand Down
71 changes: 0 additions & 71 deletions src/fastpow.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/forwarddiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,6 @@ end
value(x::Type{ForwardDiff.Dual{T, V, N}}) where {T, V, N} = V
value(x::ForwardDiff.Dual) = value(ForwardDiff.value(x))

@inline fastpow(x::ForwardDiff.Dual, y::ForwardDiff.Dual) = x^y

sse(x::Number) = abs2(x)
sse(x::ForwardDiff.Dual) = sse(ForwardDiff.value(x)) + sum(sse, ForwardDiff.partials(x))
totallength(x::Number) = 1
Expand Down
25 changes: 0 additions & 25 deletions test/downstream/enzyme.jl

This file was deleted.

15 changes: 0 additions & 15 deletions test/fastpow.jl

This file was deleted.

1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ end

@time begin
if GROUP == "All" || GROUP == "Core"
@time @safetestset "Fast Power" include("fastpow.jl")
@time @safetestset "Callbacks" include("callbacks.jl")
@time @safetestset "Internal Rootfinders" include("internal_rootfinder.jl")
@time @safetestset "Plot Vars" include("plot_vars.jl")
Expand Down

0 comments on commit 35aa77a

Please sign in to comment.