Commit 18f1d07e by Maarten L. Hekkelman

clean up code

parent b5969761
......@@ -162,13 +162,6 @@ class Matrix : public MatrixBase<T>
return m_data[i * m_n + j];
}
template <typename Func>
void each(Func f)
{
for (uint32_t i = 0; i < m_m * m_n; ++i)
f(m_data[i]);
}
template <typename U>
Matrix &operator/=(U v)
{
......@@ -219,18 +212,6 @@ class SymmetricMatrix : public MatrixBase<T>
T operator()(uint32_t i, uint32_t j) const;
virtual T &operator()(uint32_t i, uint32_t j);
// erase two rows, add one at the end (for neighbour joining)
void erase_2(uint32_t i, uint32_t j);
template <typename Func>
void each(Func f)
{
uint32_t N = (m_n * (m_n + 1)) / 2;
for (uint32_t i = 0; i < N; ++i)
f(m_data[i]);
}
template <typename U>
SymmetricMatrix &operator/=(U v)
{
......@@ -266,28 +247,6 @@ inline T &SymmetricMatrix<T>::operator()(uint32_t i, uint32_t j)
}
template <typename T>
void SymmetricMatrix<T>::erase_2(uint32_t di, uint32_t dj)
{
uint32_t s = 0, d = 0;
for (uint32_t i = 0; i < m_n; ++i)
{
for (uint32_t j = 0; j < i; ++j)
{
if (i != di and j != dj and i != dj and j != di)
{
if (s != d)
m_data[d] = m_data[s];
++d;
}
++s;
}
}
--m_n;
}
template <typename T>
class IdentityMatrix : public MatrixBase<T>
{
public:
......
......@@ -35,6 +35,9 @@
#include "cif++/BondMap.hpp"
#include "cif++/CifValidator.hpp"
namespace tt = boost::test_tools;
std::filesystem::path gTestDir = std::filesystem::current_path(); // filled in first test
// --------------------------------------------------------------------
......@@ -1718,8 +1721,7 @@ BOOST_AUTO_TEST_CASE(t1)
Quaternion q{ 0.5, 0.5, 0.5, 0.5 };
q = Normalize(q);
// std::cout << "q: " << q << std::endl;
const auto &&[angle0, axis0] = QuaternionToAngleAxis(q);
std::vector<Point> p1{
{ 16.979, 13.301, 44.555 },
......@@ -1735,26 +1737,16 @@ BOOST_AUTO_TEST_CASE(t1)
Point c1 = CenterPoints(p1);
std::cout << c1 << std::endl;
for (auto &p : p2)
p.rotate(q);
Point c2 = CenterPoints(p2);
// std::cout << c2 << std::endl;
// std::cout << "rmsd: " << RMSd(p1, p2) << std::endl;
auto q2 = AlignPoints(p1, p2);
// std::cout << "q2: " << q2 << std::endl;
const auto &&[angle, axis] = QuaternionToAngleAxis(q2);
// std::cout << "rotated " << angle << " " << std::endl;
BOOST_TEST(std::fmod(360 + angle, 360) == std::fmod(360 - angle0, 360), tt::tolerance(0.01));
for (auto &p : p1)
p.rotate(q2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment