15namespace qpe {
namespace tests {
25 if (!s.
normalize() || std::abs(s.
norm2()-1.0)>2.0e-6) { error=
"Dirac spinor normalization failed";
return false; }
28 if (!s.
matchesGrid(proxy) || std::abs(proxy.
norm2()-1.0)>2.0e-6) { error=
"Dirac density proxy does not preserve density";
return false; }
Owning Cartesian grid of complex scalar samples.
double norm2() const noexcept
Returns the discrete integral of |psi|^2 including dx*dy.
std::complex< float > Value
Two-component complex spinor field used by the QPE Dirac branch.
double upperPopulation() const noexcept
Carries out upper population.
void writeDensityProxy(ComplexField2D &out) const
Writes density proxy.
double norm2() const noexcept
Returns norm2.
void fill(const ComplexField2D::Value &upperValue, const ComplexField2D::Value &lowerValue)
Assigns one value to all stored samples.
bool normalize() noexcept
Returns normalize.
double lowerPopulation() const noexcept
Carries out lower population.
bool matchesGrid(const ComplexField2D &field) const noexcept
Carries out matches grid.
Declares the two-component Dirac spinor field container used by QPE.
Declares regression and invariant tests for diracspinor2d tests.
bool runDiracSpinor2DTests(std::string &error)
Runs dirac spinor2 d tests.