Use Matrix::Constant or Vector::Constant where appropriate.

release/4.3a0
Alex Hagiopol 2016-04-16 12:20:28 -04:00
parent d9d8e4be6e
commit df2693d2ae
4 changed files with 4 additions and 4 deletions

View File

@ -88,7 +88,7 @@ typename internal::FixedSizeMatrix<X>::type numericalGradient(boost::function<do
TangentX d; TangentX d;
d.setZero(); d.setZero();
Vector g = Vector::Zero(N); // Can be fixed size Eigen::Matrix<double,N,1> g; g.setZero(); // Can be fixed size
for (int j = 0; j < N; j++) { for (int j = 0; j < N; j++) {
d(j) = delta; d(j) = delta;
double hxplus = h(traits<X>::Retract(x, d)); double hxplus = h(traits<X>::Retract(x, d));

View File

@ -154,7 +154,7 @@ namespace gtsam {
if (throwCheirality_) if (throwCheirality_)
throw e; throw e;
} }
return Vector::Ones(2) * 2.0 * K_->fx(); return Vector2::Constant(2.0 * K_->fx());
} }
/** return the measurement */ /** return the measurement */

View File

@ -146,7 +146,7 @@ public:
if (throwCheirality_) if (throwCheirality_)
throw e; throw e;
} }
return Vector::Ones(3) * 2.0 * K_->fx(); return Vector3::Constant(2.0 * K_->fx());
} }
/** return the measured */ /** return the measured */

View File

@ -131,7 +131,7 @@ public:
<< std::endl; << std::endl;
if (throwCheirality_) if (throwCheirality_)
throw e; throw e;
return Vector::Ones(Measurement::dimension) * 2.0 * camera_.calibration().fx(); return Eigen::Matrix<double,Measurement::dimension,1>::Constant(2.0 * camera_.calibration().fx());
} }
} }