Skip to content

Conversation

sethaxen
Copy link
Collaborator

This PR is the companion of JuliaGeometry/Quaternions.jl#56. Like that PR for quaternions, it draws on a more general result that allows us to extend all complex analytic functions in Base to the octonions with a function extend_analytic.

Since extend_analytic is faster than the current implementations of sqrt and exp, those are refactored to use it. The PR also speeds up log and, for clarity, refactors it to adopt the same notation as extend_analytic.

Here's a performance comparison:

julia> using Octonions, BenchmarkTools

julia> o = randn(OctonionF64);

Before:

julia> @btime exp($o);
  54.570 ns (0 allocations: 0 bytes)

julia> @btime sqrt($o);
  184.861 ns (0 allocations: 0 bytes)

julia> @btime log($o);
  99.939 ns (0 allocations: 0 bytes)

After:

julia> @btime exp($o);
  42.833 ns (0 allocations: 0 bytes)

julia> @btime sqrt($o);
  38.143 ns (0 allocations: 0 bytes)

julia> @btime log($o);
  67.569 ns (0 allocations: 0 bytes)

@sethaxen sethaxen requested a review from hyrodium January 25, 2023 00:13
@codecov
Copy link

codecov bot commented Jan 25, 2023

Codecov Report

Merging #16 (8c0525c) into main (2bc326b) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #16   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           92       101    +9     
=========================================
+ Hits            92       101    +9     
Impacted Files Coverage Δ
src/octonion.jl 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@hyrodium hyrodium left a comment

Choose a reason for hiding this comment

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

LGTM!

@sethaxen sethaxen merged commit 694e3ca into main Jan 25, 2023
@sethaxen sethaxen deleted the extendanalytic branch January 25, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants