Last active
December 21, 2015 05:19
-
-
Save 9il/6255903 to your computer and use it in GitHub Desktop.
SIMD implementation of dot-product for complex numbers (sum(a_i * conj(b_i])))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(; ap < sbe; ap+=4*M, bp+=4*M) | |
{ | |
auto a0 = load(cast(VP)ap+0); | |
auto a1 = load(cast(VP)ap+1); | |
auto a2 = load(cast(VP)ap+2); | |
auto a3 = load(cast(VP)ap+3); | |
auto b0 = load(cast(VP)bp+0); | |
auto b1 = load(cast(VP)bp+1); | |
auto b2 = load(cast(VP)bp+2); | |
auto b3 = load(cast(VP)bp+3); | |
s0 += a0 * b0; | |
s1 += a1 * b1; | |
s2 += a2 * b2; | |
s3 += a3 * b3; | |
//swap real and imaginary parts | |
a0 = swapReIm(a0); | |
a1 = swapReIm(a1); | |
a2 = swapReIm(a2); | |
a3 = swapReIm(a3); | |
r0 += a0 * b0; | |
r1 += a1 * b1; | |
r2 += a2 * b2; | |
r3 += a3 * b3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment