JuliaMath / JuliaMath/RealDot.jl

more efficient realdot for arrays

Open
#6 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Right now you use `real(LinearAlgebra.dot(x, y))`, which does twice as much work as necessary for complex arrays.

You could do e.g.
```jl
realdot(x::Vector{Complex{T}}, y::Vector{Complex{T}}) where {T} = dot(reinterpret(T, x), reinterpret(T, y))
```
and similar…

Or you could just write out the loop (two `muladd` calls per complex entry, with `@simd`), since BLAS doesn't have much of an advantage for this type of operation.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.