added 301

This commit is contained in:
Daniele Panozzo
2015-09-11 22:58:59 +02:00
parent b0f890d25b
commit b1ea24a66b
12 changed files with 335 additions and 69 deletions
+49 -7
View File
@@ -11,13 +11,55 @@
#include <Eigen/Dense>
void assert_is_VectorXd(const std::string name, const Eigen::MatrixXd& v);
void assert_is_RowVectorXd(const std::string name, const Eigen::MatrixXd& v);
void assert_is_Vector3d(const std::string name, const Eigen::MatrixXd& v);
void assert_is_RowVector3d(const std::string name, const Eigen::MatrixXd& v);
void assert_is_Vector4d(const std::string name, const Eigen::MatrixXd& v);
void assert_is_RowVector4d(const std::string name, const Eigen::MatrixXd& v);
void assert_is_Matrix4d(const std::string name, const Eigen::MatrixXd& v);
template<typename Scalar>
void assert_is_VectorX(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if (v.cols() != 1)
throw std::runtime_error(name + " must be a column vector.");
}
template<typename Scalar>
void assert_is_RowVectorX(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if (v.rows() != 1)
throw std::runtime_error(name + " must be a row vector.");
}
template<typename Scalar>
void assert_is_Vector3(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if ((v.cols() != 1) || (v.rows() != 3))
throw std::runtime_error(name + " must be a column vector with 3 entries.");
}
template<typename Scalar>
void assert_is_RowVector3(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if ((v.cols() != 3) || (v.rows() != 1))
throw std::runtime_error(name + " must be a row vector with 3 entries.");
}
template<typename Scalar>
void assert_is_Vector4(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if ((v.cols() != 1) || (v.rows() != 4))
throw std::runtime_error(name + " must be a column vector with 4 entries.");
}
template<typename Scalar>
void assert_is_RowVector4(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if ((v.cols() != 4) || (v.rows() != 1))
throw std::runtime_error(name + " must be a row vector with 4 entries.");
}
template<typename Scalar>
void assert_is_Matrix4(const std::string name, const Eigen::PlainObjectBase<Scalar>& v)
{
if ((v.cols() != 4) || (v.rows() != 4))
throw std::runtime_error(name + " must be a 4x4 matrix.");
}
namespace py = pybind;