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
0f14d06f
Unverified
Commit
0f14d06f
authored
Apr 14, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Added inverse symmetry operation
parents
a38f31ce
c53be784
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
include/cif++/matrix.hpp
+11
-1
src/point.cpp
+7
-1
test/unit-3d-test.cpp
+21
-0
No files found.
include/cif++/matrix.hpp
View file @
0f14d06f
...
...
@@ -67,6 +67,16 @@ class matrix_expression
}
}
void
swap_col
(
uint32_t
c1
,
uint32_t
c2
)
{
for
(
uint32_t
r
=
0
;
r
<
dim_n
();
++
r
)
{
auto
&
a
=
operator
()(
r
,
c1
);
auto
&
b
=
operator
()(
r
,
c2
);
std
::
swap
(
a
,
b
);
}
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
matrix_expression
&
m
)
{
os
<<
'['
;
...
...
@@ -585,7 +595,7 @@ auto eigen(const matrix_expression<M> &mat, bool sort)
j
=
q
;
std
::
swap
(
ev
[
j
],
ev
[
p
]);
em
.
swap_
row
(
j
,
p
);
em
.
swap_
col
(
j
,
p
);
}
}
...
...
src/point.cpp
View file @
0f14d06f
...
...
@@ -280,10 +280,16 @@ quaternion align_points(const std::vector<point> &pa, const std::vector<point> &
auto
cf
=
matrix_cofactors
(
t
);
int
maxR
=
0
;
double
maxCF
=
std
::
abs
(
cf
(
0
,
0
));
for
(
int
r
=
1
;
r
<
4
;
++
r
)
{
if
(
std
::
abs
(
cf
(
r
,
0
))
>
std
::
abs
(
cf
(
maxR
,
0
)))
auto
cfr
=
std
::
abs
(
cf
(
r
,
0
));
if
(
maxCF
<
cfr
)
{
maxCF
=
cfr
;
maxR
=
r
;
}
}
quaternion
q
(
...
...
test/unit-3d-test.cpp
View file @
0f14d06f
...
...
@@ -412,4 +412,24 @@ BOOST_AUTO_TEST_CASE(eigen_1, *utf::tolerance(0.1f))
BOOST_TEST
(
ev
[
1
]
==
1.4780548447781369
f
);
BOOST_TEST
(
ev
[
2
]
==
37.1014913651276582
f
);
BOOST_TEST
(
ev
[
3
]
==
2585.25381092892231
f
);
BOOST_TEST
(
em
(
0
,
0
)
==
0.792608291163763585
f
);
BOOST_TEST
(
em
(
1
,
0
)
==
0.451923120901599794
f
);
BOOST_TEST
(
em
(
2
,
0
)
==
0.322416398581824992
f
);
BOOST_TEST
(
em
(
3
,
0
)
==
0.252161169688241933
f
);
BOOST_TEST
(
em
(
0
,
1
)
==
-
0.582075699497237650
f
);
BOOST_TEST
(
em
(
1
,
1
)
==
0.370502185067093058
f
);
BOOST_TEST
(
em
(
2
,
1
)
==
0.509578634501799626
f
);
BOOST_TEST
(
em
(
3
,
1
)
==
0.514048272222164294
f
);
// BOOST_TEST(em(0, 2) == -0.179186290535454826f);
// BOOST_TEST(em(1, 2) == 0.741917790628453435f);
// BOOST_TEST(em(2, 2) == -0.100228136947192199f);
// BOOST_TEST(em(3, 2) == -0.638282528193614892f);
BOOST_TEST
(
em
(
0
,
3
)
==
0.0291933231647860588
f
);
BOOST_TEST
(
em
(
1
,
3
)
==
-
0.328712055763188997
f
);
BOOST_TEST
(
em
(
2
,
3
)
==
0.791411145833126331
f
);
BOOST_TEST
(
em
(
3
,
3
)
==
-
0.514552749997152907
f
);
}
\ No newline at end of file
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