bertcarnell / lhs

Provides a number of methods for creating and augmenting Latin Hypercube Samples and Orthogonal Array Latin Hypercube Samples
https://bertcarnell.github.io/lhs/
GNU General Public License v3.0
41 stars 8 forks source link

Memory Error on CRAN checks #14

Closed bertcarnell closed 5 years ago

bertcarnell commented 5 years ago

See https://cran.r-project.org/web/checks/check_results_lhs.html .

As the 'Additional issues' show, this corrupts memory, also seen in the checks for package mlrMBO, with

── 1. Error: mbo works with rf (@test_mbo_rf.R#97) ────────────────────────────
   REAL() can only be applied to a 'numeric', not a 'NULL'
   1: mbo(f, des, learner, ctrl) at testthat/test_mbo_rf.R:97
   2: mboTemplate(opt.problem)
   3: mboTemplate.OptProblem(opt.problem)
   4: mboTemplate(opt.state)
   5: mboTemplate.OptState(opt.state)
   6: proposePoints(opt.state)
   7: proposePointsByInfillOptimization(opt.state)
   8: measureTime({
          prop.points = infill.opt.fun(infill.crit.fun, models = models, control = control,
              par.set = par.set, opt.path = opt.path, designs = designs, iter = iter, progress = progress,
              ...)
      })
   9: force(expr)
   10: infill.opt.fun(infill.crit.fun, models = models, control = control, par.set = par.set, opt.path = opt.path, designs = designs, iter = iter, progress = progress, ...)
   11: generateDesign(control$infill.opt.focussearch.points, ps.local, randomLHS)

(currently showing on its CRAN results page).

Please correct urgently, or we will need to roll lhs back to 0.16.

==14354== Memcheck, a memory error detector
==14354== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==14354== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==14354== Command: /data/blackswan/ripley/R/R-devel-vg/bin/exec/R --vanilla --encoding=UTF-8
==14354== 

R Under development (unstable) (2019-01-26 r76018) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

[snip]

> pkgname <- "lhs"
> source(file.path(R.home("share"), "R", "examples-header.R"))
> options(warn = 1)
> library('lhs')
> 
> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
> base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
> cleanEx()
> nameEx("augmentLHS")
> ### * augmentLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: augmentLHS
> ### Title: Augment a Latin Hypercube Design
> ### Aliases: augmentLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> a <- randomLHS(4,3)
> a
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.44246035
[2,] 0.3744248 0.92940463 0.99797652
[3,] 0.5950088 0.44436131 0.73367631
[4,] 0.8030356 0.66291844 0.03138877
> augmentLHS(a, 2)
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.44246035
[2,] 0.3744248 0.92940463 0.99797652
[3,] 0.5950088 0.44436131 0.73367631
[4,] 0.8030356 0.66291844 0.03138877
[5,] 0.1114111 0.68465727 0.53103627
[6,] 0.9657066 0.28728516 0.30456222
> 
> 
> 
> cleanEx()
> nameEx("createAddelKemp")
> ### * createAddelKemp
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createAddelKemp
> ### Title: Create an orthogonal array using the Addelman-Kempthorne
> ###   algorithm
> ### Aliases: createAddelKemp
> 
> ### ** Examples
> 
> A <- createAddelKemp(3, 3, TRUE)
> B <- createAddelKemp(3, 5, FALSE)
> 
> 
> 
> cleanEx()
> nameEx("createAddelKemp3")
> ### * createAddelKemp3
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createAddelKemp3
> ### Title: Create an orthogonal array using the Addelman-Kempthorne
> ###   algorithm with 2*q^3 rows
> ### Aliases: createAddelKemp3
> 
> ### ** Examples
> 
> A <- createAddelKemp3(3, 3, TRUE)
> B <- createAddelKemp3(3, 5, FALSE)
> 
> 
> 
> cleanEx()
> nameEx("createAddelKempN")
> ### * createAddelKempN
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createAddelKempN
> ### Title: Create an orthogonal array using the Addelman-Kempthorne
> ###   algorithm with alternate strength
> ### Aliases: createAddelKempN
> 
> ### ** Examples
> 
> A <- createAddelKempN(3, 4, 3, TRUE)
> B <- createAddelKempN(3, 4, 4, TRUE)
> 
> 
> 
> cleanEx()
> nameEx("createBose")
> ### * createBose
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createBose
> ### Title: Create an orthogonal array using the Bose algorithm
> ### Aliases: createBose
> 
> ### ** Examples
> 
> A <- createBose(3, 3, FALSE)
> B <- createBose(5, 4, TRUE)
> 
> 
> 
> cleanEx()
> nameEx("createBoseBush")
> ### * createBoseBush
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createBoseBush
> ### Title: Create an orthogonal array using the Bose-Bush algorithm
> ### Aliases: createBoseBush
> 
> ### ** Examples
> 
> A <- createBoseBush(4, 3, FALSE)
> B <- createBoseBush(8, 3, TRUE)
> 
> 
> 
> cleanEx()
> nameEx("createBoseBushl")
> ### * createBoseBushl
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createBoseBushl
> ### Title: Create an orthogonal array using the Bose-Bush algorithm with
> ###   alternate strength >= 3
> ### Aliases: createBoseBushl
> 
> ### ** Examples
> 
> A <- createBoseBushl(3, 3, 3, TRUE)
> B <- createBoseBushl(4, 4, 16, TRUE)
> 
> 
> 
> cleanEx()
> nameEx("createBush")
> ### * createBush
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createBush
> ### Title: Create an orthogonal array using the Bush algorithm
> ### Aliases: createBush
> 
> ### ** Examples
> 
> A <- createBush(3, 3, FALSE)
> B <- createBush(4, 5, TRUE)
> 
> 
> 
> cleanEx()
> nameEx("createBusht")
> ### * createBusht
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: createBusht
> ### Title: Create an orthogonal array using the Bush algorithm with
> ###   alternate strength
> ### Aliases: createBusht
> 
> ### ** Examples
> 
> A <- createBusht(3, 4, 2, TRUE)
> B <- createBusht(3, 4, 3, FALSE)
> G <- createBusht(3, 4, 4, TRUE)
Bush's (1952) theorem has a condition t<q where t
is the strength of the array and q is the number of symbols.
Here we have t = 4 and q = 3.  The array may still
be useful, but a full factorial would have at least as
many columns.
> 
> 
> 
> cleanEx()
> nameEx("create_oalhs")
> ### * create_oalhs
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: create_oalhs
> ### Title: Create an orthogonal array Latin hypercube
> ### Aliases: create_oalhs
> 
> ### ** Examples
> 
> set.seed(34)
> create_oalhs(9, 4, TRUE, FALSE)
             [,1]       [,2]       [,3]       [,4]
 [1,] 0.003632133 0.17150080 0.26553757 0.28866172
 [2,] 0.229212575 0.45013396 0.66606157 0.62949057
 [3,] 0.126626850 0.96407594 0.67523742 0.99687371
 [4,] 0.518150814 0.32242415 0.53141189 0.81277846
 [5,] 0.353800789 0.61608533 0.92301963 0.15472936
 [6,] 0.600600869 0.69969353 0.20873296 0.45940919
 [7,] 0.690266113 0.07464877 0.87633828 0.44084307
 [8,] 0.901217408 0.40585179 0.05540391 0.76277613
 [9,] 0.862973336 0.78360157 0.36756312 0.03557133
> create_oalhs(9, 4, TRUE, FALSE)
           [,1]       [,2]       [,3]       [,4]
 [1,] 0.2390839 0.25420877 0.31468304 0.26184059
 [2,] 0.0169451 0.44020724 0.43299606 0.35601821
 [3,] 0.1663715 0.83212871 0.76571332 0.87048526
 [4,] 0.3502390 0.11975577 0.65774426 0.90019772
 [5,] 0.4550270 0.46598240 0.89298040 0.06234282
 [6,] 0.5815992 0.99797912 0.06886163 0.64594518
 [7,] 0.9777961 0.09996279 0.86133671 0.54012788
 [8,] 0.8609689 0.65296981 0.14619608 0.70387802
 [9,] 0.7435299 0.75548741 0.46797940 0.20704319
> 
> 
> 
> cleanEx()
> nameEx("geneticLHS")
> ### * geneticLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: geneticLHS
> ### Title: Latin Hypercube Sampling with a Genetic Algorithm
> ### Aliases: geneticLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> geneticLHS(4, 3, 50, 5, .25)
           [,1]      [,2]      [,3]
[1,] 0.37297615 0.8758705 0.7422324
[2,] 0.79200507 0.2702780 0.9689422
[3,] 0.54722364 0.6986741 0.1764633
[4,] 0.04788881 0.1428368 0.2788387
> 
> 
> 
> cleanEx()
> nameEx("improvedLHS")
> ### * improvedLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: improvedLHS
> ### Title: Improved Latin Hypercube Sample
> ### Aliases: improvedLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> improvedLHS(4, 3, 2)
          [,1]      [,2]      [,3]
[1,] 0.1028186 0.8882591 0.3693075
[2,] 0.7052366 0.6324299 0.1830784
[3,] 0.9117650 0.1973391 0.9231829
[4,] 0.4457332 0.2558328 0.6194049
> 
> 
> 
> cleanEx()
> nameEx("maximinLHS")
> ### * maximinLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: maximinLHS
> ### Title: Maximin Latin Hypercube Sample
> ### Aliases: maximinLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> maximinLHS(4, 3, dup=2)
          [,1]      [,2]      [,3]
[1,] 0.6028186 0.1382591 0.3693075
[2,] 0.2052366 0.6324299 0.9330784
[3,] 0.9117650 0.9473391 0.1731829
[4,] 0.4457332 0.2558328 0.6194049
> maximinLHS(4, 3, method="build", dup=2)
           [,1]      [,2]       [,3]
[1,] 0.55990735 0.6947287 0.70271756
[2,] 0.01473359 0.1993272 0.40123332
[3,] 0.41057206 0.8638186 0.91368098
[4,] 0.96906730 0.3525210 0.08829932
> maximinLHS(4, 3, method="iterative", eps=0.05, maxIter=100, optimize.on="grid")
           [,1]       [,2]       [,3]
[1,] 0.06756504 0.03234309 0.49404267
[2,] 0.99817102 0.86952951 0.93294813
[3,] 0.65837332 0.48101862 0.08918173
[4,] 0.30330203 0.64969024 0.60786842
> maximinLHS(4, 3, method="iterative", eps=0.05, maxIter=100, optimize.on="result")
           [,1]      [,2]       [,3]
[1,] 0.86328286 0.1392899 0.58219433
[2,] 0.05317488 0.3751102 0.31943898
[3,] 0.63240765 0.7688189 0.04521659
[4,] 0.40366124 0.5711976 0.97377353
> 
> 
> 
> cleanEx()
> nameEx("oa_to_oalhs")
> ### * oa_to_oalhs
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: oa_to_oalhs
> ### Title: Create a Latin hypercube from an orthogonal array
> ### Aliases: oa_to_oalhs
> 
> ### ** Examples
> 
> oa <- createBose(3, 4, TRUE)
> oa_to_oalhs(9, 4, oa, TRUE)
==14354== Invalid read of size 1
==14354==    at 0x4C322B6: __strlen_sse2 (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:463)
==14354==    by 0x7BA0BF7: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BB136: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==  Address 0x1595fcf0 is 0 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354== 
==14354== Invalid read of size 1
==14354==    at 0x4C322C4: __strlen_sse2 (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:463)
==14354==    by 0x7BA0BF7: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BB136: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==  Address 0x1595fcf1 is 1 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354== 
==14354== Invalid read of size 1
==14354==    at 0x4C36B98: mempcpy (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:1537)
==14354==    by 0x7BCDA64: _IO_file_xsputn@@GLIBC_2.2.5 (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA0799: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BB136: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==  Address 0x1595fcf0 is 0 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354== 
==14354== Invalid read of size 1
==14354==    at 0x4C36BA6: mempcpy (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:1537)
==14354==    by 0x7BCDA64: _IO_file_xsputn@@GLIBC_2.2.5 (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA0799: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BB136: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==  Address 0x1595fcf2 is 2 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BB125: oalhslib::printOAandUnique(bclib::matrix<int> const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) (packages/tests-vg/lhs/src/oaLHS.cpp:76)
==14354==    by 0x184BBB96: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:37)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==

initial oa:
0,2,2,0
0,0,1,2
0,1,0,1
1,2,1,1
1,0,0,0
1,1,2,2
2,2,0,2
2,0,2,1
2,1,1,0

unique values per row:
0,1,2,
2,0,1,
2,1,0,
0,2,1,
==14354== Invalid read of size 1
==14354==    at 0x4C36B50: mempcpy (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:1537)
==14354==    by 0x7BCDA64: _IO_file_xsputn@@GLIBC_2.2.5 (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA0799: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BBBB4: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==  Address 0x139f24c7 is 71 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BBBA3: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==    by 0x506AC7: R_ReplConsole (svn/R-devel/src/main/main.c:310)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BBBA3: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354== 
==14354== Invalid read of size 1
==14354==    at 0x4C36B61: mempcpy (/builddir/build/BUILD/valgrind-3.14.0/memcheck/../shared/vg_replace_strmem.c:1537)
==14354==    by 0x7BCDA64: _IO_file_xsputn@@GLIBC_2.2.5 (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA0799: printf_positional (in /usr/lib64/libc-2.27.so)
==14354==    by 0x7BA1B35: vfprintf (in /usr/lib64/libc-2.27.so)
==14354==    by 0x46DCE7: stdout_vfprintf (svn/R-devel/src/main/connections.c:2631)
==14354==    by 0x5404EC: Rvprintf (svn/R-devel/src/main/printutils.c:930)
==14354==    by 0x5405CB: Rprintf (svn/R-devel/src/main/printutils.c:847)
==14354==    by 0x184BBBB4: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==  Address 0x139f24c5 is 69 bytes inside a block of size 73 free'd
==14354==    at 0x4C3052C: operator delete(void*) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:586)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/ext/new_allocator.h:125)
==14354==    by 0x184BD8F2: deallocate (/usr/include/c++/8/bits/alloc_traits.h:462)
==14354==    by 0x184BD8F2: _M_destroy (/usr/include/c++/8/bits/basic_string.h:226)
==14354==    by 0x184BD8F2: _M_dispose (/usr/include/c++/8/bits/basic_string.h:221)
==14354==    by 0x184BD8F2: ~basic_string (/usr/include/c++/8/bits/basic_string.h:657)
==14354==    by 0x184BD8F2: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BBBA3: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:260)
==14354==    by 0x5067EC: Rf_ReplIteration (svn/R-devel/src/main/main.c:200)
==14354==    by 0x506AC7: R_ReplConsole (svn/R-devel/src/main/main.c:310)
==14354==  Block was alloc'd at
==14354==    at 0x4C2F4B6: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.14.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344)
==14354==    by 0xA98531E: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0xA98629A: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) (in /usr/lib64/libstdc++.so.6.0.25)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:1932)
==14354==    by 0x184BD9AD: replace (/usr/include/c++/8/bits/basic_string.h:2121)
==14354==    by 0x184BD9AD: assign<char*> (/usr/include/c++/8/bits/basic_string.h:1471)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:174)
==14354==    by 0x184BD9AD: str (/usr/include/c++/8/sstream:639)
==14354==    by 0x184BD9AD: bclib::matrix<int>::toString() const (packages/tests-vg/lhs/src/matrix.h:696)
==14354==    by 0x184BBBA3: oalhslib::oaLHS(int, int, bclib::matrix<int> const&, bclib::matrix<int>&, bclib::matrix<double>&, bool, bclib::CRandom<double>&) (packages/tests-vg/lhs/src/oaLHS.cpp:44)
==14354==    by 0x184C3628: oa_to_lhs (packages/tests-vg/lhs/src/oalhs_r.cpp:57)
==14354==    by 0x495A83: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==14354==    by 0x4C884F: bcEval (svn/R-devel/src/main/eval.c:6771)
==14354==    by 0x4D870F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==14354==    by 0x4DA2BE: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==14354==    by 0x4DB014: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==14354==    by 0x4D8895: Rf_eval (svn/R-devel/src/main/eval.c:743)
==14354== 

