1 #ifndef CASM_Array_math
2 #define CASM_Array_math
52 template <
typename IntType>
54 IntType tcoeff(1), tsum(0);
55 for (
Index i = 0; i < exponents.
size(); i++) {
57 tcoeff *=
nchoosek(tsum, exponents[i]);
64 template <
typename IntType>
67 IntType tcoeff(1), tsum(0);
68 for (
Index i = 0; i < sublist.
size(); i++) {
69 tsum += exponents[sublist[i]];
70 tcoeff *=
nchoosek(tsum, exponents[sublist[i]]);
77 if (A.
size() != B.
size())
return false;
99 template <
typename Derived>
101 const Eigen::MatrixBase<Derived> &value,
double tol =
TOL) {
104 for (
Index i = 1; i < value.size(); i++) {
110 subspace_dims.
push_back(value.size() - last_i);
111 return subspace_dims;
void reserve(Index new_max)
void push_back(const T &toPush)
bool almost_equal(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Check if ClusterInvariants are equal.
Index which_unique_combination(const Array< Index > &input, const Array< Index >::X2 &unique, const Array< Index >::X2 &ind_equiv)
IntType nchoosek(IntType n, IntType k)
ReturnArray< Array< int > > get_prime_factors(int target)
int lcm(const Array< int > &series)
Find least common multiple.
ReturnArray< Index > partition_distinct_values(const Eigen::MatrixBase< Derived > &value, double tol=TOL)
ReturnArray< T > cum_sum(const Array< T > &arr)
IntType multinomial_coeff(const Array< IntType > &exponents)
INDEX_TYPE Index
For long integer indexing: