You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calculate the ground state eigenvalue and corresponding eigenvector
552
+
553
+
# Arguments
554
+
- `A::QuantumObject`: the [`QuantumObject`](@ref) to solve ground state eigenvalue and eigenvector
555
+
- `safe::Bool`: if `true` check for degenerate ground state. Default to `true`.
556
+
- `tol::Real`: the tolerance. Default is `1e-8`.
557
+
- `kwargs`: Additional keyword arguments passed to the solver. If `sparse=true`, the keyword arguments are passed to [`eigsolve`](@ref), otherwise to [`eigen`](@ref).
558
+
559
+
# Returns
560
+
- `eigval::Number`: the ground state eigenvalue
561
+
- `eigvec::QuantumObject`: the ground state eigenvector
562
+
"""
563
+
functiongroundstate(
564
+
A::QuantumObject{OpType};
565
+
safe::Bool=true,
566
+
tol::Real=1e-8,
567
+
kwargs...,
568
+
) where {OpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}}
569
+
#TODO: support for sparse eigsolve
570
+
#if !sparse
571
+
result =eigen(A; kwargs...)
572
+
#else
573
+
# eigvals = safe ? 2 : 1 # number of eigenvalues to calculate
574
+
# result = eigsolve(A; eigvals = eigvals, tol = tol, kwargs...)
575
+
#end
576
+
577
+
# the tolarence should be less strick than the `tol` for the eigensolver
578
+
# so it's numerical errors are not seen as degenerate states.
579
+
evals = result.values
580
+
safe && (abs(evals[2] - evals[1]) < (10* tol)) &&@warn"Ground state may be degenerate."
0 commit comments