CASM  1.1.0
A Clusters Approach to Statistical Mechanics
VectorSymCompare.cc
Go to the documentation of this file.
2 
3 namespace CASM {
4 
5 VectorInvariants::VectorInvariants(Eigen::VectorXcd const &vector)
6  : m_cols(vector.cols()), m_norm(vector.norm()) {}
7 
8 double VectorInvariants::cols() const { return m_cols; }
9 
10 double VectorInvariants::norm() const { return m_norm; }
11 
12 bool almost_equal(VectorInvariants const &A_invariants,
13  VectorInvariants const &B_invariants, double tol) {
14  return A_invariants.cols() == B_invariants.cols() &&
15  almost_equal(A_invariants.norm(), B_invariants.norm(), tol);
16 }
17 
18 bool compare(VectorInvariants const &A_invariants,
19  VectorInvariants const &B_invariants, double tol) {
20  if (A_invariants.cols() == B_invariants.cols()) {
21  return CASM::compare(A_invariants.norm(), B_invariants.norm(), tol);
22  }
23  return A_invariants.cols() < B_invariants.cols();
24 }
25 
26 } // namespace CASM
VectorInvariants(Eigen::VectorXcd const &vector)
T norm(const Tensor< T > &ttens)
Definition: Tensor.hh:932
Main CASM namespace.
Definition: APICommand.hh:8
bool almost_equal(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Check if ClusterInvariants are equal.
bool compare(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Compare ClusterInvariants.