Skip to content

Commit 41ffcb0

Browse files
committed
Updated R wrapper and added unit tests
1 parent 1739eab commit 41ffcb0

15 files changed

+276
-14
lines changed

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ export(saveBCFModelToJsonString)
6666
export(savePreprocessorToJsonString)
6767
importFrom(R6,R6Class)
6868
importFrom(stats,coef)
69+
importFrom(stats,dnorm)
6970
importFrom(stats,lm)
7071
importFrom(stats,model.matrix)
72+
importFrom(stats,pnorm)
7173
importFrom(stats,predict)
7274
importFrom(stats,qgamma)
75+
importFrom(stats,qnorm)
7376
importFrom(stats,resid)
7477
importFrom(stats,rnorm)
78+
importFrom(stats,runif)
7579
importFrom(stats,sd)
7680
importFrom(stats,sigma)
7781
importFrom(stats,var)

R/cpp11.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ forest_container_from_json_string_cpp <- function(json_string, forest_label) {
252252
.Call(`_stochtree_forest_container_from_json_string_cpp`, json_string, forest_label)
253253
}
254254

255+
forest_merge_cpp <- function(inbound_forest_ptr, outbound_forest_ptr) {
256+
invisible(.Call(`_stochtree_forest_merge_cpp`, inbound_forest_ptr, outbound_forest_ptr))
257+
}
258+
259+
forest_add_constant_cpp <- function(forest_ptr, constant_value) {
260+
invisible(.Call(`_stochtree_forest_add_constant_cpp`, forest_ptr, constant_value))
261+
}
262+
263+
forest_multiply_constant_cpp <- function(forest_ptr, constant_multiple) {
264+
invisible(.Call(`_stochtree_forest_multiply_constant_cpp`, forest_ptr, constant_multiple))
265+
}
266+
255267
forest_container_append_from_json_string_cpp <- function(forest_sample_ptr, json_string, forest_label) {
256268
invisible(.Call(`_stochtree_forest_container_append_from_json_string_cpp`, forest_sample_ptr, json_string, forest_label))
257269
}

R/forest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ Forest <- R6::R6Class(
718718
#' Return constant leaf status of trees in a `Forest` object
719719
#' @return `TRUE` if leaves are constant, `FALSE` otherwise
720720
is_constant_leaf = function() {
721-
return(is_constant_leaf_active_forest_cpp(self$forest_ptr))
721+
return(is_leaf_constant_forest_container_cpp(self$forest_ptr))
722722
},
723723

724724
#' @description

man/Forest.Rd

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bart.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bcf.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/createBCFModelFromJson.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/createBCFModelFromJsonFile.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/getRandomEffectSamples.bcfmodel.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loadVectorJson.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)