Fix more memory alignment issues

release/4.3a0
Sean Bowman 2018-09-18 17:29:02 -04:00
parent b04c0bb15d
commit c1b14f08f8
9 changed files with 33 additions and 8 deletions

View File

@ -230,6 +230,9 @@ private:
ar & BOOST_SERIALIZATION_NVP(pose_); ar & BOOST_SERIALIZATION_NVP(pose_);
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// end of class PinholeBase // end of class PinholeBase
@ -413,6 +416,9 @@ private:
} }
/// @} /// @}
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// manifold traits // manifold traits

View File

@ -324,6 +324,8 @@ private:
ar & BOOST_SERIALIZATION_NVP(K_); ar & BOOST_SERIALIZATION_NVP(K_);
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// manifold traits // manifold traits

View File

@ -221,6 +221,8 @@ private:
boost::serialization::base_object<PinholeBase>(*this)); boost::serialization::base_object<PinholeBase>(*this));
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// end of class PinholeBaseK // end of class PinholeBaseK
@ -422,6 +424,8 @@ private:
ar & BOOST_SERIALIZATION_NVP(K_); ar & BOOST_SERIALIZATION_NVP(K_);
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// end of class PinholePose // end of class PinholePose

View File

@ -208,6 +208,8 @@ private:
/// @} /// @}
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// Define GTSAM traits // Define GTSAM traits

View File

@ -24,7 +24,7 @@
namespace gtsam { namespace gtsam {
Vector4 triangulateHomogeneousDLT( Vector4 triangulateHomogeneousDLT(
const std::vector<Matrix34>& projection_matrices, const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
const Point2Vector& measurements, double rank_tol) { const Point2Vector& measurements, double rank_tol) {
// number of cameras // number of cameras
@ -53,7 +53,7 @@ Vector4 triangulateHomogeneousDLT(
return v; return v;
} }
Point3 triangulateDLT(const std::vector<Matrix34>& projection_matrices, Point3 triangulateDLT(const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
const Point2Vector& measurements, double rank_tol) { const Point2Vector& measurements, double rank_tol) {
Vector4 v = triangulateHomogeneousDLT(projection_matrices, measurements, rank_tol); Vector4 v = triangulateHomogeneousDLT(projection_matrices, measurements, rank_tol);

View File

@ -53,7 +53,7 @@ public:
* @return Triangulated point, in homogeneous coordinates * @return Triangulated point, in homogeneous coordinates
*/ */
GTSAM_EXPORT Vector4 triangulateHomogeneousDLT( GTSAM_EXPORT Vector4 triangulateHomogeneousDLT(
const std::vector<Matrix34>& projection_matrices, const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
const Point2Vector& measurements, double rank_tol = 1e-9); const Point2Vector& measurements, double rank_tol = 1e-9);
/** /**
@ -64,7 +64,7 @@ GTSAM_EXPORT Vector4 triangulateHomogeneousDLT(
* @return Triangulated Point3 * @return Triangulated Point3
*/ */
GTSAM_EXPORT Point3 triangulateDLT( GTSAM_EXPORT Point3 triangulateDLT(
const std::vector<Matrix34>& projection_matrices, const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
const Point2Vector& measurements, const Point2Vector& measurements,
double rank_tol = 1e-9); double rank_tol = 1e-9);
@ -213,6 +213,8 @@ struct CameraProjectionMatrix {
} }
private: private:
const Matrix3 K_; const Matrix3 K_;
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
/** /**
@ -238,7 +240,7 @@ Point3 triangulatePoint3(const std::vector<Pose3>& poses,
throw(TriangulationUnderconstrainedException()); throw(TriangulationUnderconstrainedException());
// construct projection matrices from poses & calibration // construct projection matrices from poses & calibration
std::vector<Matrix34> projection_matrices; std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>> projection_matrices;
CameraProjectionMatrix<CALIBRATION> createP(*sharedCal); // partially apply CameraProjectionMatrix<CALIBRATION> createP(*sharedCal); // partially apply
for(const Pose3& pose: poses) for(const Pose3& pose: poses)
projection_matrices.push_back(createP(pose)); projection_matrices.push_back(createP(pose));
@ -288,7 +290,7 @@ Point3 triangulatePoint3(
throw(TriangulationUnderconstrainedException()); throw(TriangulationUnderconstrainedException());
// construct projection matrices from poses & calibration // construct projection matrices from poses & calibration
std::vector<Matrix34> projection_matrices; std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>> projection_matrices;
for(const CAMERA& camera: cameras) for(const CAMERA& camera: cameras)
projection_matrices.push_back( projection_matrices.push_back(
CameraProjectionMatrix<typename CAMERA::CalibrationType>(camera.calibration())( CameraProjectionMatrix<typename CAMERA::CalibrationType>(camera.calibration())(

View File

@ -135,6 +135,9 @@ private:
ar & bs::make_nvp("preintegrated_H_biasAcc_", bs::make_array(preintegrated_H_biasAcc_.data(), preintegrated_H_biasAcc_.size())); ar & bs::make_nvp("preintegrated_H_biasAcc_", bs::make_array(preintegrated_H_biasAcc_.data(), preintegrated_H_biasAcc_.size()));
ar & bs::make_nvp("preintegrated_H_biasOmega_", bs::make_array(preintegrated_H_biasOmega_.data(), preintegrated_H_biasOmega_.size())); ar & bs::make_nvp("preintegrated_H_biasOmega_", bs::make_array(preintegrated_H_biasOmega_.data(), preintegrated_H_biasOmega_.size()));
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
} /// namespace gtsam } /// namespace gtsam

View File

@ -80,6 +80,8 @@ public:
return error; return error;
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
/** /**
@ -198,6 +200,8 @@ public:
return f_ * reprojectionError; return f_ * reprojectionError;
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// EssentialMatrixFactor2 // EssentialMatrixFactor2
@ -281,6 +285,8 @@ public:
} }
} }
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
}; };
// EssentialMatrixFactor3 // EssentialMatrixFactor3

View File

@ -252,7 +252,7 @@ public:
y += F.transpose() * e3; y += F.transpose() * e3;
} }
typedef std::vector<Vector2> Error2s; typedef std::vector<Vector2, Eigen::aligned_allocator<Vector2>> Error2s;
/** /**
* @brief Calculate corrected error Q*(e-ZDim*b) = (I - E*P*E')*(e-ZDim*b) * @brief Calculate corrected error Q*(e-ZDim*b) = (I - E*P*E')*(e-ZDim*b)