Z-register Operations
MimiqCircuitsBase provides a set of operations that manipulate the Z-register (complex-valued variables).
MimiqCircuitsBase.Add — Type
Add(N[, constant=0.0])Add several z-register variables between them and optionally a constant. The result is strored in the first z-register variable given.
Examples
julia> Add(3)
z[?1] += z[?2] + z[?3]
julia> Add(4)
z[?1] += z[?2] + z[?3] + z[?4]
julia> Add(4, 2.0)
z[?1] += 2.0 + z[?2] + z[?3] + z[?4]
julia> c = push!(Circuit(), Add(3), 1,2,3)
3-vars circuit with 1 instruction:
└── z[1] += z[2] + z[3]
julia> push!(c, Add(5), 1,2,3,4,5)
5-vars circuit with 2 instructions:
├── z[1] += z[2] + z[3]
└── z[1] += z[2] + z[3] + z[4] + z[5]
julia> push!(c, Add(5, 2.0), 1,2,3,4,5)
5-vars circuit with 3 instructions:
├── z[1] += z[2] + z[3]
├── z[1] += z[2] + z[3] + z[4] + z[5]
└── z[1] += 2.0 + z[2] + z[3] + z[4] + z[5]MimiqCircuitsBase.Multiply — Type
Multiply(N[, constant=1.0])Multiply several z-register variables between them and optionally a constant. The result is strored in the first z-register variable given.
Examples
julia> Multiply(3)
z[?1] *= z[?2] * z[?3]
julia> Multiply(4)
z[?1] *= z[?2] * z[?3] * z[?4]
julia> Multiply(4, 2.0)
z[?1] *= 2.0 * z[?2] * z[?3] * z[?4]
julia> c = push!(Circuit(), Multiply(4), 1,2,3,4)
4-vars circuit with 1 instruction:
└── z[1] *= z[2] * z[3] * z[4]
julia> push!(c, Multiply(5, 2.0), 1,2,3,4,5)
5-vars circuit with 2 instructions:
├── z[1] *= z[2] * z[3] * z[4]
└── z[1] *= 2.0 * z[2] * z[3] * z[4] * z[5]MimiqCircuitsBase.Pow — Type
Pow(exp)Exponentiate a Z-register variable.
Examples
julia> Pow(2.0)
z[?] = z[?]^2.0
julia> Pow(-2.0)
z[?] = z[?]^(-2.0)
julia> c = push!(Circuit(), Pow(2.0), 1)
1-vars circuit with 1 instruction:
└── z[1] = z[1]^2.0
julia> push!(c, Pow(-2.0), 1)
1-vars circuit with 2 instructions:
├── z[1] = z[1]^2.0
└── z[1] = z[1]^(-2.0)