From b1195de909b5b0eed6a10b90f1ec9c82564f1041 Mon Sep 17 00:00:00 2001 From: jariji <96840304+jariji@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:02:12 -0700 Subject: [PATCH] Add inverse of reverse (#33) --- Project.toml | 2 +- src/inverse.jl | 2 ++ test/test_inverse.jl | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a1e0388..883a90f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InverseFunctions" uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.10" +version = "0.1.11" [deps] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/inverse.jl b/src/inverse.jl index 3e21a83..624fd9f 100644 --- a/src/inverse.jl +++ b/src/inverse.jl @@ -160,3 +160,5 @@ inverse(f::Base.Fix2{typeof(divrem)}) = Base.Fix2(invdivrem, f.x) inverse(f::Base.Fix2{typeof(invdivrem)}) = Base.Fix2(divrem, f.x) inverse(f::Base.Fix2{typeof(fldmod)}) = Base.Fix2(invfldmod, f.x) inverse(f::Base.Fix2{typeof(invfldmod)}) = Base.Fix2(fldmod, f.x) + +inverse(::typeof(reverse)) = reverse diff --git a/test/test_inverse.jl b/test/test_inverse.jl index c334a5a..1f0f2e6 100644 --- a/test/test_inverse.jl +++ b/test/test_inverse.jl @@ -60,6 +60,7 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A)) InverseFunctions.test_inverse(f, -x) end InverseFunctions.test_inverse(conj, 2 - 3im) + InverseFunctions.test_inverse(reverse, [10, 20, 30]) x = rand(0:10) for f in (Base.Fix2(divrem, rand([-5:-1; 1:5])), Base.Fix2(fldmod, rand([-5:-1; 1:5])), Base.Fix2(divrem, 0.123), Base.Fix2(fldmod, 0.123))