{"id":23689441,"url":"https://github.com/markjolah/priorhessian","last_synced_at":"2026-01-13T12:30:18.120Z","repository":{"id":228623910,"uuid":"108030685","full_name":"markjolah/PriorHessian","owner":"markjolah","description":"Library for fast computation of log-likelihoods and derivatives of multivariate prior distributions","archived":false,"fork":false,"pushed_at":"2019-07-01T02:01:13.000Z","size":18281,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T00:52:36.686Z","etag":null,"topics":["log-likelihood","prior"],"latest_commit_sha":null,"homepage":"https://markjolah.github.io/PriorHessian","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markjolah.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-23T19:40:40.000Z","updated_at":"2019-07-01T01:58:22.000Z","dependencies_parsed_at":"2024-03-19T18:26:22.787Z","dependency_job_id":"e781202d-ceef-4b3a-af76-4808e9bbcaf0","html_url":"https://github.com/markjolah/PriorHessian","commit_stats":null,"previous_names":["markjolah/priorhessian"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjolah%2FPriorHessian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjolah%2FPriorHessian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjolah%2FPriorHessian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markjolah%2FPriorHessian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markjolah","download_url":"https://codeload.github.com/markjolah/PriorHessian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239751441,"owners_count":19690853,"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":["log-likelihood","prior"],"created_at":"2024-12-30T00:51:56.628Z","updated_at":"2026-01-13T12:30:18.070Z","avatar_url":"https://github.com/markjolah.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://travis-ci.org/markjolah/PriorHessian\"\u003e\u003cimg src=\"https://travis-ci.org/markjolah/PriorHessian.svg?branch=master\"/\u003e\u003c/a\u003e\n\n# Prior Hessian\nLibrary for fast computation of log-likelihoods and derivatives of multivariate priors defined as composites of univariate  multivariate distributions especially designed for support of\nArchimedean copulas.\n\n## Documentation\nThe PriorHessian Doxygen documentation can be build with the `OPT_DOC` CMake option and is also available on online:\n  * [PriorHessian HTML Manual](https://markjolah.github.io/PriorHessian/index.html)\n  * [PriorHessian PDF Manual](https://markjolah.github.io/PriorHessian/pdf/PriorHessian-0.2.1-reference.pdf)\n  * [PriorHessian github repository](https://github.com/markjolah/PriorHessian)\n\n## Installation\n\nThe PriorHessian library uses CMake and is designed to be installed either as a native package, or as a relocatable package in an arbitrary install prefix.  The default build script will install to the `_install` directory underneath the repository root.\n\n * **Default release build script**\n    * builds to `${BUILD_PATH}` if set or default of: `${CMAKE_SOURCE_DIR}\\_build\\Release`\n    * installs to `${INSTALL_PATH}` if set or default of: `${CMAKE_SOURCE_DIR}\\_install`\n```\n$ ./build.sh \u003ccmake-extra-opts\u003e\n```\n * **Default Debug build script**\n    * builds to `${BUILD_PATH}` if set or default of: `${CMAKE_SOURCE_DIR}\\_build\\Debug`\n    * installs to `${INSTALL_PATH}` if set or default of: `${CMAKE_SOURCE_DIR}\\_install`\n```\n$ ./build.debug.sh \u003ccmake-extra-opts\u003e\n```\n * **Manual CMake Build**\n```\n$ cmake -H. -B\u003cbuild-path\u003e -DCMAKE_INSTALL_PREFEX=\u003cinstall-path\u003e -DCMAKE_BUILD_TYPE=Release \u003cother-cmake-args\u003e\n$ cd \u003cbuild-path\u003e \u0026\u0026 make -j\u003cnum-procs\u003e install\n```\n\n### Dependencies\n\n* [*Armadillo*](http://arma.sourceforge.net/docs.html) - A high-performance array library for C++.\n* *BLAS* - A BLAS implemenation: [Netlib BLAS reference](http://www.netlib.org/blas/) or [*OpenBlas*](https://www.openblas.net/)\n* *LAPACK* - A Lapack implemenation: [Netlib LAPACK reference](http://www.netlib.org/lapack/)\n\nNote the `OPT_BLAS_INT64` CMake option controls whether Armadillo uses BLAS and LAPACK libraries that use 64-bit interger indexing.\nMatlab uses 64-bit by default, and to link PriorHessian to Matlab MEX libraries, this option must be on.  Many linux systems only provide 32-bit integer versions of BLAS and Lapack, and the option can be disabled if Matlab support is not a concern and 64-bit support is difficult to manage on\n\n### CMake Options\n\n#### Standard options\n * `BUILD_SHARED_LIBS` - Build shared libraries [Default: On]\n * `BUILD_STATIC_LIBS` - Build static libraries [Default: On]\n * `BUILD_TESTING` - Build tests [Default: On if `CMAKE_BUILD_TYPE=Debug`]\n * `OPT_INSTALL_TESTING` - Install tests. [Default: Off]\n * `OPT_DOC` - Build and install documentation (enables `make doc` and `make pdf`) [Default: Off]\n * `OPT_EXPORT_BUILD_TREE` - Enable CMake export and `find_package(BacktraceException)` support from the build-tree.\n\n#### Dependency options\n * `OPT_BLAS_INT64` - Enable 64-bit integer BLAS library support [Default: Off]\n\n\n### External Projects\nThese packages are specialized CMake projects.  If they are not currently installed on the development machines we use the [AddExternalDependency.cmake](https://github.com/markjolah/UncommonCMakeModules/blob/master/AddExternalDependency.cmake) which will automatically download, configure, build and install to the `CMAKE_INSTALL_PREFIX`, enabling their use through the normal CMake `find_package()` system.\n\n* [BacktraceException](https://github.com/markjolah/BacktraceException) - For exception backtraces when debugging (especially in Matlab).\n\n## Motivation\n\nFor many likelihood-based methods, they can be extended to Bayesian methods like MAP Estimation and MCMC Posterior sampling,\nby incorporating a prior.  This prior must provide fast methods for computing log-likelihood and it's derivatives over the\nparameter space.  The prior log-likelihood, as well as it's gradient and hessian are then added to the equivalent quantities from the likelihood to create a Bayesian objective for MAP Estimation.\n\n## Static Polymorphism\n\nThe PriorHessian library is designed using static polymorphism (templates), and as such avoids virtual functions for small-grained  tasks, and instead uses templates, which allow many small functions to be inlined.  This aggressive inlining by the compiler produces log-likelihood, gradient, and hessian functions that are nearly as fast as hand-coded functions.  But our flexible [`CompositeDist`]() class is able to be easily created with any mix of [`UnivariateDist`]() and [`MultivariateDist`]() elements.\n\nIn [Mappel](https://github.com/markjolah/Mappel) we use this ability to create heterogeneous priors for each Model's parameters, (e.g., [x,y,I,bg,sigma]).\n\nFunctionally, the PriorHessian library stores sequences of distributions as `std::tuples`.  Using this approach as opposed to\nthe runtime polymorphism of using `std::vector\u003cstd::unique_ptr\u003cBase\u003e\u003e` gains several advantages.\nMost importantly, without the need for virtual functions, the tuple-based approach has the ability to inline the many\nsmall computational functions that must be combined for every call to compute the log-likelihood or other computationally important quantities.\n\n\u003c!--## Computations available\n\n * `cdf` - cumulative distribution function\n * `pdf` - probability density function\n * `llh` - log-likelihood (log of pdf)\n * `rllh` - relative log-likelihood (log of pdf without constant terms)\n * `grad` - derivative of log-likelihood (or equivalently of relative-llh)\n * `grad2` - 2nd-derivative of log-likelihood\n\n## Including PriorHessian as an ExternalProject\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkjolah%2Fpriorhessian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkjolah%2Fpriorhessian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkjolah%2Fpriorhessian/lists"}