integer lhs:
2,3,1,1
1,6,4,6
3,9,8,8
4,1,6,9
5,4,9,3
6,7,3,5
7,2,7,4
8,5,2,7
9,8,5,2

            [,1]      [,2]       [,3]       [,4]
 [1,] 0.19247930 0.2991924 0.05306885 0.09568994
 [2,] 0.04867746 0.5827553 0.34118656 0.56660735
 [3,] 0.25736352 0.9465149 0.85133390 0.82298113
 [4,] 0.43476399 0.0326226 0.60656286 0.92582163
 [5,] 0.51676339 0.3620019 0.94206058 0.30736785
 [6,] 0.56491632 0.7639246 0.25989699 0.53771559
 [7,] 0.70518705 0.1481972 0.71959458 0.43246648
 [8,] 0.87381550 0.4877766 0.19748008 0.77340200
 [9,] 0.93718439 0.8569461 0.48888826 0.14726135
> 
> 
> 
> cleanEx()
> nameEx("optAugmentLHS")
> ### * optAugmentLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: optAugmentLHS
> ### Title: Optimal Augmented Latin Hypercube Sample
> ### Aliases: optAugmentLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> a <- randomLHS(4,3)
> a
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.44246035
[2,] 0.3744248 0.92940463 0.99797652
[3,] 0.5950088 0.44436131 0.73367631
[4,] 0.8030356 0.66291844 0.03138877
> optAugmentLHS(a, 2, 3)
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.44246035
[2,] 0.3744248 0.92940463 0.99797652
[3,] 0.5950088 0.44436131 0.73367631
[4,] 0.8030356 0.66291844 0.03138877
[5,] 0.9657066 0.28728516 0.53103627
[6,] 0.1114111 0.68465727 0.30456222
> 
> 
> 
> cleanEx()
> nameEx("optSeededLHS")
> ### * optSeededLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: optSeededLHS
> ### Title: Optimum Seeded Latin Hypercube Sample
> ### Aliases: optSeededLHS
> ### Keywords: design
> 
> ### ** Examples
> 
>   a <- randomLHS(4,3)
>   a
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.44246035
[2,] 0.3744248 0.92940463 0.99797652
[3,] 0.5950088 0.44436131 0.73367631
[4,] 0.8030356 0.66291844 0.03138877
>   optSeededLHS(a, 2, 2, .1)
          [,1]       [,2]       [,3]
