Hi Julia Community,
these past couple of months i’ve been trying to run a code with some packages a i have started with the functions or the packages in order to call them in the main code, the packages are: utility, distrubitions, scanner, operateurs, you will find the names on the code.
the packages are good right now and my problem right now is with the main code which is everything this is the main code:
module QuantumRelay
using SymPy
using Iterators
using PolyLib
using JuMP
using Clp
using LLLplus
using GSL
using PyPlot
using Lora
using Distributions
export
qrelay_op,
op_mat,
scan_maker,
QRelaySampler
include("utility.jl")
include("operateurs.jl")
include("scanner.jl")
include("distributions.jl")
type QRelaySampler
prob::Function #return the probablility
psetproposal::Function #return next combination of sample
#input parameters:
#mat: the matrix p_ij in the note (10)
#coef: the coefficient c in the note (10)
#omega: the coefficient A in the note (10)
#pdet0: the probability of detection for each detector
function QRelaySampler{T<:Int}(mat::Array{T, 2}, coef, omega, pdet0)
U, S, V = PolyLib.smith_normal_form(mat) #note (18)
#the PolyLib returns P=USV. Inverse the matrices so Ui/Vi is the same as U/V in the note (18)
Ui = PolyLib.inverse(U)
Vi = PolyLib.inverse(V)
s = diag(S)
r = countnz(s)
s0 = s[1:r]
@assert s0 == ones(r)
ui1 = Ui[1:r, :]
ui2 = Ui[r+1:end, :]
vi1 = Vi[:, 1:r]
vi2 = Vi[:, r+1:end]
vi2 = lll(vi2)[1] #Lenstra–Lenstra–Lovász lattice basis reduction
T0 = vi1*ui1
ui2oc = orthocomp(ui2) #orhogonal complement
setc, scan = scan_maker(vi2) #make the scanner for the algorithm1 in the note
#compute the probability for an ideal system
#na: the photon numbers in a output mode
function prob(na)
@assert countnz(ui2*na) == 0
b = T0*na
setc(-b)
total = 0.0
for x in Task(scan)
nab = vi2*x + b #the photon numbers for each item in the sum in the note (10)
total += prod([c.^complex(n)/factorial(n) for (c, n) in zip(coef, nab)])
end
return abs(total*omega)^2
end
#compute the probability of detection
#q: the number of photons detectors report
#na: the number of photons arrived at detector
#mask: if there is no detector in this channel, mask=0
function prob(q, na, mask)
q0 = round(Int, q.>0)
m0 = round(Int, mask)
return prod((q0 + (1-2q0).*pdet0(na)).^m0)
end
psetproposal(x::Vector) = QuantumRelay.OrthoNNDist(x, ui2oc)
new(prob, psetproposal)
end
end
end
and this is what it shows me after running it:
Warning: Deprecated syntax type
at REPL[7]:25.
│ Use mutable struct
instead.
└ @ REPL[7]:25
WARNING: replacing module QuantumRelay.
[ Info: Precompiling SymPy [24249f21-da20-56a4-8eb1-6a02cf4ae2e6]
ERROR: LoadError: LoadError: PyCall not properly installed. Please run Pkg.build(“PyCall”)
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] top-level scope at /Users/midow/.julia/packages/PyCall/0jMpb/src/startup.jl:44 [inlined]
[3] top-level scope at ./none:0
[4] include at ./boot.jl:317 [inlined]
[5] include_relative(::Module, ::String) at ./loading.jl:1038
[6] include at ./sysimg.jl:29 [inlined]
[7] include(::String) at /Users/midow/.julia/packages/PyCall/0jMpb/src/PyCall.jl:3
[8] top-level scope at none:0
[9] include at ./boot.jl:317 [inlined]
[10] include_relative(::Module, ::String) at ./loading.jl:1038
[11] include(::Module, ::String) at ./sysimg.jl:29
[12] top-level scope at none:2
[13] eval at ./boot.jl:319 [inlined]
[14] eval(::Expr) at ./client.jl:399
[15] top-level scope at ./none:3
in expression starting at /Users/midow/.julia/packages/PyCall/0jMpb/src/startup.jl:41
in expression starting at /Users/midow/.julia/packages/PyCall/0jMpb/src/PyCall.jl:37
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to /Users/midow/.julia/compiled/v0.7/PyCall/GkzkC.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:399
[14] top-level scope at ./none:3
in expression starting at /Users/midow/.julia/packages/SymPy/XFURz/src/SymPy.jl:35
ERROR: Failed to precompile SymPy [24249f21-da20-56a4-8eb1-6a02cf4ae2e6] to /Users/midow/.julia/compiled/v0.7/SymPy/KzewI.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834