summaryrefslogtreecommitdiffstats
path: root/src/libcola/gradient_projection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcola/gradient_projection.h')
-rw-r--r--src/libcola/gradient_projection.h44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/libcola/gradient_projection.h b/src/libcola/gradient_projection.h
index 4ef68fc2e..9907cdb13 100644
--- a/src/libcola/gradient_projection.h
+++ b/src/libcola/gradient_projection.h
@@ -9,11 +9,9 @@
#include <iostream>
#include <math.h>
-using namespace std;
-
-typedef vector<vpsc::Constraint*> Constraints;
-typedef vector<vpsc::Variable*> Variables;
-typedef vector<pair<unsigned,double> > OffsetList;
+typedef std::vector<vpsc::Constraint*> Constraints;
+typedef std::vector<vpsc::Variable*> Variables;
+typedef std::vector<std::pair<unsigned, double> > OffsetList;
class SimpleConstraint {
public:
@@ -23,7 +21,7 @@ public:
unsigned right;
double gap;
};
-typedef vector<SimpleConstraint*> SimpleConstraints;
+typedef std::vector<SimpleConstraint*> SimpleConstraints;
class AlignmentConstraint {
friend class GradientProjection;
public:
@@ -37,7 +35,7 @@ public:
private:
vpsc::Variable* variable;
};
-typedef vector<AlignmentConstraint*> AlignmentConstraints;
+typedef std::vector<AlignmentConstraint*> AlignmentConstraints;
class PageBoundaryConstraints {
public:
@@ -63,7 +61,7 @@ private:
double weight;
};
-typedef vector<pair<unsigned,double> > CList;
+typedef std::vector<std::pair<unsigned, double> > CList;
/**
* A DummyVarPair is a pair of variables with an ideal distance between them and which have no
* other interaction with other variables apart from through constraints. This means that
@@ -170,19 +168,19 @@ friend class GradientProjection;
double old_place_l; // old_place is where the descent vec g was computed
double old_place_r;
};
-typedef vector<DummyVarPair*> DummyVars;
+typedef std::vector<DummyVarPair*> DummyVars;
enum Dim { HORIZONTAL, VERTICAL };
class GradientProjection {
public:
- GradientProjection(
+ GradientProjection(
const Dim k,
- unsigned n,
- double** A,
- double* x,
- double tol,
- unsigned max_iterations,
+ unsigned n,
+ double** A,
+ double* x,
+ double tol,
+ unsigned max_iterations,
AlignmentConstraints* acs=NULL,
bool nonOverlapConstraints=false,
vpsc::Rectangle** rs=NULL,
@@ -222,7 +220,7 @@ public:
if(!gcs.empty() || nonOverlapConstraints) {
constrained=true;
}
- }
+ }
virtual ~GradientProjection() {
delete [] g;
delete [] d;
@@ -236,16 +234,16 @@ public:
}
}
void clearDummyVars();
- unsigned solve(double* b);
+ unsigned solve(double* b);
DummyVars dummy_vars; // special vars that must be considered in Lapl.
private:
vpsc::IncSolver* setupVPSC();
void destroyVPSC(vpsc::IncSolver *vpsc);
Dim k;
- unsigned n; // number of actual vars
- double** A; // Graph laplacian matrix
+ unsigned n; // number of actual vars
+ double** A; // Graph laplacian matrix
double* place;
- Variables vars; // all variables
+ Variables vars; // all variables
// computations
Constraints gcs; /* global constraints - persist throughout all
iterations */
@@ -255,9 +253,9 @@ private:
double tolerance;
AlignmentConstraints* acs;
unsigned max_iterations;
- double* g; /* gradient */
- double* d;
- double* old_place;
+ double* g; /* gradient */
+ double* d;
+ double* old_place;
bool constrained;
};