Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
polymesh
Commits
52e60aca
Commit
52e60aca
authored
Jul 12, 2018
by
Philip Trettner
Browse files
fixed permutations
parent
77ced122
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/polymesh/detail/permutation.hh
View file @
52e60aca
...
...
@@ -45,7 +45,6 @@ template <class Swap>
void
apply_permutation
(
std
::
vector
<
int
>
const
&
p
,
Swap
&&
s
)
{
auto
size
=
p
.
size
();
std
::
vector
<
int
>
cycle
;
std
::
valarray
<
bool
>
visited
(
false
,
size
);
for
(
auto
pi
=
0u
;
pi
<
size
;
++
pi
)
{
...
...
@@ -54,7 +53,6 @@ void apply_permutation(std::vector<int> const& p, Swap&& s)
if
(
visited
[
i
])
continue
;
cycle
.
clear
();
visited
[
i
]
=
true
;
i
=
p
[
i
];
while
(
!
visited
[
i
])
...
...
@@ -62,15 +60,12 @@ void apply_permutation(std::vector<int> const& p, Swap&& s)
// mark
visited
[
i
]
=
true
;
//
add to cycle
cycle
.
push_back
(
i
);
//
swap
s
(
pi
,
i
);
// advance
i
=
p
[
i
];
}
for
(
auto
j
=
(
int
)
cycle
.
size
()
-
1
;
j
>=
0
;
--
j
)
s
(
pi
,
cycle
[
j
]);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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