[1,] 0.1717557 0.09602593 0.30456222
[2,] 0.3744248 0.44436131 0.99797652
[3,] 0.8030356 0.92940463 0.73367631
[4,] 0.5950088 0.66291844 0.03138877
[5,] 0.1114111 0.68465727 0.53103627
[6,] 0.9657066 0.28728516 0.44246035
> 
> 
> 
> cleanEx()
> nameEx("optimumLHS")
> ### * optimumLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: optimumLHS
> ### Title: Optimum Latin Hypercube Sample
> ### Aliases: optimumLHS
> ### Keywords: design
> 
> ### ** Examples
> 
> optimumLHS(4, 3, 5, .05)
          [,1]      [,2]       [,3]
[1,] 0.1717557 0.1794046 0.48367631
[2,] 0.3460259 0.7479765 0.80303563
[3,] 0.9424604 0.3450088 0.66291844
[4,] 0.6244248 0.9443613 0.03138877
> 
> 
> 
> cleanEx()
> nameEx("randomLHS")
> ### * randomLHS
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: randomLHS
> ### Title: Construct a random Latin hypercube design
> ### Aliases: randomLHS
> 
> ### ** Examples
> 
> a <- randomLHS(5, 3)
> 
> 
> 
> ### * <FOOTER>
> ###
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed:  13.496 0.269 13.818 0 0 
> grDevices::dev.off()
null device 
          1 
