==3123834== Memcheck, a memory error detector ==3123834== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al. ==3123834== Using Valgrind-3.27.1 and LibVEX; rerun with -h for copyright info ==3123834== Command: /data/localhost/ripley/R/R-devel-vg/bin/exec/R --vanilla ==3123834== R Under development (unstable) (2026-07-29 r90317) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "secrfunc" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('secrfunc') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("hdotpolycpp") > ### * hdotpolycpp > > flush(stderr()); flush(stdout()) > > ### Name: hdotpolycpp > ### Title: Net Detection Hazard for Polygon and Transect Detectors > ### Aliases: hdotpolycpp > > ### ** Examples > > > set.seed(123) > > # 50 random points > xy <- matrix(runif(100), ncol = 2) * 2 - 1 > > # centred unit polygon > traps <- matrix(c(0,0,1,1,0,0,1,1,0,0), ncol = 2) - 0.5 > > Tsk <- matrix(1, nrow = 1, ncol = 5) > markocc <- rep(1,5) > cumk <- c(0,5,0) # zero-terminated > detectfn <- 14 # hazard half-normal > gsb <- c(lambda0 = 0.2, sigma = 0.5) > > h <- hdotpolycpp(xy, traps, Tsk, markocc, cumk, detectfn, gsb, + convex = TRUE, dim = 2, grain = 1, ncores = 2) ==3123834== Invalid read of size 8 ==3123834== at 0x1245B76F: hdotpoly::operator()(unsigned long, unsigned long) (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/hdot.cpp:73) ==3123834== by 0xBF2AB6E: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:23) ==3123834== by 0xBF2AB6E: __invoke_impl&> (/usr/include/c++/16/bits/invoke.h:63) ==3123834== by 0xBF2AB6E: __invoke&> (/usr/include/c++/16/bits/invoke.h:98) ==3123834== by 0xBF2AB6E: invoke&> (/usr/include/c++/16/functional:126) ==3123834== by 0xBF2AB6E: invoke&> (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_utils.h:356) ==3123834== by 0xBF2AB6E: run_body (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:117) ==3123834== by 0xBF2AB6E: void tbb::detail::d1::dynamic_grainsize_mode >::work_balance, RcppParallel::TBBWorker, tbb::detail::d1::auto_partitioner const>, tbb::detail::d1::blocked_range >(tbb::detail::d1::start_for, RcppParallel::TBBWorker, tbb::detail::d1::auto_partitioner const>&, tbb::detail::d1::blocked_range&, tbb::detail::d1::execution_data&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/partitioner.h:450) ==3123834== by 0xBF2AF77: execute, RcppParallel::TBBWorker, const tbb::detail::d1::auto_partitioner>, tbb::detail::d1::blocked_range > (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/partitioner.h:289) ==3123834== by 0xBF2AF77: tbb::detail::d1::start_for, RcppParallel::TBBWorker, tbb::detail::d1::auto_partitioner const>::execute(tbb::detail::d1::execution_data&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:170) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:334) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:470) ==3123834== by 0x12084C52: tbb::detail::r1::task_dispatcher::execute_and_wait(tbb::detail::d1::task*, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.cpp:168) ==3123834== by 0xBF29220: execute_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_task.h:262) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:112) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:104) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:101) ==3123834== by 0xBF29220: parallel_for, RcppParallel::TBBWorker> (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:229) ==3123834== by 0xBF29220: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:72) ==3123834== by 0xBF29220: task_ptr_or_nullptr (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:131) ==3123834== by 0xBF29220: tbb::detail::d2::function_stack_task::execute(tbb::detail::d1::execution_data&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:451) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:334) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:470) ==3123834== by 0x12084C52: tbb::detail::r1::task_dispatcher::execute_and_wait(tbb::detail::d1::task*, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.cpp:168) ==3123834== by 0xBF2891D: execute_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_task.h:262) ==3123834== by 0xBF2891D: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:476) ==3123834== by 0xBF2891D: on_completion(const RcppParallel::TBBParallelForExecutor&):: > (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_template_helpers.h:230) ==3123834== by 0xBF2891D: internal_run_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:477) ==3123834== by 0xBF2891D: run_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:595) ==3123834== by 0xBF2891D: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:105) ==3123834== by 0xBF2891D: tbb::detail::d1::task_arena_function::operator()() const (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:68) ==3123834== by 0x120703E2: tbb::detail::r1::task_arena_impl::execute(tbb::detail::d1::task_arena_base&, tbb::detail::d1::delegate_base&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/arena.cpp:821) ==3123834== by 0xBF27EE3: execute_impl (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:251) ==3123834== by 0xBF27EE3: execute (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:404) ==3123834== by 0xBF27EE3: RcppParallel::tbbParallelFor(unsigned long, unsigned long, RcppParallel::Worker&, unsigned long, int) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:129) ==3123834== by 0x1245A992: hdotpolycpp(Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Vector<13, Rcpp::PreserveStorage> const&, Rcpp::Vector<13, Rcpp::PreserveStorage> const&, int const&, Rcpp::Vector<14, Rcpp::PreserveStorage> const&, bool const&, int const&, int const&, int const&) (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/hdot.cpp:115) ==3123834== by 0x12447D45: _secrfunc_hdotpolycpp (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/RcppExports.cpp:31) ==3123834== by 0x496C93: R_doDotCall (/data/localhost/ripley/R/svn/R-devel/src/main/dotcode.c:801) ==3123834== Address 0x8b5d500 is 1,104 bytes inside a block of size 7,960 alloc'd ==3123834== at 0x4840AE6: malloc (/builddir/build/BUILD/valgrind-3.27.1-build/valgrind-3.27.1/coregrind/m_replacemalloc/vg_replace_malloc.c:447) ==3123834== by 0x5296F9: GetNewPage (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:998) ==3123834== by 0x52B773: Rf_allocVector3 (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:2872) ==3123834== by 0x4A01AF: Rf_allocVector (/data/localhost/ripley/R/svn/R-devel/src/include/Rinlinedfuns.h:609) ==3123834== by 0x4A01AF: duplicate1 (/data/localhost/ripley/R/svn/R-devel/src/main/duplicate.c:359) ==3123834== by 0x5C339C: match5 (/data/localhost/ripley/R/svn/R-devel/src/main/unique.c:1383) ==3123834== by 0x4D8F5D: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8150) ==3123834== by 0x4E40E1: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533) ==3123834== by 0x4E40E1: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7518) ==3123834== by 0x4E44AA: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167) ==3123834== by 0x4E6346: R_execClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2398) ==3123834== by 0x4E70EF: applyClosure_core (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2314) ==3123834== by 0x4E46B8: Rf_applyClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2333) ==3123834== by 0x4E46B8: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1278) ==3123834== by 0x4E9569: do_set (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:3585) ==3123834== ==3123834== Invalid read of size 8 ==3123834== at 0x1245B76F: hdotpoly::operator()(unsigned long, unsigned long) (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/hdot.cpp:73) ==3123834== by 0xBF2AF77: execute, RcppParallel::TBBWorker, const tbb::detail::d1::auto_partitioner>, tbb::detail::d1::blocked_range > (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/partitioner.h:289) ==3123834== by 0xBF2AF77: tbb::detail::d1::start_for, RcppParallel::TBBWorker, tbb::detail::d1::auto_partitioner const>::execute(tbb::detail::d1::execution_data&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:170) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:334) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:470) ==3123834== by 0x12084C52: tbb::detail::r1::task_dispatcher::execute_and_wait(tbb::detail::d1::task*, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.cpp:168) ==3123834== by 0xBF29220: execute_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_task.h:262) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:112) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:104) ==3123834== by 0xBF29220: run (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:101) ==3123834== by 0xBF29220: parallel_for, RcppParallel::TBBWorker> (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/parallel_for.h:229) ==3123834== by 0xBF29220: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:72) ==3123834== by 0xBF29220: task_ptr_or_nullptr (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:131) ==3123834== by 0xBF29220: tbb::detail::d2::function_stack_task::execute(tbb::detail::d1::execution_data&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:451) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:334) ==3123834== by 0x12084C52: local_wait_for_all (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.h:470) ==3123834== by 0x12084C52: tbb::detail::r1::task_dispatcher::execute_and_wait(tbb::detail::d1::task*, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/task_dispatcher.cpp:168) ==3123834== by 0xBF2891D: execute_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_task.h:262) ==3123834== by 0xBF2891D: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:476) ==3123834== by 0xBF2891D: on_completion(const RcppParallel::TBBParallelForExecutor&):: > (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/detail/_template_helpers.h:230) ==3123834== by 0xBF2891D: internal_run_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:477) ==3123834== by 0xBF2891D: run_and_wait (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_group.h:595) ==3123834== by 0xBF2891D: operator() (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:105) ==3123834== by 0xBF2891D: tbb::detail::d1::task_arena_function::operator()() const (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:68) ==3123834== by 0x120703E2: tbb::detail::r1::task_arena_impl::execute(tbb::detail::d1::task_arena_base&, tbb::detail::d1::delegate_base&) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb/src/tbb/arena.cpp:821) ==3123834== by 0xBF27EE3: execute_impl (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:251) ==3123834== by 0xBF27EE3: execute (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/../inst/include/tbb/../oneapi/tbb/task_arena.h:404) ==3123834== by 0xBF27EE3: RcppParallel::tbbParallelFor(unsigned long, unsigned long, RcppParallel::Worker&, unsigned long, int) (/tmp/Rtmp2whG57/R.INSTALL3dbb5d2d0463de/RcppParallel/src/tbb.cpp:129) ==3123834== by 0x1245A992: hdotpolycpp(Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Matrix<14, Rcpp::PreserveStorage> const&, Rcpp::Vector<13, Rcpp::PreserveStorage> const&, Rcpp::Vector<13, Rcpp::PreserveStorage> const&, int const&, Rcpp::Vector<14, Rcpp::PreserveStorage> const&, bool const&, int const&, int const&, int const&) (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/hdot.cpp:115) ==3123834== by 0x12447D45: _secrfunc_hdotpolycpp (/data/localhost/ripley/R/packages/tests-vg/secrfunc/src/RcppExports.cpp:31) ==3123834== by 0x496C93: R_doDotCall (/data/localhost/ripley/R/svn/R-devel/src/main/dotcode.c:801) ==3123834== by 0x4D4C18: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8700) ==3123834== Address 0x8b5d500 is 1,104 bytes inside a block of size 7,960 alloc'd ==3123834== at 0x4840AE6: malloc (/builddir/build/BUILD/valgrind-3.27.1-build/valgrind-3.27.1/coregrind/m_replacemalloc/vg_replace_malloc.c:447) ==3123834== by 0x5296F9: GetNewPage (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:998) ==3123834== by 0x52B773: Rf_allocVector3 (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:2872) ==3123834== by 0x4A01AF: Rf_allocVector (/data/localhost/ripley/R/svn/R-devel/src/include/Rinlinedfuns.h:609) ==3123834== by 0x4A01AF: duplicate1 (/data/localhost/ripley/R/svn/R-devel/src/main/duplicate.c:359) ==3123834== by 0x5C339C: match5 (/data/localhost/ripley/R/svn/R-devel/src/main/unique.c:1383) ==3123834== by 0x4D8F5D: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8150) ==3123834== by 0x4E40E1: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533) ==3123834== by 0x4E40E1: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7518) ==3123834== by 0x4E44AA: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167) ==3123834== by 0x4E6346: R_execClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2398) ==3123834== by 0x4E70EF: applyClosure_core (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2314) ==3123834== by 0x4E46B8: Rf_applyClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2333) ==3123834== by 0x4E46B8: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1278) ==3123834== by 0x4E9569: do_set (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:3585) ==3123834== > > > > > cleanEx() > nameEx("makegkPolygoncpp") > ### * makegkPolygoncpp > > flush(stderr()); flush(stdout()) > > ### Name: makegkPolygoncpp > ### Title: Pre-compute Detection Hazard > ### Aliases: makegkPolygoncpp > > ### ** Examples > > > detectfn <- 14 # hazard half-normal > dim <- 2 > convex <- TRUE > grain <- 1 > ncores <- 2 > # for a single parameter combination > gsbval <- matrix(c(0.2,1), nrow = 1) > cumk <- c(0,5) > # centred unit polygon > traps <- matrix(c(0,0,1,1,0,0,1,1,0,0), ncol = 2) - 0.5 > mask <- as.matrix(expand.grid(x=-2:2, y=-2:2)) > > makegkPolygoncpp(detectfn, dim, convex, grain, ncores, gsbval, cumk, traps, mask) $H [1] 1.256637 $gk [1] 0.0007341427 0.0029253653 0.0046301092 0.0029253653 0.0007341427 [6] 0.0029253653 0.0116186869 0.0183426028 0.0116186869 0.0029253653 [11] 0.0046301092 0.0183426028 0.0289004563 0.0183426028 0.0046301092 [16] 0.0029253653 0.0116186869 0.0183426028 0.0116186869 0.0029253653 [21] 0.0007341427 0.0029253653 0.0046301092 0.0029253653 0.0007341427 $hk [1] 0.0007344123 0.0029296526 0.0046408614 0.0029296526 0.0007344123 [6] 0.0029296526 0.0116867112 0.0185129141 0.0116867112 0.0029296526 [11] 0.0046408614 0.0185129141 0.0293262993 0.0185129141 0.0046408614 [16] 0.0029296526 0.0116867112 0.0185129141 0.0116867112 0.0029296526 [21] 0.0007344123 0.0029296526 0.0046408614 0.0029296526 0.0007344123 > > > > > cleanEx() > nameEx("polygonhistoriescpp") > ### * polygonhistoriescpp > > flush(stderr()); flush(stdout()) > > ### Name: polygonhistoriescpp > ### Title: Probability of Polygon Capture Histories > ### Aliases: polygonhistoriescpp polygonfxicpp > > ### ** Examples > > > datafilename <- system.file("extdata/testdata.RData", package = "secrfunc") > load(datafilename) # loads w, dimw, xy, start, traps, mask, gsbval, cumk, binomN > > detectfn <- 14 # hazard half-normal > dim <- 2 > convex <- TRUE > grain <- 1 > ncores <- 2 > > gkhk <- makegkPolygoncpp(detectfn, dim, convex, grain, ncores, gsbval, cumk, traps, mask) > # see tests for expected result > > nc <- dimw[1] # individuals > S <- dimw[2] # occasions > K <- dimw[3] # single polygon > minp <- 1e-200 > group <- rep(0,nc) > pID <- matrix(1, nrow = S, ncol = 1) > density <- matrix(1/nrow(mask), nrow(mask), 1) > PIA <- as.integer(array (1, dim = c(nc, S, K))) > Tsk <- matrix(1, nrow = K, ncol = S) > h <- matrix(-1) > hindex <- matrix(-1) > debug <- FALSE > > prw <- polygonhistoriescpp(nc, detectfn, grain, ncores, minp, binomN, w, xy, start, + group, gkhk$hk, gkhk$H, gsbval, pID, mask, density, PIA, Tsk, h, hindex, debug) > # see tests for expected result > > fxi <- polygonfxicpp(nc, detectfn, grain, ncores, minp, binomN, w, xy, start, + group, gkhk$hk, gkhk$H, gsbval, pID, mask, density, PIA, Tsk, h, hindex) > # see tests for expected result > > > > > ### *