Skip to content

Commit

Permalink
add inverse(reim) (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin authored Aug 1, 2023
1 parent b1195de commit d397fef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "InverseFunctions"
uuid = "3587e190-3f89-42d0-90ee-14403ec27112"
version = "0.1.11"
version = "0.1.12"

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
3 changes: 3 additions & 0 deletions src/inverse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,7 @@ 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(reim)) = Base.splat(complex)
inverse(::typeof(Base.splat(complex))) = reim

inverse(::typeof(reverse)) = reverse
4 changes: 4 additions & 0 deletions test/test_inverse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A))
InverseFunctions.test_inverse(inverse(Base.Fix2(divrem, 5)), (-3, -2); compare=(==))
InverseFunctions.test_inverse(inverse(Base.Fix2(fldmod, 5)), (-3, 2); compare=(==))

InverseFunctions.test_inverse(reim, -3; compare=(==))
InverseFunctions.test_inverse(reim, -3+2im; compare=(==))
InverseFunctions.test_inverse(Base.splat(complex), (-3, 2); compare=(==))

A = rand(5, 5)
for f in (
identity, inv, adjoint, transpose,
Expand Down

2 comments on commit d397fef

@oschulz
Copy link
Collaborator

@oschulz oschulz commented on d397fef Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/88786

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.12 -m "<description of version>" d397fef770dd28a78dd0df0d09e94c30b321f4db
git push origin v0.1.12

Please sign in to comment.