projects
/
libstick.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
993da09
)
Add simplicial_complex::randomize_order()
author
Stefan Huber <shuber@sthu.org>
Mon, 24 Nov 2014 17:54:15 +0000
(18:54 +0100)
committer
Stefan Huber <shuber@sthu.org>
Mon, 24 Nov 2014 18:17:34 +0000
(19:17 +0100)
include/libstick-0.1/simplicialcomplex.h
patch
|
blob
|
history
diff --git
a/include/libstick-0.1/simplicialcomplex.h
b/include/libstick-0.1/simplicialcomplex.h
index e83daa47b83597cc016b97bb0bcbd4e04ea3d58b..849bb2284e1185e338405bc60b64a3c85969f998 100644
(file)
--- a/
include/libstick-0.1/simplicialcomplex.h
+++ b/
include/libstick-0.1/simplicialcomplex.h
@@
-149,13
+149,22
@@
class simplicial_complex {
return is_filtration();
}
return is_filtration();
}
+ /** Randomize order. It has hardly any impact on runtime, but
+ * it makes cycles "nicer" when the simplice's function values
+ * are constant.
+ * */
+ void randomize_order() {
+ std::random_shuffle(order.begin(), order.end());
+ restore_revorder_from_order();
+ }
+
/** Sort simplices such that is_monotone() gives true. This
* requires that the complex's is_monotone() gave true
* beforehand.*/
void make_monotone_filtration() {
assert(c.is_monotone());
/** Sort simplices such that is_monotone() gives true. This
* requires that the complex's is_monotone() gave true
* beforehand.*/
void make_monotone_filtration() {
assert(c.is_monotone());
- sort(order.begin(), order.end(), cmp_monotone_filtration(c));
+ s
td::s
ort(order.begin(), order.end(), cmp_monotone_filtration(c));
restore_revorder_from_order();
assert(c.is_monotone());
restore_revorder_from_order();
assert(c.is_monotone());