{"id":41205089,"url":"https://github.com/henrikschumacher/cobars","last_synced_at":"2026-01-22T21:56:10.079Z","repository":{"id":180432419,"uuid":"545377526","full_name":"HenrikSchumacher/CoBarS","owner":"HenrikSchumacher","description":"A header-only C++ library for Monte-Carlo sampling of cylic polygons with prescribed edge lengths.","archived":false,"fork":false,"pushed_at":"2025-04-23T14:19:41.000Z","size":22341,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-05T00:24:37.331Z","etag":null,"topics":["conformal-geometry","polygons","random-walk"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HenrikSchumacher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-04T08:58:28.000Z","updated_at":"2025-04-23T14:19:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3d6d59e-2eb5-4098-965c-a7534979963c","html_url":"https://github.com/HenrikSchumacher/CoBarS","commit_stats":null,"previous_names":["henrikschumacher/cyclesampler","henrikschumacher/cobars"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HenrikSchumacher/CoBarS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenrikSchumacher%2FCoBarS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenrikSchumacher%2FCoBarS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenrikSchumacher%2FCoBarS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenrikSchumacher%2FCoBarS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HenrikSchumacher","download_url":"https://codeload.github.com/HenrikSchumacher/CoBarS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenrikSchumacher%2FCoBarS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28672117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["conformal-geometry","polygons","random-walk"],"created_at":"2026-01-22T21:56:09.503Z","updated_at":"2026-01-22T21:56:10.067Z","avatar_url":"https://github.com/HenrikSchumacher.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CoBarS - Conformal Barycenter Sampling\n\nby Jason Cantarella and Henrik Schumacher\n\nA header-only C++ library for Monte-Carlo sampling of cylic polygons with prescribed edge lengths.\n\n# Installation\n\nTo make sure that all submodules are cloned, too, please clone by running the following in the command line:\n\n    git clone --depth 1 --recurse-submodules --shallow-submodules git@github.com:HenrikSchumacher/CoBarS.git\n        \nTo build the documentation, please install doxygen and then run\n\n    doxygen Doxyfile\n    \nThe documentation is then available in `doc/index.html`.\n\n_CoBarS_ is a header-only library with no dependencies other than the _C++ Standard Library_ and the _Standard Template Library_. \n\n_CoBarS_ uses some external pseudorandom number generators. Thanks to their permissive licenses, their code can be inline their code into this repository, so that the user does not have to install anything. These are the pseudorandom number generators:\n\n- [PCG](https://github.com/imneme/pcg-cpp) - _Permuted Congruential Generator_ `pcg64` by Melissa O'Neill.  \n\n- [wy](https://github.com/alainesp/wy) - an implementation of _wyrand_ by Alain Espinosa.\n\n- [Xoshiro256+](https://github.com/Reputeless/Xoshiro-cpp) by Ryo Suzuki. It implements _xoshiro256+_, a pseudorandom number generator by David Blackman and Sebastiano Vigna.\n    \n# Usage\n\n_CoBarS_ is a header-only library. Just include the header `CoBarS.hpp` into your C++ program via\n\n    #include \"CoBarS.hpp\"    \n        \n\nYou can find a more detailed version of the following example in the example program in `Example_RandomClosedPolygon/main.cpp`.\nSuppose we want to create random, equilateral 64-gons along with their sampling weights. \nWe first create a `CoBarS::Sampler` object; this is the main class of the package.\n    \n    constexpr int d = 3; // Dimensions of the ambient space has to be a compile-time constant.\n    const int edge_count = 64;\n    \n    // Create an instance of the CoBarS sampler.\n    // This assumes that equilateral polygons shall be created.\n    CoBarS::Sampler\u003cd,double,std::size_t\u003e S (edge_count);\n\n    \nNext we need some buffers to store the random polygons and the sampling weights. You can allocated them yourself, but we use the container `std::vector` from the _STL_.\n    \n    const std::size_t sample_count = 10000000;\n\n    // Create containers for the polygons `p` and sampling weights `K`.\n    std::vector\u003cdouble\u003e p ( sample_count * (edge_count + 1) * d );\n    std::vector\u003cdouble\u003e K ( sample_count );\n\n    \nFinally submit the buffers to the member function `CreateRandomClosedPolygons`:\n\n    // Whether we want the sampling weights for the quotient space of polygons modulo SO(d) (`quot_space_Q = true`) or not (`quot_space_Q = false`).\n    const bool quot_space_Q = true;\n    \n    const std::size_t thread_count = 8;\n    \n    S.CreateRandomClosedPolygons(\n        \u0026p[0], \u0026K[0], sample_count, quot_space_Q, thread_count\n    );\n    \nFurther useful routines are the following member functions of the class `CoBarS::Sampler`:\n\n- `Sample` - Sample the values of various random functions without wasting memory for the storing all polygons at once.\n\n- `BinnedSample` - Sample into bins and sample moments of various random functions without wasting memory for the storing samples.\n\n- `ConfidenceSample` - Sample mean and variance of various random functions until the confidence intervals of prescibed radius become confidence intervals of desired confidence level.\n    \n\n# Compilation\n\n\nWe developped and tested _CoBarS_ most thoroughly with the _Apple clang_ compiler on macos Sonoma. It should also work with other _clang_ distributions and with _gcc_. However, _clang_ will produce faster executables as we have not optimized our code for _gcc_. (Pull requests with optimizations for _gcc_ and for other architectures are welcome.) \n\n_CoBarS_ uses several C++ 20 features, so make sure to use a compatible C++ implementation by issueing the compiler option `-std=c++20` (or higher).\n\nParallelization is facilitated by `std::thread` from the _C++ Standard Library_. So you have to use the compiler option `-pthread`. \n\nOptimization flags like `-O3` or even `-Ofast` are certainly a good idea. I also found that using `-flto` can make a measurable difference (but it ramps up compile time).\n\nWith _clang_ as compiler you also have to issue `-fenable-matrix` to enable the clang matrix extension.\n\nAs already said, _CoBarS_ is a header-only library. So no external libraries have to be linked.\n\nSee also the example programs in the directories `Example_RandomClosedPolygon`, `Example_Sample_Binned`, and `Example_ConfidenceSample` for usage examples and more detailed compilation instructions.\n\nSee also [CoBarSLink](https://github.com/HenrikSchumacher/CoBarSLink) for a more user-friendly _Mathematica_ package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrikschumacher%2Fcobars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenrikschumacher%2Fcobars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrikschumacher%2Fcobars/lists"}