vqe

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package vqe implements the Variational Quantum Eigensolver.

VQE finds the ground state energy of a Hamiltonian by variationally minimizing ⟨ψ(θ)|H|ψ(θ)⟩ over parameterized circuit parameters θ.

VQE exploits the variational principle: for any trial state |psi(theta)>, the expectation value <psi(theta)|H|psi(theta)> is an upper bound on the true ground-state energy E0. By optimizing the parameters theta with a classical optimizer (such as COBYLA or L-BFGS), VQE finds the lowest achievable energy within the ansatz, which approximates E0. The tightness of the bound depends on the expressibility of the chosen ansatz.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Hamiltonian is the observable to minimize.
	Hamiltonian pauli.PauliSum
	// Ansatz is the parameterized circuit template.
	Ansatz ansatz.Ansatz
	// Optimizer is the classical optimization method.
	Optimizer optim.Optimizer
	// Gradient is the gradient function. Nil means gradient-free.
	Gradient optim.GradientFunc
	// InitialParams are the starting parameters. Nil means zeros.
	InitialParams []float64
}

Config specifies the VQE problem and solver.

type Result

type Result struct {
	Energy        float64
	OptimalParams []float64
	NumIters      int
	NumEvals      int
	Converged     bool
	History       []float64
}

Result holds VQE output.

func Run

func Run(ctx context.Context, cfg Config) (*Result, error)

Run executes VQE.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL