Skip to content

Commit 6d4ec50

Browse files
committed
Remove Pkg, and increase compat of StaticArrays
1 parent 209edaf commit 6d4ec50

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ version = "1.5.3"
66
[deps]
77
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
9-
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
109
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1110
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1211
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
@@ -35,10 +34,9 @@ GenericLinearAlgebra = "0.3.11"
3534
LaTeXStrings = "1"
3635
Latexify = "0.15, 0.16"
3736
LinearAlgebra = "1"
38-
Pkg = "1.11.0"
3937
PrecompileTools = "1.1.1"
4038
Random = "1"
4139
Requires = "1"
42-
StaticArrays = "1"
40+
StaticArrays = "1.8.1"
4341
Symbolics = "0.1, 1, 2, 3, 4, 5, 6"
4442
julia = "1.6"

ext/QuaternionicChainRulesCoreExt.jl

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,6 @@ isdefined(Base, :get_extension) ?
88
(using ChainRulesCore; import ChainRulesCore: rrule, rrule_via_ad, RuleConfig, ProjectTo) :
99
(using ..ChainRulesCore; import ...ChainRulesCore: rrule, rrule_via_ad, RuleConfig, ProjectTo)
1010

11-
12-
## StaticArrays
13-
# It's likely that StaticArrays will have its own ChainRulesCore extension someday, so we
14-
# need to check if there is already a ProjectTo defined for SArray. If so, we'll use that.
15-
# If not, we'll define one here.
16-
staticarrays_info = Pkg.dependencies()[Base.UUID("90137ffa-7385-5640-81b9-e52037218182")]
17-
if staticarrays_info.version < v"1.8.1"
18-
# These are ripped from https://github.com/JuliaArrays/StaticArrays.jl/pull/1068
19-
function (project::ProjectTo{<:Tangent{<:Tuple}})(dx::SArray)
20-
dy = reshape(dx, axes(project.elements)) # allows for dx::OffsetArray
21-
dz = ntuple(i -> project.elements[i](dy[i]), length(project.elements))
22-
return ChainRulesCore.project_type(project)(dz...)
23-
end
24-
function ProjectTo(x::SArray{S,T}) where {S, T}
25-
return ProjectTo{SArray}(;
26-
element=ChainRulesCore._eltype_projectto(T),
27-
axes=axes(x), size=StaticArrays.Size(x)
28-
)
29-
end
30-
@inline _sarray_from_array(::Size{T}, dx::AbstractArray) where {T} = SArray{Tuple{T...}}(dx)
31-
(project::ProjectTo{SArray})(dx::AbstractArray) = _sarray_from_array(project.size, dx)
32-
function rrule(::Type{T}, x::Tuple) where {T <: SArray}
33-
project_x = ProjectTo(x)
34-
∇Array(∂y) = (NoTangent(), project_x(∂y))
35-
return T(x), ∇Array
36-
end
37-
function rrule(::Type{T}, xs::Number...) where {T <: SVector}
38-
project_x = ProjectTo(xs)
39-
∇Array(∂y) = (NoTangent(), project_x(∂y)...)
40-
return T(xs...), ∇Array
41-
end
42-
end
43-
44-
4511
function rrule(::Type{QT}, arg::AbstractVector) where {QT<:AbstractQuaternion}
4612
AbstractQuaternion_pullback(Δquat) = (NoTangent(), components(unthunk(Δquat)))
4713
return QT(arg), AbstractQuaternion_pullback

0 commit comments

Comments
 (0)