60 : singular_value_tolerance_(singular_value_tolerance) {}
63 [[nodiscard]] std::vector<DenseMatrix<Complex>>
65 std::vector<DenseMatrix<Complex>> gauges;
66 gauges.reserve(projections.size());
67 for (std::size_t kpoint_index = 0; kpoint_index < projections.size(); kpoint_index++) {
69 gauges.push_back(
compute(projections[kpoint_index]));
72 std::string(error.what()) +
" This is k-point " +
73 std::to_string(kpoint_index) +
".");
85 throw std::invalid_argument(
"ProjectionGauge::compute: number_of_bands (" +
86 std::to_string(projections.
rows()) +
87 ") must be at least number_of_wannier_functions (" +
88 std::to_string(projections.
columns()) +
")");
96 if (smallest < singular_value_tolerance_) {
102 std::ostringstream message;
103 message <<
"ProjectionGauge::compute: the trial orbitals do not span the target "
104 "manifold at this k-point -- smallest singular value of A is "
105 << std::scientific << smallest <<
", below the tolerance "
106 << singular_value_tolerance_
107 <<
". Choose different trial orbitals or a different band selection; a gauge "
108 "built from a rank-deficient A is meaningless.";
119 Real singular_value_tolerance_;
DenseMatrix< Complex > compute(const DenseMatrix< Complex > &projections) const
ProjectionGauge(Real singular_value_tolerance=math::tolerances::wannier_projection_singular_value_threshold)
std::vector< DenseMatrix< Complex > > compute_all(const std::vector< DenseMatrix< Complex > > &projections) const
U(k) for every k-point's projection block; a refusal names the k-point it happened at.
SingularValueDecompositionResult compute(DenseMatrix< Complex > matrix) const
The decomposition of matrix, taken by value because zgesvd destroys its input.
constexpr double wannier_projection_singular_value_threshold
DenseMatrix< Complex > multiply(MatrixOperation left_operation, const DenseMatrix< Complex > &left, MatrixOperation right_operation, const DenseMatrix< Complex > &right, Complex alpha=Complex(1.0, 0.0))
alpha * op(left) * op(right), as a new matrix of the product's shape.
@ gauge_singular
The trial orbitals do not span the chosen manifold at some k-point.
std::vector< Real > singular_values
DenseMatrix< Complex > right_vectors_adjoint
DenseMatrix< Complex > left_vectors