{"id":20729031,"url":"https://github.com/andreadelprete/expokit-cpp","last_synced_at":"2026-02-08T08:32:57.438Z","repository":{"id":72732228,"uuid":"228250103","full_name":"andreadelprete/expokit-cpp","owner":"andreadelprete","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-20T12:32:21.000Z","size":16469,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-18T08:41:56.628Z","etag":null,"topics":["matrix-exponential"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreadelprete.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2019-12-15T20:48:10.000Z","updated_at":"2022-05-24T10:25:26.000Z","dependencies_parsed_at":"2023-02-25T00:46:22.190Z","dependency_job_id":null,"html_url":"https://github.com/andreadelprete/expokit-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreadelprete/expokit-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreadelprete%2Fexpokit-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreadelprete%2Fexpokit-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreadelprete%2Fexpokit-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreadelprete%2Fexpokit-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreadelprete","download_url":"https://codeload.github.com/andreadelprete/expokit-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreadelprete%2Fexpokit-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29225477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T06:05:31.539Z","status":"ssl_error","status_checked_at":"2026-02-08T05:58:33.853Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["matrix-exponential"],"created_at":"2024-11-17T04:40:58.144Z","updated_at":"2026-02-08T08:32:57.423Z","avatar_url":"https://github.com/andreadelprete.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# expokit-cpp\n\nThis library provides fast algorithms for computing the exponential of dense matrices in C++.\n\nClass [MatrixExponential](https://github.com/andreadelprete/expokit-cpp/blob/master/include/MatrixExponential.hpp):\n* an optimized version of the scaling-and-squaring algorithm (Higham 2005 \"The scaling and squaring method for the matrix exponential revisited\") for computing the matrix exponential based on the code found in [Eigen3-unsupported](https://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html#matrixbase_exp);\n* options for the user to customize the amount of computation performed by the algorithm to achieve the desired performance-accuracy trade-off (e.g. specifying the maximum number of matrix-matrix multiplications);\n* an algorithm for computing the product between the matrix exponential and a given vector/matrix, which is more efficient than computing the matrix exponential and multiplying it times the vector/matrix (assuming the matrix is skinny);\n* a balancing algorithm to speed-up the matrix exponential computation;\n\nClass [LDSUtility](https://github.com/andreadelprete/expokit-cpp/blob/master/include/LDSUtility.hpp):\n* a utility class for computing the evolution of the state of a linear dynamical system, and its first two integrals, all of which are based on the computation of matrix exponentials.\n\nAll the C files:\n* a C version of the library [expokit](http://fortranwiki.org/fortran/show/Expokit) (Sidje, 1998 \"Expokit: A Software Package for Computing Matrix Exponentials\", ACM Transactions on Mathematical Software), which is a Fortran library that we translated to C using `f2c`.\n\nIn [this file](https://github.com/andreadelprete/expokit-cpp/blob/master/tests/test_small.cpp) you can find a test comparing all the implemented methods for computing the matrix exponential. We have found that for the matrix sizes we were interested in, our optimized version of the scaling-and-squaring algorithm based on [Eigen3-unsupported](https://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html#matrixbase_exp) was the fastest. For example, using a matrix size of 24, these were the computation times we obtained:\n```\nOur MatrixExponential class: 0.068 ms\nEigen (from eigen3-unsupported): 0.079 ms\nDGPADM (from expokit): 0.160 ms\nDGCHBV (from expokit): 0.094 ms\n\nOur MatrixExponential class - computeExpTimesVector: 0.044 ms\n```\n\n## Dependencies\n1. `f2c` - used in porting routines from Fortran\n2. `eigen3` - Linear Algebra library\n3. `lapack` - Linear Algebra library\n\n## Build\n\nFirst of all install `f2c` :\n\n`sudo apt install f2c`\n\nThen install `eigen3`, which can be installed from different sources. We propose here to install it from [robotpkg](http://robotpkg.openrobots.org/debian.html) using:\n\n`sudo apt install robotpkg-eigen3`\n\nTo compile expokit you need to provide to `pkg-conifg` the path both to `eigen3.pc` and `f2c.pc`. The location of the former depends on how `eigen3` was installed. We are assuming here it was installed from `robotpkg`. \n\nRegarding `f2c`, the current package provided by `apt` does not include the `f2c.pc` file, but we provide our own that can be found in this repo at `pkg-config/f2c.pc`. \n\nThe `lapack` dependency should be resolved by the build system. Summing up your `PKG_CONFIG_PATH` should look like this:\n```\nexport PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH\nexport PKG_CONFIG_PATH=/opt/openrobots/share/pkgconfig:$PKG_CONFIG_PATH\nexport PKG_CONFIG_PATH=\u003cpath to f2c.pc\u003e:$PKG_CONFIG_PATH\n```\nSubstitute `\u003cpath to f2c.pc\u003e` with your path, it can be located anywhere.\n\n## Citing Expokit-cpp\n\nTo cite Expokit-cpp in your academic research, please use the following bibtex line:\n\n```\n@article{Hammoud2022,\nauthor = {Hammoud, Bilal and Olivieri, Luca and Righetti, Ludovic and Carpentier, Justin and {Del Prete}, Andrea},\ndoi = {10.1007/s11044-022-09818-z},\nissn = {1573-272X},\njournal = {Multibody System Dynamics},\nnumber = {4},\npages = {443--460},\ntitle = {{Exponential integration for efficient and accurate multibody simulation with stiff viscoelastic contacts}},\nurl = {https://doi.org/10.1007/s11044-022-09818-z},\nvolume = {54},\nyear = {2022}\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreadelprete%2Fexpokit-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreadelprete%2Fexpokit-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreadelprete%2Fexpokit-cpp/lists"}