46 m_perm_array.
reserve(init_perm.size());
47 for(
auto it = init_perm.cbegin(); it != init_perm.cend(); ++it)
54 return m_perm_array.
size();
83 return m_perm_array[i];
88 return m_perm_array[i];
97 std::vector<T>
permute(
const std::vector<T> &before_array)
const;
105 return this->
permute(before_array);
114 jsonParser &
to_json(
const Permutation &value, jsonParser &json);
115 void from_json(Permutation &value,
const jsonParser &json);
117 std::ostream &
operator<<(std::ostream &,
const Permutation &);
127 assert(before_array.
size() ==
size() &&
"WARNING: You're trying to permute an Array with an incompatible permutation!");
146 assert(before_vec.size() ==
size() &&
"WARNING: You're trying to permute an Array with an incompatible permutation!");
148 std::vector<T> after_vec;
149 after_vec.reserve(
size());
164 assert(before_array.
size() ==
size() &&
"WARNING: You're trying to permute an Array with an incompatible permutation!");
bool has_fixed_points() const
Checks whether any indices remain unchanged by permutation.
void from_json(ClexDescription &desc, const jsonParser &json)
void push_back(const T &toPush)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
const Array< Index > & perm_array() const
Permutation(const std::vector< Index > &init_perm)
ReturnArray< T > operator*(const Array< T > &before_array) const
ReturnArray< T > permute(const Array< T > &before_array) const
Generate permuted copy of type-T Array.
void from_json(const jsonParser &json)
Array< Index > m_perm_array
void append_fixed_points(Index N_new)
Add new indices that remain unchanged by permutation.
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
const Index & operator[](Index i) const
const access of m_perm_array for doing low-level permutation algebra
EigenIndex Index
For long integer indexing:
Permutation inverse() const
Construct permutation that undoes the permutation performed by 'this'.
const Index & at(Index i) const
const access of m_perm_array for doing low-level permutation algebra
bool is_perm() const
Checks that m_perm_array contains values from 0 to m_perm_array.size()-1 and that no value is repeate...
jsonParser & to_json(jsonParser &json) const
ReturnArray< T > ipermute(const Array< T > &before_array) const
Generate inversely permuted copy of type-T Array.
void reserve(Index new_max)
Permutation transformed_by(const Permutation &trans_perm) const
Permutation(ReturnArray< Index > &init_perm)
Permutation make_block_permutation(const Array< Index > &block_dims) const
Permutation(const Array< Index > &init_perm)