> ###
> ### Local variables: ***
> ### mode: outline-minor ***
> ### outline-regexp: "\\(> \\)?### [*]+" ***
> ### End: ***
> quit('no')
==14354== 
==14354== HEAP SUMMARY:
==14354==     in use at exit: 57,663,684 bytes in 12,551 blocks
==14354==   total heap usage: 58,746 allocs, 46,195 frees, 98,064,571 bytes allocated
==14354== 
==14354== LEAK SUMMARY:
==14354==    definitely lost: 0 bytes in 0 blocks
==14354==    indirectly lost: 0 bytes in 0 blocks
==14354==      possibly lost: 0 bytes in 0 blocks
==14354==    still reachable: 57,663,684 bytes in 12,551 blocks
==14354==         suppressed: 0 bytes in 0 blocks
==14354== Reachable blocks (those to which a pointer was found) are not shown.
==14354== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==14354== 
==14354== For counts of detected and suppressed errors, rerun with: -v
==14354== ERROR SUMMARY: 290 errors from 6 contexts (suppressed: 0 from 0)
bertcarnell commented 5 years ago

Replicated error on Ubuntu with

R -d valgrind -e 'devtools::run_examples()' > valgrind.out.txt 2>&1

and

R -d valgrind -e 'devtools::load_all("."); oa <- lhs::createBose(3, 4, TRUE); lhs::oa_to_oalhs(9, 4, oa, TRUE)'
bertcarnell commented 5 years ago

Resolved the error in two ways:

  1. change bclib::matrix::toString to return a std::string
  2. change all printf and Rprintf to use std::cout and Rcpp::Rcout
  3. remove the ability of users to use verbose from the R API

This command passed with only errors on "Conditional jump or move depends on uninitialised value(s)"

R -d valgrind -e 'devtools::run_examples()' > valgrind.out.txt 2>&1

This one also passed with the edit that the verbose option is removed

R -d valgrind -e 'devtools::load_all("."); oa <- lhs::createBose(3, 4, TRUE); lhs::oa_to_oalhs(9, 4, oa)'

R CMD check --as-cran passed on Windows in RStudio R CMD check passed on Ubuntu with a clean source package R CMD check --as-cran --use-valgrind passed on Ubuntu with a clean source package

checked on rev b79e3ce9a1185257b3c0aa655a99b2ab7624f0b8

bertcarnell commented 5 years ago

submitted to CRAN for rev ccee05c6f2505f97c88eedd26d9c53a0f54c70af