11 namespace SymRepTools_v2 {
13 namespace IrrepWedgeImpl {
28 for (
Index i = 1; i < axes.cols(); ++i) {
30 for (
Index element_index : head_group) {
31 v = _rep[element_index] * axes.col(0);
34 for (
Index j = 0; j < i; ++j) {
40 if (skip_op)
continue;
44 if (bestproj < (v.transpose() * axes).sum()) {
45 bestproj = (v.transpose() * axes).
sum();
57 : irrep_info(
std::move(_irrep_info)), axes(
std::move(_axes)) {}
69 irrep_wedge.
mult.reserve(axes.cols());
70 for (
Index i = 0; i < axes.cols(); ++i) {
71 irrep_wedge.
mult.push_back(1);
77 : m_iwedges(_iwedges), m_trans_mat(_subwedge_to_trans_mat(m_iwedges)) {}
80 std::vector<IrrepWedge>
const &_iwedges) {
82 Eigen::MatrixXd result(_iwedges[0].axes.rows(), _iwedges[0].axes.rows());
84 for (
Index w = 0; w < _iwedges.size(); ++w) {
85 result.block(0, i, _iwedges[w].axes.rows(), _iwedges[w].axes.cols()) =
87 i += _iwedges[w].axes.cols();
89 if (i < result.cols()) result.conservativeResize(Eigen::NoChange, i);
115 std::vector<IrrepWedge> wedges;
116 wedges.reserve(irreps.size());
117 double best_proj, tproj;
131 irrep, Eigen::MatrixXd::Zero(irrep.vector_dim(), irrep.irrep_dim()));
135 if (irrep.directions.empty()) {
137 irrep, fullspace_rep, head_group);
144 wedges.back().axes.col(0) = irrep.directions[0][0];
145 wedges.back().mult.push_back(irrep.directions[0].size());
146 for (
Index i = 1; i < irrep.irrep_dim(); i++) {
152 (wedges.back().axes.transpose() * irrep.directions[i][0]).
sum();
153 for (
Index j = 1; j < irrep.directions[i].size(); j++) {
154 tproj = (wedges.back().axes.transpose() * irrep.directions[i][j]).
sum();
155 if (tproj > best_proj) {
161 wedges.back().axes.col(i) = irrep.directions[i][j_best];
162 wedges.back().mult.push_back(irrep.directions[i].size());
174 auto irrep_wedge_compare = [](
const IrrepWedge &a,
179 auto tot_wedge_compare = [irrep_wedge_compare](
180 const std::vector<IrrepWedge> &a,
181 const std::vector<IrrepWedge> &b) ->
bool {
182 if (a.size() != b.size())
return false;
183 for (
auto ita = a.begin(), itb = b.begin(); ita != a.end(); ++ita, ++itb)
184 if (!irrep_wedge_compare(*ita, *itb))
return false;
194 std::vector<SubWedge> result;
198 irrep_wedge_orbits.reserve(init_wedges.size());
200 std::vector<Index> max_equiv;
201 max_equiv.reserve(init_wedges.size());
209 irrep_wedge_orbits.push_back({wedge});
212 subgroups.push_back({});
213 for (
Index element_index : head_group) {
215 test_wedge.
axes = fullspace_rep[element_index] * wedge.axes;
217 for (; o < irrep_wedge_orbits.back().size(); ++o) {
218 if (irrep_wedge_compare(irrep_wedge_orbits.back()[o], test_wedge)) {
220 subgroups.back().push_back(element_index);
225 if (o < irrep_wedge_orbits.back().size())
continue;
226 irrep_wedge_orbits.back().push_back(test_wedge);
232 max_equiv.push_back(irrep_wedge_orbits.back().size() - 1);
233 if (max_equiv.back() > max_equiv[imax]) imax = max_equiv.size() - 1;
240 std::vector<Index>(init_wedges.size(), 1));
246 for (; wcount; ++wcount) {
247 std::vector<IrrepWedge> twedge = init_wedges;
248 for (
Index i = 0; i < init_wedges.size(); i++)
249 twedge[i].axes = irrep_wedge_orbits[i][wcount[i]].axes;
253 [tot_wedge_compare, &twedge](
255 return contains(wedge_orbit, twedge, tot_wedge_compare);
259 tot_wedge_orbits.push_back({twedge});
260 result.emplace_back(twedge);
261 for (
Index p : subgroups[imax]) {
262 for (
Index i = 0; i < twedge.size(); i++)
264 fullspace_rep[p] * result.back().irrep_wedges()[i].axes;
265 if (!
contains(tot_wedge_orbits.back(), twedge, tot_wedge_compare)) {
266 tot_wedge_orbits.back().push_back(twedge);
A Counter allows looping over many incrementing variables in one loop.
bool almost_equal(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Check if ClusterInvariants are equal.
std::vector< SymRepTools::IrrepInfo > irrep_decomposition(SymGroupRep const &_rep, SymGroup const &head_group, bool allow_complex)
Finds irreducible subspaces that comprise an underlying subspace It does not rely on the character ta...
Container::value_type sum(const Container &container, typename Container::value_type init_val=0)
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value)
bool contains_if(const Container &container, UnaryPredicate p)
Equivalent to container.end() != std::find_if(container.begin(), container.end(), p)
INDEX_TYPE Index
For long integer indexing:
bool almost_equal(const Eigen::MatrixBase< Derived1 > &val1, const Eigen::MatrixBase< Derived2 > &val2, double tol=CASM::TOL)
Shortcut for multidimensional vector (std::vector< std::vector< ...)
typename multivector_impl::multivector_tmp< T, N >::type X