50 return !empty() && !field.empty() &&
51 width() == field.width() && height() == field.height() &&
52 dx() == field.dx() && dy() == field.dy();
62 return std::sqrt(
norm2());
67 const double n =
norm();
68 if (!(n > 0.0) || !std::isfinite(n))
return false;
69 const float s =
static_cast<float>(1.0 / n);
70 for (std::size_t i = 0; i <
upper_.
size(); ++i) {
79 const double n =
norm2();
85 const double n =
norm2();
96 for (std::size_t i = 0; i <
upper_.
size(); ++i) {
Owning Cartesian grid of complex scalar samples.
std::size_t size() const noexcept
Returns the total number of complex samples.
double norm2() const noexcept
Returns the discrete integral of |psi|^2 including dx*dy.
bool empty() const noexcept
Returns whether the field contains no samples.
void clear() noexcept
Releases all samples and returns the field to the empty state.
void fill(const Value &value)
Assigns one complex value to every grid sample.
Value * data() noexcept
Returns mutable contiguous row-major sample storage.
void resize(std::size_t width, std::size_t height, float dx=1.0f, float dy=1.0f)
Reallocates the grid and resets all samples to zero.
std::complex< float > Value
double upperPopulation() const noexcept
Carries out upper population.
void writeDensityProxy(ComplexField2D &out) const
Writes density proxy.
std::size_t height() const noexcept
Returns height.
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.
float dx() const noexcept
Returns the X-axis grid spacing.
void clear() noexcept
Clears stored state and returns the component to its empty/default state.
void resize(std::size_t width, std::size_t height, float dx=1.0f, float dy=1.0f)
Resizes storage and updates the associated grid geometry.
double lowerPopulation() const noexcept
Carries out lower population.
float dy() const noexcept
Returns the Y-axis grid spacing.
double norm() const noexcept
Returns norm.
bool matchesGrid(const ComplexField2D &field) const noexcept
Carries out matches grid.
std::size_t width() const noexcept
Returns width.
bool empty() const noexcept
Returns whether the object contains no data.
DiracSpinor2D()=default
Constructs a Dirac Spinor 2D instance.
Declares the two-component Dirac spinor field container used by QPE.