# Polyester.jl: how to properly pass complex hermitian conjugate?

**URL:** https://discourse.julialang.org/t/polyester-jl-how-to-properly-pass-complex-hermitian-conjugate/132866
**Category:** General Usage
**Created:** [October 3, 2025, 8:49pm UTC](https://discourse.julialang.org/t/polyester-jl-how-to-properly-pass-complex-hermitian-conjugate/132866 "2025-10-03T20:49:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Egwene\_al\_Vere](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)
#### Post date: [October 3, 2025, 8:49pm UTC](https://discourse.julialang.org/t/polyester-jl-how-to-properly-pass-complex-hermitian-conjugate/132866/1 "2025-10-03T20:49:08Z")

</div>

Polyester mentions that it

> moves arrays to threads by turning them into StrideArraysCore.PtrArrays. This means that under an `@batch` slices will create views by default(!). You may want to start Julia with --check-bounds=yes while debugging.

but it may also cause issues when passing the hermitian conjugate (complex transpose) `m'` ?  
case in point, consider this matrix multiplication function (T in sum\_ab is for later use with dual numbers):

```julia
using Polyester

function sum_ab(a, b, i, j, _::T) where {T}
    ab_sum = zero(T)
    for k in axes(a, 2)
        ab_sum = muladd(a[i, k], b[k, j], ab_sum)
    end
    ab_sum
end

function mmul!(c, a, b)
    c1 = c[1]
    @batch for i in axes(c, 1)
        for j in axes(c, 2)
            c[i, j] = sum_ab(a, b, i, j, c1)
        end
    end
    c
end

x, y, z = [rand(5, 5) for _ in 1:3];
mmul!(z, x, y')
z ≈ x * y' # true/expected

xc, yc, zc = [rand(ComplexF64, 5, 5) for _ in 1:3];
mmul!(zc, xc, yc')
zc ≈ xc * yc' # false!!
zc ≈ xc * conj.(yc)' # true!!

disable_polyester_threads() do
    mmul!(zc, xc, yc')
end
zc ≈ xc * yc' # true/expected

```

how do one correctly write the functions involving passing `m'` for `m::Matrix{ComplexF64}`? manually set conjugate for xomplex inputs seems hacky

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [October 4, 2025, 4:36am UTC](https://discourse.julialang.org/t/polyester-jl-how-to-properly-pass-complex-hermitian-conjugate/132866/2 "2025-10-04T04:36:53Z")

</div>

I would just take it as an inherent limitation of the package that you have to workaround. I don’t think that’ll get changed.
