.. _program_listing_file_include_eiquadprog_eiquadprog-utils.hxx: Program Listing for File eiquadprog-utils.hxx ============================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/eiquadprog/eiquadprog-utils.hxx``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef EIQUADPROG_UTILS_HPP_ #define EIQUADPROG_UTILS_HPP_ #include #include namespace eiquadprog { namespace utils { template inline Scalar distance(Scalar a, Scalar b) { Scalar a1, b1, t; a1 = std::abs(a); b1 = std::abs(b); if (a1 > b1) { t = (b1 / a1); return a1 * std::sqrt(1.0 + t * t); } else if (b1 > a1) { t = (a1 / b1); return b1 * std::sqrt(1.0 + t * t); } return a1 * std::sqrt(2.0); } template void print_vector(const char *name, Eigen::MatrixBase &x) { std::cerr << name << x.transpose() << std::endl; } template void print_matrix(const char *name, Eigen::MatrixBase &x) { std::cerr << name << std::endl << x << std::endl; } template void print_vector(const char *name, Eigen::MatrixBase &x, int /*n*/) { print_vector(name, x); } template void print_matrix(const char *name, Eigen::MatrixBase &x, int /*n*/) { print_matrix(name, x); } } // namespace utils } // namespace eiquadprog #endif