2 Commits

Author SHA1 Message Date
Piotr Idzik
af72fab013 fix: make interface of NCRModuloP fail-safe (#2469)
* fix: set proper size of fac

* style: use std::size_t as a type of loop counter

* style: use uint64_t as a type of loop counter

* fix: remove p from the argument list of NCRModuloP::ncr

* refactor: add utils namespace

* refactor: use references in gcdExtended

* refactor: add NCRModuloP::computeFactorialsMod

* style: make NCRModuloP::ncr const

* test: reorganize tests

* test: add missing test cases

* refactor: simplify logic

* style: make example object const

* style: use auto

* style: use int64_t to avoid narrowing conversions

* docs: update explanation why to import iostream

* docs: remove `p` from docstr of `NCRModuloP::ncr`

* docs: udpate doc-strs and add example()

* Apply suggestions from code review

Co-authored-by: David Leal <halfpacho@gmail.com>

* dosc: add missing docs

* feat: display message when all tests pass

Co-authored-by: David Leal <halfpacho@gmail.com>

* style: initialize `NCRModuloP::p` with `0`

Co-authored-by: David Leal <halfpacho@gmail.com>

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
2024-08-31 06:12:39 +05:30
Kaustubh Damania
67e26cfbae feat: Add ncr mod p code (#1325)
* feat: Add ncr mod p code (#1323)

* Update math/ncr_modulo_p.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* Added all functions inside a class + added more asserts

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for f6df24a5

* Replace int64_t to uint64_t + add namespace + detailed documentation

* clang-format and clang-tidy fixes for e09a0579

* Add extra namespace + add const& in function arguments

* clang-format and clang-tidy fixes for 8111f881

* Update ncr_modulo_p.cpp

* clang-format and clang-tidy fixes for 2ad2f721

* Update math/ncr_modulo_p.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update math/ncr_modulo_p.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update math/ncr_modulo_p.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* clang-format and clang-tidy fixes for 5b69ba5c

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for a8401d4b

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-22 23:05:01 +05:30