Commit 6d790dcf authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] add TRACE_SOLVER option

fix https://github.com/stack-of-tasks/tsid/issues/93
parent 4c4d0402
......@@ -25,6 +25,9 @@ SET(PROJECT_NAME eiquadprog)
SET(PROJECT_DESCRIPTION "C++ reimplementation of eiquadprog")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
# Project options
OPTION(TRACE_SOLVER "trace solver on stderr" OFF)
# Project configuration
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
SET(CXX_DISABLE_WERROR TRUE)
......@@ -50,7 +53,7 @@ SET(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/eiquadprog-fast.hpp
include/${PROJECT_NAME}/eiquadprog-rt.hpp
include/${PROJECT_NAME}/eiquadprog-rt.hxx
include/${PROJECT_NAME}/eiquadprog-utils.hxx
include/${PROJECT_NAME}/eiquadprog-utils.hxx
)
ADD_LIBRARY(${PROJECT_NAME} SHARED
......@@ -58,6 +61,10 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED
src/eiquadprog.cpp
)
IF(TRACE_SOLVER)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE TRACE_SOLVER)
ENDIF(TRACE_SOLVER)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM INTERFACE ${EIGEN3_INCLUDE_DIR})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
......
#include <iostream>
#include "eiquadprog/eiquadprog-fast.hpp"
#define TRACE_SOLVER
namespace eiquadprog {
namespace solvers {
......
......@@ -193,7 +193,7 @@ l2a: /* Step 2a: determine step direction */
print_vector("r", r, iq + 1);
print_vector("u", u, iq + 1);
print_vector("d", d, n);
print_ivector("A", A, iq + 1);
print_vector("A", A, iq + 1);
#endif
/* Step 2b: compute step length */
......@@ -240,7 +240,7 @@ l2a: /* Step 2a: determine step direction */
std::cerr << " in dual space: " << f_value << std::endl;
print_vector("x", x, n);
print_vector("z", z, n);
print_ivector("A", A, iq + 1);
print_vector("A", A, iq + 1);
#endif
goto l2a;
}
......@@ -258,7 +258,7 @@ l2a: /* Step 2a: determine step direction */
print_vector("x", x, n);
print_vector("u", u, iq + 1);
print_vector("r", r, iq + 1);
print_ivector("A", A, iq + 1);
print_vector("A", A, iq + 1);
#endif
if (t == t2) {
......@@ -273,7 +273,7 @@ l2a: /* Step 2a: determine step direction */
delete_constraint(R, J, A, u, p, iq, ip);
#ifdef TRACE_SOLVER
print_matrix("R", R, n);
print_ivector("A", A, iq);
print_vector("A", A, iq);
#endif
for (i = 0; i < m; i++) iai(i) = static_cast<VectorXi::Scalar>(i);
for (i = 0; i < iq; i++) {
......@@ -287,7 +287,7 @@ l2a: /* Step 2a: determine step direction */
iai(ip) = -1;
#ifdef TRACE_SOLVER
print_matrix("R", R, n);
print_ivector("A", A, iq);
print_vector("A", A, iq);
#endif
goto l1;
}
......@@ -302,7 +302,7 @@ l2a: /* Step 2a: determine step direction */
delete_constraint(R, J, A, u, p, iq, l);
#ifdef TRACE_SOLVER
print_matrix("R", R, n);
print_ivector("A", A, iq);
print_vector("A", A, iq);
#endif
s(ip) = CI.col(ip).dot(x) + ci0(ip);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment