{"id":17139895,"url":"https://github.com/dpiparo/vdt","last_synced_at":"2025-04-10T03:50:18.145Z","repository":{"id":6023642,"uuid":"49258493","full_name":"dpiparo/vdt","owner":"dpiparo","description":"A math library of fast, approximate and vectorisable trascendental functions","archived":false,"fork":false,"pushed_at":"2025-03-26T13:51:34.000Z","size":207,"stargazers_count":42,"open_issues_count":10,"forks_count":18,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-03T02:09:16.113Z","etag":null,"topics":["floating-point","math-functions","vectorization"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dpiparo.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":"2016-01-08T08:00:55.000Z","updated_at":"2025-03-27T05:02:18.000Z","dependencies_parsed_at":"2025-03-26T14:38:25.423Z","dependency_job_id":"86dcad92-6966-4ffe-ba5a-f98e9e6e2973","html_url":"https://github.com/dpiparo/vdt","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpiparo%2Fvdt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpiparo%2Fvdt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpiparo%2Fvdt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpiparo%2Fvdt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpiparo","download_url":"https://codeload.github.com/dpiparo/vdt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154999,"owners_count":21056542,"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":["floating-point","math-functions","vectorization"],"created_at":"2024-10-14T20:13:21.586Z","updated_at":"2025-04-10T03:50:18.103Z","avatar_url":"https://github.com/dpiparo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The **vdt** mathematical library\n**v**ectorise**d** ma**t**h\n* A collection of **fast** and **inline** implementations of mathematical functions.\n* The functions can be used in autovectorised loops.\n* **Double and single precision** implementations are available.\n* No overhead present, no intrinsics used.\n* A scalar (`T(T)`) and array signature (`void(const unsigned int,T*,T*)`) are provided.\n\nBorn and developed at [CERN](www.cern.ch), it is used, among the others, by LHC experiments and the [Geant4](http://geant4.cern.ch/) simulation toolkit.\n\n\nMuch of the VDT code is inspired by the well known [Cephes](http://www.netlib.org/cephes) mathematical library.\n\n## How to get, compile and install it\nThe **vdt** functions are **inline** and contained in header files: they are ready to be used without compilation of an external library. In any case, there is the possibility to compile a shared library containing the array signatures `void(const unsigned int,T*,T*)`.\nThe makesystem chosen for **vdt** is  [CMake](http://www.cmake.org).\n```bash\nexport INSTALLDIR=/path/to/mydir\ngit clone https://github.com/dpiparo/vdt.git\ncd vdt\ncmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR .\nmake\nmake install\n```\n\n## How to use it\nGood examples of vdt functions usage are located in the **progs** and **progs/units** directories.\n\n### The vdt functions\nAll **vdt** functions live in the `vdt` namespace. Their names are structured as follows:\n```cpp\nvdt::fast_\u003cfunction_name\u003e[f][v]\n```\nWhere:\n* The function name is one of the list in the table below.\n* The `f` letter stands for the single precision function (`float`).\n* The `v` letter identifies the array function.\nYou may wonder, why prepending `fast_`? This is done to allow the user to decide where a fast and approximate implementation of the function is to be used. It is not always obvious where the accuracy can be reduced: all the flexibility is needed.\n\nThese are the available functions:\n\n| Function | Scalar double precision | Scalar single precision | Array double precision | Array single precision |\n| -------- | ----------------------- | ----------------------- | ---------------------- | ---------------------- |\n| exponential | fast_exp | fast_expf | fast_expv | fast_expfv |\n| sine | fast_sin | fast_sinf | fast_sinv | fast_sinfv |\n| cosine | fast_cos | fast_cosf | fast_cosv | fast_cosfv |\n| tangent | fast_tan | fast_tanf | fast_tanv | fast_tanfv |\n| hyperbolic tangent | fast_tanh | fast_tanhf | fast_tanhv | fast_tanhfv |\n| logarithm | fast_log | fast_logf | fast_logv | fast_logfv |\n| arcsine | fast_asin | fast_asinf | fast_asinv | fast_asinfv |\n| arccosine | fast_acos | fast_acosf | fast_acosv | fast_acosfv |\n| arctangent | fast_atan | fast_atanf | fast_atanv | fast_atanfv |\n| inverse square root (1/sqrt) | fast_isqrt | fast_isqrtf | fast_isqrtv | fast_isqrtfv |\n\n\n## Other Cmake options\nOther options for Cmake are available to steer the creation of the makefile:\n* Enable AVX extensions `-D AVX=1` \n* Enable NEON extensions on ARM `-D NEON=1`\n* Benchmarking tools and unit tests (requires C++11 support by the compiler) `-D DIAG=1`\n* Build static library `-D BUILD_SHARED_LIBS=0`\n* Prepare the library to be pre-loaded in order to replace the calls to the default math lib at runtime `-D PRELOAD=1`\n\n## Supported Compilers\nThe **vdt** functions can be used with every compiler (icc and gcc were tested).\nTo compile the benchmarking tools **gcc4.7** (icc12) is at least needed because of the support of c++11.\nTo vectorise the functions **gcc4.7** (icc12) is at least needed.\n\n## Benchmarks\nThis section is for experts who want to study the details of the functions provided and/or to compare them to other implementations.\n**vdt** comes with a complete benchmark suite both for accuracy and speed measurements.\nTo measure the speed of the functions, you should use the ''vdtPerfBenchmark''. To dump on disk the ascii files summarising the accuracy of the functions, you should use ''vdtArithmBenchmark'', while the tool to compare them is ''vdtArithmComparison''.\nIn order to produce the plots of the different bits as a function of input, the script to be used is ''diffhisto.py'' (which depends on [ROOT](http://root.cern.ch) to produce plots).\n\n## Example of Performance\n\nDouble precision, Intel® Core™ i7-3930K CPU @ 3.20GHz running Scientific Linux 6. Operative interval of the input: [-5000,5000] ((0,5000] for isqrt and [-1,1] for Asin and Acos). Time in ns per call.\n\n|Function| libm | VDT | VDT SSE | VDT AVX |\n|--------| ---- | --- | ------- | ------- |\n|Exp|16.7|6.1|3.8|2.9|\n|Log|34.9|12.5|5.7|4.2|\n|Sin|33.7|16.2|6|5.7|\n|Cos|34.4|13.4|5.4|5.1|\n|Tan|46.6|12.5|6.3|5.6|\n|Asin|23|10.3|8.6|8.1|\n|Acos|23.7|11|8.2|8.1|\n|Atan|19.7|11|8.3|8.3|\n|Isqrt| 9.3|6.7|3|2.1|\n\n### Accuracy\nAccuracy measured in terms of least significant bit. Average difference with respect to libm.\n\n|Function|AVG vdt|\n|--------| ------|\n|Acos|0.39|\n|Asin|0.32|\n|Atan|0.33|\n|Cos|0.25|\n|Exp|0.14|\n|Isqrt|0.45|\n|Log|0.42|\n|Sin|0.25|\n|Tan|0.35|\n\n## Related Documents:\n   * A full characterisation of the accuracies please refer to this [presentation](http://indico.cern.ch/contributionDisplay.py?contribId=4\u0026sessionId=9\u0026confId=202688).\n\n## Reference\nIf you want to cite vdt, please use your reference:\n[D. Piparo, V.Innocente and T.Hauth 2014 J. Phys.: Conf. Ser. 513 052027 \"Speeding up HEP experiment software with a library of fast and auto-vectorisable mathematical functions\"](http://iopscience.iop.org/1742-6596/513/5/052027)\n\n## Mailing List\nThe VDT projects has a mailing list: VDTlibrary-talk at cern ch, linked to an e-group with the same name.\nThe Infrastructure used is the one provided by CERN IT. If you don't have a CERN account, you can obtain an external one [here](https://simba3.web.cern.ch/simba3/SelfSubscription.aspx?groupName=your-e-group-name).\nAlternatively, feel free to contact Danilo Piparo (danilo_dot_piparo_at_cern_dot_ch).\n\n## Licence\nThe VDT mathematical library is licenced under the LGPL3 licence\n\n![LGPL3](https://svnweb.cern.ch/trac/vdt/raw-attachment/ticket/2/LGPL-3-Logo-mini.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpiparo%2Fvdt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpiparo%2Fvdt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpiparo%2Fvdt/lists"}