lukas-weber / Carlo.jl

Monte Carlo framework that provides MPI parallelization, checkpointing and statistical postprocessing in an algorithm-agnostic way.
MIT License
28 stars 2 forks source link

BUG: Complex observables are not evaluable #12

Closed hz-xiaxz closed 1 month ago

hz-xiaxz commented 1 month ago

Error occurs when evaluating complex observables.

ERROR: LoadError: MethodError: no method matching Carlo.Evaluable(::Int64, ::Int64, ::Int64, ::Vector{ComplexF64}, ::Vector{ComplexF64})

Closest candidates are:
  Carlo.Evaluable(::Int64, ::Int64, ::Int64, !Matched::Vector{T}, !Matched::Vector{T}) where T<:AbstractFloat
   @ Carlo ~/.julia/dev/Carlo/src/evaluable.jl:3

this is because of the definition of struct Evaluable

struct Evaluable{T<:AbstractFloat}
    internal_bin_length::Int64
    rebin_length::Int64
    rebin_count::Int64

    mean::Vector{T}
    error::Vector{T}
end

where

julia> ComplexF64 isa AbstractFloat
false
hz-xiaxz commented 1 month ago

How to perform jackknife reasonably on complex number datasets is a question. I will try to find some reference later, or we should find another suitable way to resample complex numbers.

lukas-weber commented 1 month ago

Ah, thanks forgot to test that feature!

-------- Original Message -------- On 7/28/24 12:01, LeoXia wrote:

Error occurs when evaluating complex observables.

ERROR

:

LoadError

:

MethodError

:

no method matching Carlo

.

Evaluable

(

::

Int64

,

::

Int64

,

::

Int64

,

::

Vector{ComplexF64}

,

::

Vector{ComplexF64}

)

Closest candidates are

:

Carlo

.

Evaluable

(

::

Int64

,

::

Int64

,

::

Int64

,

!

Matched

::

Vector{T}

,

!

Matched

::

Vector{T}

)

where

T

<:

AbstractFloat

@ Carlo

~

/

.

julia

/

dev

/

Carlo

/

src

/

evaluable

.

jl

:

3

this is because of the definition of struct Evaluable

struct

Evaluable{T

<:

AbstractFloat

} internal_bin_length

::

Int64

rebin_length

::

Int64

rebin_count

::

Int64

mean

::

Vector{T}

error

::

Vector{T}

end

where

julia> ComplexF64

isa

AbstractFloat false

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

lukas-weber commented 1 month ago

True, if you find a reference or a straightforward way to do it, you're welcome to open a pr.

I think a similar question appears already when computing the variance. But here I go with the definition of summing the real and imag variance just like the Julia functions do.

-------- Original Message -------- On 7/28/24 12:08, LeoXia wrote:

How to perform jackknife reasonably on complex number datasets is a question. I will try to find some reference later, or we should find another suitable way to resample complex numbers.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>