{"id":25441396,"url":"https://github.com/bertcarnell/lhslib","last_synced_at":"2026-02-23T22:14:46.853Z","repository":{"id":11991084,"uuid":"14567354","full_name":"bertcarnell/lhslib","owner":"bertcarnell","description":"Latin hypercube sampling code for the lhs pacakge in the statistical software package R (www.r-project.org)","archived":false,"fork":false,"pushed_at":"2022-03-19T00:17:14.000Z","size":937,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-20T18:12:42.687Z","etag":null,"topics":["c-plus-plus","latin-hypercube-sampling","r","rcpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertcarnell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2013-11-20T19:53:43.000Z","updated_at":"2023-09-17T06:43:37.000Z","dependencies_parsed_at":"2022-09-18T05:35:58.294Z","dependency_job_id":null,"html_url":"https://github.com/bertcarnell/lhslib","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhslib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhslib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhslib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhslib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertcarnell","download_url":"https://codeload.github.com/bertcarnell/lhslib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239288778,"owners_count":19614187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","latin-hypercube-sampling","r","rcpp"],"created_at":"2025-02-17T12:28:00.420Z","updated_at":"2025-11-01T12:30:37.568Z","avatar_url":"https://github.com/bertcarnell.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"lhslib\n======\n\nC++ Latin hypercube sampling code.  Used in the `lhs` pacakge in the R statistical software (www.r-project.org).  \nLink to the `lhs` project page [here](https://bertcarnell.github.io/lhslib/html/index.html).\n\n|\u003csub\u003eLinux \u0026 MacOS\u003c/sub\u003e|\u003csub\u003eWindows\u003c/sub\u003e|\u003csub\u003eCode Coverage\u003c/sub\u003e|\u003csub\u003eActions\u003c/sub\u003e|\u003csub\u003eCodeQL\u003c/sub\u003e|\u003csub\u003eLinter\u003c/sub\u003e|\n|:---:|:---:|:---:|:---:|:---:|:---:|\n|[![Build Status](https://travis-ci.org/bertcarnell/lhslib.svg?branch=master)](https://travis-ci.org/bertcarnell/lhslib)|[![Build status](https://ci.appveyor.com/api/projects/status/7xd7sohoug7c0d42?svg=true)](https://ci.appveyor.com/project/bertcarnell/lhslib)|[![codecov](https://codecov.io/gh/bertcarnell/lhslib/branch/master/graph/badge.svg)](https://codecov.io/gh/bertcarnell/lhslib)|[![CMake](https://github.com/bertcarnell/lhslib/workflows/CMake/badge.svg)](https://github.com/bertcarnell/lhslib/actions)|[![CodeQL](https://github.com/bertcarnell/lhslib/workflows/CodeQL/badge.svg)](https://github.com/bertcarnell/lhslib/actions)|[![CppLinter](https://github.com/bertcarnell/lhslib/workflows/CppLinter/badge.svg)](https://github.com/bertcarnell/lhslib/actions)|\n\n## Connections to Other Projects\n\n- [oa](https://github.com/bertcarnell/oa) orthogonal array project\n- [bclib](https://github.com/bertcarnell/bclib) bertcarnell template library\n- [lhs](https://bertcarnell.github.io/lhslib) package\n- [R project](http://www.r-project.org)\n- [lhs on CRAN](https://r-forge.r-project.org/projects/lhs/)\n- [doxygen](http://www.stack.nl/~dimitri/doxygen/)\n\n## Documentation\n\nThe API is primarily documented through the Doxygen documentation supplied [here](http://bertcarnell.github.io/lhslib/).\n\n## Examples\n\nThe following code illustrates how the API is called from C++.  The `bclib::matrix\u003cT\u003e` class is a simple matrix class that only \nincludes necessary operations ([bclib](https://github.com/bertcarnell/bclib)).  More\nrobust matrix templates could be used in the future.  `lhslib` is the namespace of this project.\n\n#### randomLHS Algorithm\n\n```c\nint n = 4;\nint k = 3;\nbool bPreserveDraw = false;\nbclib::matrix\u003cdouble\u003e result = bclib::matrix\u003cdouble\u003e(n,k);\n\nbclib::CRandomStandardUniform oRandom = bclib::CRandomStandardUniform();\noRandom.setSeed(1976, 1968);\nlhslib::randomLHS(n, k, bPreserveDraw, result, oRandom);\n```\n\n#### improvedLHS Algorithm\n\n```c\nint n = 4;\nint k = 3;\nint dup = 5;\nbclib::matrix\u003cint\u003e result = bclib::matrix\u003cint\u003e(n,k);\n\nbclib::CRandomStandardUniform oRandom = bclib::CRandomStandardUniform();\noRandom.setSeed(1976, 1968);\nlhslib::improvedLHS(n, k, dup, result, oRandom);\n```\n\n#### maximinLHS Algorithm\n\n```c\nint n = 4;\nint k = 3;\nint dup = 5;\nbclib::matrix\u003cint\u003e result = bclib::matrix\u003cint\u003e(n, k);\n\nbclib::CRandomStandardUniform oRandom = bclib::CRandomStandardUniform();\noRandom.setSeed(1976, 1968);\nlhslib::maximinLHS(n, k, dup, result, oRandom);\n```\n\n#### optimumLHS Algorithm\n\n```c\nint n = 4;\nint k = 3;\nint maxSweeps = 2;\ndouble eps = 0.1;\nint jLen = 7; // (4 choose 2) + 1\nbclib::matrix\u003cint\u003e result = bclib::matrix\u003cint\u003e(n, k);\n\nbclib::CRandomStandardUniform oRandom = bclib::CRandomStandardUniform();\noRandom.setSeed(1976, 1968);\nlhslib::optimumLHS(n, k, maxSweeps, eps, result, jLen, oRandom, false);\n```\n\n#### geneticLHS Algorithm\n\n```c\nint n = 10;\nint k = 4;\nint pop = 20;\nint gen = 5;\ndouble pMut = 0.10;\nstd::string crit = \"S\";\nbool verbose = false;\nbclib::matrix\u003cdouble\u003e result = bclib::matrix\u003cdouble\u003e(n, k);\n\nbclib::CRandomStandardUniform oRandom = bclib::CRandomStandardUniform();\noRandom.setSeed(1976, 1968);\nlhslib::geneticLHS(n, k, pop, gen, pMut, crit, verbose, result, oRandom);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertcarnell%2Flhslib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertcarnell%2Flhslib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertcarnell%2Flhslib/lists"}