File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ class HPolytope {
5656 MT A; // matrix A
5757 VT b; // vector b, s.t.: Ax<=b
5858 std::pair<Point, NT> _inner_ball;
59+ bool normalized = 0 ;
5960
6061public:
6162 // TODO: the default implementation of the Big3 should be ok. Recheck.
@@ -881,14 +882,23 @@ class HPolytope {
881882 return A;
882883 }
883884
885+
886+ bool is_normalized ()
887+ {
888+ return normalized;
889+ }
890+
884891 void normalize ()
885892 {
886- NT row_norm;
887- for (int i = 0 ; i < num_of_hyperplanes (); ++i)
888- {
889- row_norm = A.row (i).norm ();
890- A.row (i) = A.row (i) / row_norm;
891- b (i) = b (i) / row_norm;
893+ if (!is_normalized ()){
894+ NT row_norm;
895+ for (int i = 0 ; i < num_of_hyperplanes (); ++i)
896+ {
897+ row_norm = A.row (i).norm ();
898+ A.row (i) = A.row (i) / row_norm;
899+ b (i) = b (i) / row_norm;
900+ }
901+ normalized = true ;
892902 }
893903 }
894904
You can’t perform that action at this time.
0 commit comments