Skip to content
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build options
option(USE_DEBUG "Set to ON for Debug mode" OFF)
option(USE_SANITIZER "Use santizer flags" ON)
option(USE_SANITIZER "Use santizer flags" OFF)
option(BUILD_TEST "Build C++ tests with Google Test" ON)
option(BUILD_DEBUG_TARGETS "Build Standalone C++ Programs for Debugging" ON)

Expand Down Expand Up @@ -107,10 +107,15 @@ if(BUILD_TEST)
endif()

if(BUILD_DEBUG_TARGETS)
# Build test suite
add_executable(debugstochtree debug/api_debug.cpp)
# Debug basic stochtree interface
set(StochTree_DEBUG_HEADER_DIR ${PROJECT_SOURCE_DIR}/cpp)
add_executable(debugstochtree debug/api_debug.cpp)
target_include_directories(debugstochtree PRIVATE ${StochTree_HEADER_DIR} ${BOOSTMATH_HEADER_DIR} ${EIGEN_HEADER_DIR} ${StochTree_DEBUG_HEADER_DIR})
target_link_libraries(debugstochtree PRIVATE stochtree_objs)

# Debug BCF interface
add_executable(debugbcf debug/bcf_debug.cpp)
target_include_directories(debugbcf PRIVATE ${StochTree_HEADER_DIR} ${BOOSTMATH_HEADER_DIR} ${EIGEN_HEADER_DIR} ${StochTree_DEBUG_HEADER_DIR})
target_link_libraries(debugbcf PRIVATE stochtree_objs)
endif()

16 changes: 8 additions & 8 deletions debug/api_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

namespace StochTree{

enum ForestLeafModel {
kConstant,
kUnivariateRegression,
kMultivariateRegression
};
// enum ForestLeafModel {
// kConstant,
// kUnivariateRegression,
// kMultivariateRegression
// };

void GenerateRandomData(std::vector<double>& covariates, std::vector<double>& basis, std::vector<double>& outcome, std::vector<double>& rfx_basis, std::vector<int32_t>& rfx_groups, int n, int x_cols, int omega_cols, int y_cols, int rfx_basis_cols) {
std::mt19937 gen(101);
Expand All @@ -38,15 +38,15 @@ void GenerateRandomData(std::vector<double>& covariates, std::vector<double>& ba

for (int i = 0; i < n; i++) {
for (int j = 0; j < x_cols; j++) {
covariates[i*x_cols + j] = uniform_dist(gen);
covariates[j*n + i] = uniform_dist(gen);
}

for (int j = 0; j < omega_cols; j++) {
basis[i*omega_cols + j] = uniform_dist(gen);
basis[j*n + i] = uniform_dist(gen);
}

for (int j = 0; j < rfx_basis_cols; j++) {
rfx_basis[i*rfx_basis_cols + j] = 1;
rfx_basis[j*n + i] = 1;
}

if (i % 2 == 0) {
Expand Down
Loading