BloqadeKrylov.CFETEvolution
— Typestruct CFETEvolution
CFETEvolution(reg::AbstractRegister, clocks, h, algo; kw...)
Create a CFETEvolution
object that describes a time evolution using commutation-free Magnus method with s exponentials. https://arxiv.org/pdf/1102.5071.pdf (eq.58-61)
Arguments
reg
: a register, should be a subtype ofAbstractRegister
.clocks
: the clocks of this time evolution at each step.h
: a hamiltonian expression.algo
: the algorithm (different orders to use), should be a subtype ofCFETTables
. default isCFET4_2
Keyword Arguments
progress
: show progress bar, default isfalse
.progress_name
: progress bar name, default is"emulating"
.normalize_step
: normalize the state everynormalize_step
.normalize_finally
: wether normalize the state in the end of evolution, default istrue
.tol
: tolerance of the exponential time propogator evaluation method, default is1e-7
expmv_backend
: the backend for evaluate exponential time propogator, default isexpmv!
(other option:expm_multiply!
).
Examples
The following is the simplest way of using CFETEvolution
via emulate!
. For more advanced usage, please refer to documentation page Emulation.
julia> using Bloqade
julia> r = zero_state(5)
ArrayReg{2, ComplexF64, Array...}
active qudits: 5/5
nlevel: 2
julia> atoms = [(i, ) for i in 1:5]
5-element Vector{Tuple{Int64}}:
(1,)
(2,)
(3,)
(4,)
(5,)
julia> h = rydberg_h(atoms; Ω=sin)
nqubits: 5
+
├─ [+] ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ [+] Ω(t) ⋅ ∑ σ^x_i
julia> prob = CFETEvolution(r, 0.0:1e-2:0.1, h, CFET4_2());
julia> emulate!(prob); # run the emulation
BloqadeKrylov.CFETEvolution
— MethodCFETEvolution(reg, start_clock, durations, hamiltonian, options)
Create a CFETEvolution
object.
Arguments
reg
: a register object.start_clock
: start clock of the evolution.durations
: list of durations at each time step.hamiltonian
: low-level hamiltonian object of typeHamiltonian
.options
: options of the evolution in typeKrylovOptions
.
BloqadeKrylov.KrylovEvolution
— Typestruct KrylovEvolution
KrylovEvolution(reg::AbstractRegister, clocks, h; kw...)
Create a KrylovEvolution
object that describes a time evolution using Krylov subspace methods.
Arguments
reg
: a register, should be a subtype ofAbstractRegister
.clocks
: the clocks of this time evolution at each step.h
: a hamiltonian expression.
Keyword Arguments
progress
: show progress bar, default isfalse
.progress_name
: progress bar name, default is"emulating"
.normalize_step
: normalize the state everynormalize_step
.normalize_finally
: wether normalize the state in the end of evolution, default istrue
.tol
: tolerance of the Krylov method, default is1e-7
Examples
The following is the simplest way of using KrylovEvolution
via emulate!
. For more advanced usage, please refer to documentation page Emulation.
julia> using Bloqade
julia> r = zero_state(5)
ArrayReg{2, ComplexF64, Array...}
active qudits: 5/5
nlevel: 2
julia> atoms = [(i, ) for i in 1:5]
5-element Vector{Tuple{Int64}}:
(1,)
(2,)
(3,)
(4,)
(5,)
julia> h = rydberg_h(atoms; Ω=sin)
nqubits: 5
+
├─ [+] ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ [+] Ω(t) ⋅ ∑ σ^x_i
julia> prob = KrylovEvolution(r, 0.0:1e-2:0.1, h);
julia> emulate!(prob); # run the emulation
BloqadeKrylov.KrylovEvolution
— MethodKrylovEvolution(reg, start_clock, durations, hamiltonian, options)
Create a KrylovEvolution
object.
Arguments
reg
: a register object.start_clock
: start clock of the evolution.durations
: list of durations at each time step.hamiltonian
: low-level hamiltonian object of typeHamiltonian
.options
: options of the evolution in typeKrylovOptions
.
BloqadeKrylov.KrylovOptions
— Typestruct KrylovOptions
Krylov evolution options.
BloqadeKrylov.Magnus4Evolution
— Typestruct Magnus4Evolution
Magnus4Evolution(reg::AbstractRegister, clocks, h; kw...)
Create a Magnus4Evolution
object that describes a time evolution using Magnus method with 4th order.
Arguments
reg
: a register, should be a subtype ofAbstractRegister
.clocks
: the clocks of this time evolution at each step.h
: a hamiltonian expression.
Keyword Arguments
progress
: show progress bar, default isfalse
.progress_name
: progress bar name, default is"emulating"
.normalize_step
: normalize the state everynormalize_step
.normalize_finally
: wether normalize the state in the end of evolution, default istrue
.tol
: tolerance of the Krylov-expmv evaluation method, default is1e-7
Examples
The following is the simplest way of using Magnus4Evolution
via emulate!
. For more advanced usage, please refer to documentation page Emulation.
julia> using Bloqade
julia> r = zero_state(5)
ArrayReg{2, ComplexF64, Array...}
active qudits: 5/5
nlevel: 2
julia> atoms = [(i, ) for i in 1:5]
5-element Vector{Tuple{Int64}}:
(1,)
(2,)
(3,)
(4,)
(5,)
julia> h = rydberg_h(atoms; Ω=sin)
nqubits: 5
+
├─ [+] ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ [+] Ω(t) ⋅ ∑ σ^x_i
julia> prob = Magnus4Evolution(r, 0.0:1e-2:0.1, h);
julia> emulate!(prob); # run the emulation
BloqadeKrylov.Magnus4Evolution
— MethodMagnus4Evolution(reg, start_clock, durations, hamiltonian, options)
Create a Magnus4Evolution
object.
Arguments
reg
: a register object.start_clock
: start clock of the evolution.durations
: list of durations at each time step.hamiltonian
: low-level hamiltonian object of typeHamiltonian
.options
: options of the evolution in typeKrylovOptions
.
BloqadeKrylov._expm_multiply_impl!
— Method_expm_multiply_impl!(w::AbstractVector{T}
t::Real,
As,
v::AbstractVector{T},
mu::Real, #shift parameter
s::Int,
m_star::Int,
tol::Real,
) where {T}
Calculate matrix exponential acting on some vector, ``w = e^{tA}v``,
using the Krylov subspace approximation.
[Note] As is a sugeried matrix, i.e. As= A - mu*I
BloqadeKrylov._onenormest_impl
— FunctionCompute a lower bound of the 1-norm of a sparse matrix, [implementation]
Parameters
----------
A : AbstractMatrix
A linear operator that can produce matrix products, must be square matrix with (nxn)
AT : AbstractMatrix
The transpose of A.
p : int, optional (default =1)
The power of A
t : int, optional
A positive parameter controlling the tradeoff between
accuracy versus time and memory usage.
itmax : int, optional
Use at most this many iterations.
Returns
-------
est : float
An underestimate of the 1-norm of the sparse matrix.
nmults : int, optional
The number of matrix products that were computed.
nresamples : int, optional
The number of times a parallel column was observed,
necessitating a re-randomization of the column.
[Note] This is algorithm 2.4.
BloqadeKrylov._sign_roundup
— MethodFrom Higham and Tisseur:
"Everything in this section remains valid for complex matrices
provided that sign(A) is redefined as the matrix (aij / |aij|)
(and sign(0) = 1) transposes are replaced by conjugate transposes."
BloqadeKrylov.expmv
— Methodexpmv(t, A, vec; [tol], [m], [norm], [anorm])
Calculate matrix exponential acting on some vector, $w = e^{tA}v$, using the Krylov subspace approximation. See R.B. Sidje, ACM Trans. Math. Softw., 24(1):130-156, 1998 and http://www.maths.uq.edu.au/expokit
BloqadeKrylov.onenormest
— FunctionCompute a lower bound of the 1-norm of a matrix to a power of p
Parameters
----------
A : ndarray or other linear operator
A linear operator that can be transposed and that can
produce matrix products.
p : power of A, optional (default =1)
t : int, optional
A positive parameter controlling the tradeoff between
accuracy versus time and memory usage.
Larger values take longer and use more memory
but give more accurate output.
itmax : int, optional
Use at most this many iterations.
Returns
-------
est : float
An underestimate of the 1-norm of the sparse matrix.
Notes
-----
This is algorithm 2.4 of [1].
In [2] it is described as follows.
"This algorithm typically requires the evaluation of
about 4t matrix-vector products and almost invariably
produces a norm estimate (which is, in fact, a lower
bound on the norm) correct to within a factor 3."
.. versionadded:: 0.13.0
References
----------
.. [1] Nicholas J. Higham and Francoise Tisseur (2000),
"A Block Algorithm for Matrix 1-Norm Estimation,
with an Application to 1-Norm Pseudospectra."
SIAM J. Matrix Anal. Appl. Vol. 21, No. 4, pp. 1185-1201.
.. [2] Awad H. Al-Mohy and Nicholas J. Higham (2009),
"A new scaling and squaring algorithm for the matrix exponential."
SIAM J. Matrix Anal. Appl. Vol. 31, No. 3, pp. 970-989.