{"id":16499392,"url":"https://github.com/expander/fast_clog","last_synced_at":"2025-11-25T15:02:55.486Z","repository":{"id":137153709,"uuid":"269061866","full_name":"Expander/fast_clog","owner":"Expander","description":"Fast implementation of complex logarithm","archived":false,"fork":false,"pushed_at":"2020-06-06T21:50:22.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T09:22:31.975Z","etag":null,"topics":[],"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/Expander.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":"2020-06-03T10:46:49.000Z","updated_at":"2020-09-24T19:11:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd32017d-fbe8-4e2f-a06c-ee2379db5a4e","html_url":"https://github.com/Expander/fast_clog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expander%2Ffast_clog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expander%2Ffast_clog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expander%2Ffast_clog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expander%2Ffast_clog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Expander","download_url":"https://codeload.github.com/Expander/fast_clog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241405050,"owners_count":19957754,"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":[],"created_at":"2024-10-11T14:52:25.101Z","updated_at":"2025-11-25T15:02:55.426Z","avatar_url":"https://github.com/Expander.png","language":"C++","readme":"# Fast implementation of complex logarithms\n\nReal and complex logarithms frequently appear in high-energy physics\ncalculations. In numerical applications, these logarithms have to be\ncalculated hundreds to millions of times, depending on the considered\nexample. For this reason, a fast numerical evaluation is of high\nimportance, in particular in studies of models with a parameter space\nwith a large dimensionality.\n\nThe usual implementation of the complex logarithm in mathematical\nlibraries is of the form\n\n    log(z) = log(|z|) + i*arg(z)\n\nwhere `|z|` is the magnitude and `arg(z)` is the polar angle of the\ncomplex number `z`. The evaluation of this expression requires the\ncalculation of a square root (sometimes implemented by calling the\n`hypot()` function) and sometimes a small extra overhead when\ncalculating the polar angle with `arg(z)`.\n\nThe complex logarithm can be calculated in a more performant way by\nwriting it as\n\n    log(z) = 0.5*log(re*re + im*im) + i*atan2(im, re)\n\nwhere `re = Re(z)` and `im = Im(z)`. This expression avoids the\ncalculation of the square root and a potential overhead from the\n`arg(z)` function. Note, however, that the more performant form is\nrestricted to complex numbers with `|z|^2 \u003c inf`, while the slower\nform is in principle valid for `|z| \u003c inf`.\n\nThe following table compares the average run-time of the `std::log()`\nfunction from the C++ STL with more performant implementations\ncontained in this package (compiler: clang++ 11, compiler flags:\n`-Ofast -ffast-math`, CPU: i7-5600U):\n\n| Function                                      | run-time in ms |\n|-----------------------------------------------|----------------|\n| `std::log(const std::complex\u003cdouble\u003e\u0026)` (C++) | 5.6e-05        |\n| `fast_clog` (C++)                             | 3.7e-05        |\n| `fast_clog` (C)                               | 3.9e-05        |\n|                                               |                |\n| `log(double complex)` (FORTRAN)               | 6.0e-05        |\n| `fast_clog` (FORTRAN)                         | 4.2e-05        |\n\n\nLicense: CC0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpander%2Ffast_clog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpander%2Ffast_clog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpander%2Ffast_clog/lists"}