Skip to content

Commit

Permalink
rename fp2cg and cg2fp for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms committed Nov 25, 2024
1 parent bd236b3 commit c8a0367
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ tsirelson_bound
seesaw
correlation_tensor
probability_tensor
fp2cg
cg2fp
tensor_collinsgisin
tensor_probability
```

## Norms
Expand Down
12 changes: 6 additions & 6 deletions src/nonlocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ end
export tsirelson_bound

"""
fp2cg(V::Array{T,4}, behaviour::Bool = false) where {T <: Real}
tensor_collinsgisin(V::Array{T,4}, behaviour::Bool = false) where {T <: Real}
Takes a bipartite Bell functional `V` in full probability notation and transforms it
to Collins-Gisin notation. If `behaviour` is `true` do instead the transformation for behaviours. Doesn't assume normalization.
"""
function fp2cg(V::AbstractArray{T, 4}, behaviour::Bool = false) where {T}
function tensor_collinsgisin(V::AbstractArray{T, 4}, behaviour::Bool = false) where {T}
oa, ob, ia, ib = size(V)
alice_pars = ia * (oa - 1) + 1
bob_pars = ib * (ob - 1) + 1
Expand Down Expand Up @@ -156,15 +156,15 @@ function fp2cg(V::AbstractArray{T, 4}, behaviour::Bool = false) where {T}
end
return CG
end
export fp2cg
export tensor_collinsgisin

"""
cg2fp(CG::Matrix, behaviour::Bool = false)
tensor_probability(CG::Matrix, scenario::Vector, behaviour::Bool = false)
Takes a bipartite Bell functional `CG` in Collins-Gisin notation and transforms it
to full probability notation. `scenario` is a vector detailing the number of inputs and outputs, in the order [oa, ob, ia, ib]. If `behaviour` is `true` do instead the transformation for behaviours. Doesn't assume normalization.
"""
function cg2fp(CG::Matrix{T}, scenario::Vector{<:Integer}, behaviour::Bool = false) where {T}
function tensor_probability(CG::Matrix{T}, scenario::Vector{<:Integer}, behaviour::Bool = false) where {T}
oa, ob, ia, ib = scenario
aindex(a, x) = 1 + a + (x - 1) * (oa - 1)
bindex(b, y) = 1 + b + (y - 1) * (ob - 1)
Expand Down Expand Up @@ -205,7 +205,7 @@ function cg2fp(CG::Matrix{T}, scenario::Vector{<:Integer}, behaviour::Bool = fal
end
return V
end
export cg2fp
export tensor_probability

"""
probability_tensor(rho::Hermitian, all_Aax::Vector{Measurement}...)
Expand Down
4 changes: 2 additions & 2 deletions test/nonlocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ end
@test correlation_tensor(state_phiplus(), Aax, 2; marg = false) Diagonal([1, 1, -1])
scenario = [2, 3, 4, 5]
cg = randn(scenario[3] * (scenario[1] - 1) + 1, scenario[4] * (scenario[2] - 1) + 1)
@test fp2cg(cg2fp(cg, scenario)) cg
@test fp2cg(cg2fp(cg, scenario, true), true) cg
@test tensor_collinsgisin(tensor_probability(cg, scenario)) cg
@test tensor_collinsgisin(tensor_probability(cg, scenario, true), true) cg
end

0 comments on commit c8a0367

Please sign in to comment.