Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
4cb06733
Unverified
Commit
4cb06733
authored
Apr 25, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small change to matrix
parent
76c5706f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
2 deletions
+74
-2
include/cif++/matrix.hpp
+15
-1
test/unit-3d-test.cpp
+59
-1
No files found.
include/cif++/matrix.hpp
View file @
4cb06733
...
...
@@ -172,6 +172,8 @@ class matrix_fixed : public matrix_expression<matrix_fixed<F, M, N>>
public
:
using
value_type
=
F
;
static
constexpr
size_t
kSize
=
M
*
N
;
template
<
typename
M2
>
matrix_fixed
(
const
M2
&
m
)
{
...
...
@@ -185,7 +187,12 @@ class matrix_fixed : public matrix_expression<matrix_fixed<F, M, N>>
matrix_fixed
(
value_type
v
=
0
)
{
std
::
fill
(
m_data
.
begin
(),
m_data
.
end
(),
v
);
m_data
.
fill
(
v
);
}
matrix_fixed
(
const
F
(
&
v
)[
kSize
])
{
fill
(
v
,
std
::
make_index_sequence
<
kSize
>
{});
}
matrix_fixed
(
matrix_fixed
&&
m
)
=
default
;
...
...
@@ -193,6 +200,13 @@ class matrix_fixed : public matrix_expression<matrix_fixed<F, M, N>>
matrix_fixed
&
operator
=
(
matrix_fixed
&&
m
)
=
default
;
matrix_fixed
&
operator
=
(
const
matrix_fixed
&
m
)
=
default
;
template
<
size_t
...
Ixs
>
matrix_fixed
&
fill
(
const
F
(
&
a
)[
kSize
],
std
::
index_sequence
<
Ixs
...
>
)
{
m_data
=
{
a
[
Ixs
]...
};
return
*
this
;
}
constexpr
size_t
dim_m
()
const
{
return
M
;
}
constexpr
size_t
dim_n
()
const
{
return
N
;
}
...
...
test/unit-3d-test.cpp
View file @
4cb06733
...
...
@@ -253,7 +253,6 @@ BOOST_AUTO_TEST_CASE(dh_q_1)
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
m2q_0
,
*
utf
::
tolerance
(
0.001
f
))
{
for
(
size_t
i
=
0
;
i
<
cif
::
kSymopNrTableSize
;
++
i
)
...
...
@@ -317,6 +316,65 @@ BOOST_AUTO_TEST_CASE(m2q_0, *utf::tolerance(0.001f))
}
}
// BOOST_AUTO_TEST_CASE(m2q_1, *utf::tolerance(0.001f))
// {
// for (size_t i = 0; i < cif::kSymopNrTableSize; ++i)
// {
// auto d = cif::kSymopNrTable[i].symop().data();
// cif::matrix3x3<float> rot;
// float Qxx = rot(0, 0) = d[0];
// float Qxy = rot(0, 1) = d[1];
// float Qxz = rot(0, 2) = d[2];
// float Qyx = rot(1, 0) = d[3];
// float Qyy = rot(1, 1) = d[4];
// float Qyz = rot(1, 2) = d[5];
// float Qzx = rot(2, 0) = d[6];
// float Qzy = rot(2, 1) = d[7];
// float Qzz = rot(2, 2) = d[8];
// cif::matrix4x4<float> m({
// Qxx - Qyy - Qzz, Qyx + Qxy, Qzx + Qxz, Qzy - Qyz,
// Qyx + Qxy, Qyy - Qxx - Qzz, Qzy + Qyz, Qxz - Qzx,
// Qzx + Qxz, Qzy + Qyz, Qzz - Qxx - Qyy, Qyx - Qxy,
// Qzy - Qyz, Qxz - Qzx, Qyx - Qxy, Qxx + Qyy + Qzz
// });
// auto &&[ev, em] = cif::eigen(m * (1/3.0f), false);
// size_t bestJ = 0;
// float bestEV = -1;
// for (size_t j = 0; j < 4; ++j)
// {
// if (bestEV < ev[j])
// {
// bestEV = ev[j];
// bestJ = j;
// }
// }
// if (std::abs(bestEV - 1) > 0.01)
// continue; // not a rotation matrix
// auto q = normalize(cif::quaternion{
// static_cast<float>(em(bestJ, 3)),
// static_cast<float>(em(bestJ, 0)),
// static_cast<float>(em(bestJ, 1)),
// static_cast<float>(em(bestJ, 2)) });
// cif::point p1{ 1, 1, 1 };
// cif::point p2 = p1;
// p2.rotate(q);
// cif::point p3 = rot * p1;
// BOOST_TEST(p2.m_x == p3.m_x);
// BOOST_TEST(p2.m_y == p3.m_y);
// BOOST_TEST(p2.m_z == p3.m_z);
// }
// }
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
symm_1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment