Skip to content

speed up M^(Int/2) #55421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oscardssmith
Copy link
Member

This is a bit faster for normal matrices, but way faster for AbstractMatrix that have a fast sqrt.

julia> M2 = rand(2,2);
julia> @btime sqrt(M2);
  1.969 μs (21 allocations: 1.53 KiB)
julia> @btime M2^.5;
  2.235 μs (31 allocations: 2.19 KiB)
julia> M = @SMatrix rand(2,2);

julia> @btime $M^.5;
  2.245 μs (37 allocations: 2.52 KiB)

julia> @btime sqrt($M);
  5.561 ns (0 allocations: 0 bytes)

@nsajko nsajko added the maths Mathematical functions label Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants