Skip to content

Commit 55dce87

Browse files
authored
Merge pull request #265 from RyomaAsai/2.0dev
Make threshold_angle depend on vector history size
2 parents 3deeca5 + 061f393 commit 55dce87

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

anphon/optimizers.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ class FarkasIII_Optimizer : public Optimizer {
123123
H = A.transpose() * H * A + s * s.transpose() / ys;
124124
}
125125
}
126+
threshold_angle = 0.0; // We set angle threshold to be zero when we store more than 9 vectors
127+
if (size == 2) threshold_angle = 0.97;
128+
if (size == 3) threshold_angle = 0.84;
129+
if (size == 4) threshold_angle = 0.71;
130+
if (size == 5) threshold_angle = 0.67;
131+
if (size == 6) threshold_angle = 0.62;
132+
if (size == 7) threshold_angle = 0.56;
133+
if (size == 8) threshold_angle = 0.49;
134+
if (size == 9) threshold_angle = 0.41;
135+
126136
gradient_old = gradient;
127137
point_old = point;
128138

@@ -184,4 +194,4 @@ class FarkasIII_Optimizer : public Optimizer {
184194
Eigen::MatrixXd H;
185195
std::vector<Eigen::VectorXd> points;
186196
std::vector<Eigen::VectorXd> residuals;
187-
};
197+
};

0 commit comments

Comments
 (0)