Commit graph

314 commits

Author SHA1 Message Date
Roy Ivy III
2a50dc42c1 tests ~ (sub-crate/factor) fix divisor(0,0) test of factor::numeric::gcd() with early value check and return (fixes #1587) 2020-08-19 09:13:09 -05:00
Roy Ivy III
5478ca9108 tests ~ (sub-crate/od) fix expected f16 formatted test value 2020-08-10 10:19:42 -05:00
Roy Ivy III
b2483cb3c3 tests ~ (sub-crate/od) fix/remove inadvertent doc test (by using ignore) 2020-08-10 10:19:42 -05:00
Roy Ivy III
49d17f9587 tests ~ (sub-crate/od) fix compiler error (mismatched types) 2020-08-10 10:19:42 -05:00
Roy Ivy III
4fa27345be tests ~ (sub-crate/od) fix cargo clippy complaints (from deprecated half::consts to f16::...) 2020-08-10 10:19:42 -05:00
Roy Ivy III
c7cb5cbc37 tests ~ (sub-crate/cat) fix incorrect test attribute usage 2020-08-10 10:19:42 -05:00
Roy Ivy III
c3893edf94 tests ~ (sub-crates) fix 'edition=2018' module import errors
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388> @@ <https://archive.is/iCaXp>
2020-08-10 10:19:42 -05:00
Roy Ivy III
925137afce tests ~ (sub-crate/od) fix cargo clippy complaints (unused imports) 2020-08-10 10:19:41 -05:00
Roy Ivy III
dd72893771 tests ~ (sub-crate/od) fix cargo clippy complaints (deprecated std::error::Error::description) 2020-08-10 10:19:41 -05:00
nicoo
dc6b9a8d62
CI: Improve annotations (#1584)
* CI: Only run rustfmt in one environment

- This displays clippy warnings even when rustfmt fails.
- This avoids displaying 3 copies of the same rustfmt warning as Github
  annotations.
- Avoids duplicated work.

* CI: Suppress warnings when building for the oldest toolchain version

We had cases of warnings emitted due to `rustc` bugs that were fixed
in non-obsolete versions.

* factor: Remove a workaround for warnings on obsolete rustc
2020-08-10 16:53:32 +02:00
Felipe Lema
ba6b55f117 feature[env]: Add support for --chdir=DIR in env (fixes #1568) (#1569) 2020-08-08 22:26:49 -05:00
nicoo
d9be24e354 factor: Make the implementation of GCD more readable (#1576)
* factor::numeric::gcd: Switch variable names to be more consistent

* factor::numeric::gcd: Improve comments

* factor::numeric::gcd: Extend loop invariant to v
2020-08-08 22:26:49 -05:00
nicoo
37f717f5e3 factor: Add tests against (random) numbers with known factorisations (#1573) (#1578)
* factor::Factors: Derive implementations of Eq and PartialEq

* factors::Factors: Implement quickcheck::Arbitrary

This generates uniformly-distributed integers with known factorisations,
and will enable further testing.

* factor: Test against random numbers with known factorisations

* factor::Factors::arbitrary: Simplify method signature
2020-08-08 22:26:25 -05:00
nicoo
34a5941ee9
factor::numeric: Add more property-based tests (#1577)
* factor::numeric::gcd: Rename test against the Euclidean algorithm

* factor::numeric::gcd: Add various property-based tests

* factor::numeric::modular_inverse: Rename test

* factor::numeric::modular_inverse: Add test on random values
2020-08-03 14:00:34 +02:00
nicoo
70828329ba
factor::miller_rabin: Deduplicate parametrized_check macro (#1575)
* factor::miller_rabin::tests::first_composite: Drop useless generic

* factor::miller_rabin::tests: Reuse parametrized_check macro
2020-08-03 13:58:09 +02:00
nicoo
1eabda91cf
factor: Split numeric.rs into multiple modules (#1567)
* factor::numeric: Start refactoring into multiple submodules

No change to the module's interface, but it should make it much easier to
keep the tests right next to the code they are related to.

Moreover, build.rs' dependency is now limited to numeric::{modular_inverse,
traits}, meaning that the rest of it can use build-time generated tables etc.

* factor::numeric: Move gcd (and its test) to a submodule

* factor::numeric: Move Montgomery arithmetic to its own module

Finally hollowed-out numeric.rs

* factor: Move numeric.rs to numeric/mod.rs

* factor::numeric: Fix an erroneous lint on obsolete Rust versions
2020-08-02 20:28:00 +02:00
Sylvestre Ledru
85e2e1d0ee
Merge pull request #1566 from nbraud/factor/miller-rabin/copyright
factor::miller_rabin: Add missing copyright header in source file
2020-08-02 14:09:44 +02:00
nicoo
645e9a24bd factor::miller_rabin: Add missing copyright header in source file 2020-07-26 14:59:30 +02:00
Roy Ivy III
c36d71ba43 refactor/polish ~ fix cargo clippy complaint (needless_lifetimes) 2020-07-25 11:09:10 -05:00
Roy Ivy III
305c3cbcdb refactor/polish ~ fix cargo clippy complaint (bind_instead_of_map) 2020-07-25 11:09:10 -05:00
Roy Ivy III
326ff36793 refactor/polosh ~ fix cargo clippy complaint (reversed_empty_ranges) 2020-07-25 11:09:10 -05:00
Roy Ivy III
a6d7379b97
Merge pull request #1563 from nbraud/factor/faster/gcd
factor/perf ~ speed up factor::numeric::gcd
2020-07-25 11:07:57 -05:00
nicoo
6bef6306c0 factor::numeric::gcd: Avoid redundant u64::trailing_zeros and shifts
7 to 10% faster, according to criterion.
2020-07-25 15:04:57 +02:00
nicoo
3e55139c13 factor::miller_rabbin::Result: Mark as #[must_use]
Ignoring a value of that type is a bug: they are only produced by
`miller_rabbin::test`, which is a pure, but expensive, function.

As such, an ignored value is always either a mistake, or an easy
optimisation opportunity (just remove the useless call to `test`).
2020-07-24 23:06:08 +02:00
nicoo
ecc3e2db24 factor::miller_rabin::test: Minor readability improvement 2020-07-24 23:06:08 +02:00
nicoo
e415b17c01 factor::miller_rabin: Remove duplicated work
The duplicate work was introduced in 2015.
2020-07-24 23:06:06 +02:00
nicoo
29d45e472d factor::numeric::gcd: Implement Stein's binary GCD algorithm
Also add a property-based test against the Euclidean implementation.

numeric::gcd got ~50-65% faster, according to criterion. The effect on the
overall system is small, but later PRs will use a lot more GCD computations.
2020-07-24 23:00:32 +02:00
nicoo
4f23767b85 factor::numeric::gcd: Add criterion-powered benchmark
The function had to be made `pub`, this is a [known limitation] of Criterion.

[known limitation]: https://bheisler.github.io/criterion.rs/book/user_guide/known_limitations.html
2020-07-24 22:58:26 +02:00
nicoo
1b593d94c9 factor: Update rand dependency to v0.7 2020-07-24 22:57:08 +02:00
nicoo
9a80ab7741 factor::numeric::DoubleInt: Document the DoubleWidth associated type 2020-07-24 11:28:26 -05:00
nicoo
17c69674eb factor::numeric::Int: Remove from_u128 method
It was unused, the debug assertions only need `to_u128`.
2020-07-24 11:28:26 -05:00
nicoo
1172af09c0 factor::numeric::DoubleInt: Clarify methods and associated types
- `DoubleInt::Double` renamed to `DoubleWidth`
- `{as,from}_double()` renamed to `{as,from}_double_width()`.

This should hopefully clarify that this is not a “double precision”
floating-point type, but an integer type with a larger range (used
for storing intermediate results, typ. from a multiplication)
2020-07-24 11:28:26 -05:00
nicoo
86a4749e3a factor::numeric: fix original "Generalise modular inverse computation" 2020-07-24 11:28:12 -05:00
nicoo
6e228d3184 Merge branches 'factor/faster/{centralise_logic, montgomery32}' 2020-07-05 00:20:16 +02:00
nicoo
4cfe754551 factor::miller_rabin::is_prime: Fix bug
Montgomery only works for odd n, so attempting to construct an instance
for an even number results in a panic!

The most obvious solution is to special-case even numbers.
2020-07-05 00:08:49 +02:00
nicoo
9b0f131135 Fix bug in factor::factor::factor (>_>")
Non-prime numbers, such as 0 or 1, shouldn't be inserted in the factorisation.
2020-07-05 00:07:38 +02:00
nicoo
e9e263ac66 factor::Factors: Derive Clone and Debug
Useful for printing out in-progress factorisations when debugging.
2020-07-05 00:07:33 +02:00
nicoo
7bdc81b882 factor: Add a first property-based test 2020-07-05 00:07:16 +02:00
nicoo
dcc22188ba factor: Fix clippy warnings 2020-07-05 00:05:45 +02:00
nicoo
f1d1cb80e4 factor::Factors: Generalise invariant check (from prime() to add()) 2020-07-05 00:05:45 +02:00
nicoo
2d2b6faab4 factor: Avoid moving data around in main factoring loop
Instead, the same `Factors` object is passed around through the execution.
~10% faster.
2020-07-05 00:05:45 +02:00
nicoo
6713d2ad62 factor: Move recursive factoring logic from rho to factor
No functional change, but prepares a coming optimisation.
2020-07-05 00:05:45 +02:00
nicoo
bd4d6fcac5 factor: Split the CLI and I/O code off the factoring logic 2020-07-05 00:05:45 +02:00
nicoo
6256750376 factor::miller_rabin: Use a macro to instantiate every test 2020-07-05 00:04:56 +02:00
nicoo
7a1b86c9c2 factor::numeric::tests: Use a macro to instantiate every test 2020-07-05 00:04:53 +02:00
nicoo
cbcc760f83 factor::miller_rabin: Squash another bug! >:3
Detected by the testsuite improvement just prior.
2020-07-05 00:04:49 +02:00
nicoo
3d6fdffe14 factor::miller_rabin: Generalise tests to 32 and 64b Montgomery 2020-07-05 00:04:29 +02:00
nicoo
9b149a759b factor::miller_rabin: Hoist edge-cases (even, <2) out of test()
test() takes a modulus that is known to not be even or <2 (otherwise the
Montgomery value could not be constructed), so those checks can be hoisted
into is_prime() and out of the critical path.
2020-07-05 00:04:26 +02:00
nicoo
4f08e28167 factor::miller_rabin: Add property-based test 2020-07-05 00:04:08 +02:00
nicoo
d2fa0fe63c factor::miller_rabin::tests: small_composites → small_semiprimes
This is more descriptive, as semiprime are the products of 2 primes;
all semiprimes are composite, but not all composite numbers are semiprime.
2020-07-05 00:01:48 +02:00
nicoo
1e4d824829 factor::miller_rabin: Add negative test over all small composites 2020-07-05 00:01:44 +02:00
nicoo
600268c6e4 factor::miller_rabin::tests: Refactor 2020-07-05 00:01:40 +02:00
nicoo
0a1200bdb8 factor::miller_rabin: Add test for the largest 64b composite numbers 2020-07-05 00:01:37 +02:00
nicoo
308290325a factor::miller_rabin::is_prime: Fix bug
Montgomery<_> only works for odd n, so attempting to construct an instance
for an even number results in a panic!

The most obvious solution is to special-case even numbers.
2020-07-05 00:01:33 +02:00
nicoo
d2b43f49f9 factor::numeric::OverflowingAdd: Generate impls with a macro 2020-07-05 00:01:21 +02:00
nicoo
b25c77c5f9 factor::numeric: Generate implementations of DoubleInt with a macro 2020-07-05 00:01:21 +02:00
nicoo
f95f977f98 factor::numeric: Generate implementations of Int with a macro 2020-07-05 00:01:21 +02:00
nicoo
53954badd7 factor::numeric: Refactor away the use of {To,From}Primitives 2020-07-05 00:01:21 +02:00
nicoo
19a8231fb2 factor::numeric::Arithmetic: Rename associated type I to ModInt 2020-07-05 00:01:21 +02:00
nicoo
caa79a1261 factor::numeric: Split Int and DoubleInt traits 2020-07-05 00:01:21 +02:00
nicoo
28244413d1 factor::numeric: Document when to remove OverflowingAdd trait 2020-07-05 00:01:21 +02:00
nicoo
3f79be0219 factor::numeric: Use debug_assert! for runtime assertions. 2020-07-05 00:01:21 +02:00
nicoo
774feb0a40 factor::numeric: Generalise tests for Arithmetic trait 2020-07-05 00:01:21 +02:00
Alex Lyon
4d28f48ad9 factor: combine Montgomery and Montgomery32 2020-07-05 00:01:21 +02:00
nicoo
a440807e6c factor::miller_rabin: Use a specialized basis for 32b integers
~3% faster
2020-07-05 00:01:21 +02:00
nicoo
e68bb192f2 factor::numeric: Add a 32b Montgomery variant [WiP]
~32% faster
2020-07-05 00:01:21 +02:00
nicoo
43ee92c40f factor::numeric: Generalise modular inverse computation 2020-07-05 00:01:21 +02:00
Alex Lyon
9de82d92b0
Merge pull request #1557 from nbraud/factor/issue_1556
factor::miller_rabin: Fix bug #1556
2020-06-24 04:53:32 -07:00
Alex Lyon
700d51a92b
Merge pull request #1528 from sylvestre/cp-no-deref
feature(cp) implement -P/--no-deference
2020-06-23 23:05:26 -07:00
nicoo
abf579975c factor::miller_rabin: Fix bug in primality test
Introduced in 6b9585b1 (#1525: Performance improvements for `factor`).
Closes #1556
2020-06-23 16:19:16 +02:00
nicoo
c5c86b00e9 factor::miller_rabin: Add tests reproducing #1556 2020-06-23 16:14:52 +02:00
nicoo
8e040bbf1a factor::table: Optimise the size of the precomputed table
A too-large precomputed table actually slows down the program: we spend
time fetching it from disk and from memory (into the CPU's cache), and
larger prime factors are more unlikely to occur in random integers (prime p
occurs with probability ~1/p when sampling 64b numbers uniformly-at-random)

The new value was chosen after measuring the execution time (for all
integers between 2 and 10⁷) for a broad set of values:

| n    | time (s) |
|------|----------|
| 16   | 40.84    |
| 32   | 34.491   |
| 64   | 29.044   |
| 128  | 25.121   |
| 192  | 23.98    |
| 256  | 23.102   |
| 256  | 24.93    |
| 272  | 23.57    |
| 288  | 23.85    |
| 304  | 23.91    |
| 320  | 23.24    |
| 329  | 23.45    |
| 336  | 23.55    |
| 352  | 23.09    |
| 368  | 23.65    |
| 384  | 23.32    |
| 384  | 23.36    |
| 400  | 23.30    |
| 416  | 23.38    |
| 432  | 23.42    |
| 448  | 23.95    |
| 448  | 24.00    |
| 464  | 23.81    |
| 480  | 23.55    |
| 496  | 24.10    |
| 512  | 24.101   |
| 512  | 24.23    |
| 1027 | 29.864   |
2020-06-20 22:22:55 +02:00
nicoo
9d992b77b2 factor: Keep the primes table size in a single place 2020-06-20 22:22:55 +02:00
nicoo
b956e632e1 factor::table: Coalesce accesses to the factors table
~5.6% faster
2020-06-20 22:22:55 +02:00
Sylvestre Ledru
2d62097843 feature(cp): Manage -P & -R 2020-06-20 10:49:15 +02:00
nicoo
0518e06053 factor::rho: Minor refactor for readability 2020-06-20 10:39:56 +02:00
nicoo
dacee413db factor::rho: Refactor to avoid unnecessary allocations 2020-06-20 10:39:56 +02:00
nicoo
71e1c52920 factor::Factors: Rename new() to one() 2020-06-20 10:39:56 +02:00
Sylvestre Ledru
280fafed8a feature(cp) implement -P/--no-deference 2020-06-20 09:38:39 +02:00
nicoo
45a1408fb0 fixup! factor: Add test exhibiting a bug in ρ 2020-06-19 15:28:01 +02:00
nicoo
9fe3de72f2 factor::rho: Fix very-unlikely bug (resulting in assertion failure)
This bug can only be triggered when:
- the Miller-Rabin test produces a divisor `d` (rare) ;
- n / d is prime.
2020-06-19 13:51:29 +02:00
nicoo
9eb944b6b9 factor: Add test exhibiting a bug in ρ
The test is repeated 20 times to make it overwhelmingly-likely to fail
(the bug itself is only triggered rarely)
2020-06-19 13:48:00 +02:00
nicoo
3a90e31307 factor::numeric::inv_mod_u64: Provide a more-helpful error message 2020-06-19 13:39:42 +02:00
nicoo
ef12991ee7 factors: Avoid repeatedly locking and flushing stdout
By default, stdout's LineWriter results one syscall per line, i.e. a billion
syscalls when factoring a billion numbers...

Buffering the output yields a ~28% speedup.
2020-06-18 16:45:40 -07:00
nicoo
2869248318 factor::Factors: Use a tree-based map internally
This eliminate the need for sorting the prime factors for display.
25% performance improvement after the changes from factor/montgomery.
2020-06-18 16:44:08 -07:00
nicoo
4b4d11b61a
factor: Add/update copyright notices as necessary (#1546) 2020-06-18 21:38:28 +02:00
Alex Lyon
6105cce69a
Merge pull request #1529 from nbraud/factor/montgomery
factor: Faster modular arithmetic with the Montgomery transform
2020-06-18 09:19:12 -07:00
nicoo
fb08d9ff9e factor::numeric::Montgomery::add: Deal with rare overflow case 2020-06-18 14:32:58 +02:00
Alex Lyon
e02b8a60f7
hashsum: switch from getopts to clap (#1542)
* hashsum: switch from getopts to clap

Additionally, slightly refactor.  This commit will be the first of
a series of commits refactoring (at the very least) `hashsum`.
2020-06-18 11:46:00 +02:00
Sylvestre Ledru
f17a112781
feature(ln): implement -r (#1540)
* bump the minimal version of rustc to 1.32

* feature(ln): implement -r

* fix two issues

* Use cow

* rustfmt the change

* with cargo.lock 1.31

* try to unbreak windows
2020-06-18 00:54:18 -07:00
nicoo
d1470dadf8 factor::numeric::gcd: Silence the (erroneous) dead code lint 2020-06-16 15:45:10 +02:00
nicoo
334e02786d factor: Run cargo fmt 2020-06-16 15:43:25 +02:00
Alex Lyon
8377abadb6
Fix to build on Rust 1.32.0 and formatting 2020-06-16 04:08:17 -05:00
Alex Lyon
110d6844ad
Use an iterator over OsString for uumain()
Additionally, restructure `uname` so that we don't need to find the
iterator's length.
2020-06-16 03:28:02 -05:00
nicoo
f1788d9e70 fixup! factor::numeric::Montgomery: Fix overflow bug 2020-06-16 01:17:16 +02:00
nicoo
4851619d62 factor::miller_rabin: Avoid repeatedly transforming 1 and -1
Approx. 25% speedup
2020-06-15 23:05:31 +02:00
nicoo
cb6051c580 factor::numeric::Montgomery: Fix overflow bug 2020-06-15 22:40:57 +02:00
nicoo
2238065c9d factor::numeric: Simplify Montgomery (remove superfluous Wrapping) 2020-06-15 19:18:34 +02:00
nicoo
19a0645a0a factor::numeric: Simplify inv_mod_u64
Just call `u64::wrapping_{mul,sub}` instead of (de)constructing Wrapping<u64>
values.
2020-06-15 19:18:34 +02:00
nicoo
918035e01e factor: Fix for old Rust 2020-06-15 19:18:34 +02:00
nicoo
f84d0f9398 factor::Factors::add: Make the precondition check a debug_assert 2020-06-15 19:18:34 +02:00
nicoo
33e18b4cd3 factor::numeric::Montgomery: Add debug assertions
In debug mode, checks that all arithmetic operations coincide with the
plain-u64 versions, as long as the latter does not overflow.
2020-06-15 19:18:34 +02:00
nicoo
8a4d0d30ad factor::numeric: Implement Montgomery's transform
This is a facter way to perform arithmetic mod n, when n is odd and a 64b
number.
2020-06-15 19:18:29 +02:00
nicoo
e91155519a factor::factor: Add integration tests 2020-06-15 19:10:16 +02:00
nicoo
bada7530fb factor::miller_rabin: Add tests 2020-06-15 19:10:16 +02:00
Roy Ivy III
813e57d225 fix cargo clippy complaint (redundant_clone) 2020-06-14 23:38:30 -05:00
Roy Ivy III
39e3c57198 fix cargo clippy complaint (clone_on_copy) 2020-06-14 23:38:30 -05:00
Sylvestre Ledru
7b452f3bfe style(nproc): reformat with rustfmt 2020-06-09 13:38:29 +02:00
Sylvestre Ledru
ac34d136f2 refactor(global): Move from tempdir to tempfile:
* the crate has been deprecated
2020-06-09 11:30:19 +02:00
Alex Lyon
80987250d2
Merge pull request #1521 from sylvestre/nproc
Add tests for nproc + clap migration
2020-06-08 19:18:00 -07:00
Alex Lyon
49771d4fda
Merge pull request #1535 from sylvestre/1.32
Move to 1.32 as minimal supported version
2020-06-08 14:31:02 -07:00
Sylvestre Ledru
5926315507 bump the minimal version of rustc to 1.32 2020-06-08 22:54:28 +02:00
Sylvestre Ledru
d0890b72cd
Merge pull request #1522 from sylvestre/groups
groups: clap migration
2020-06-08 22:19:08 +02:00
Sylvestre Ledru
851e25d134 refactor(logname): simplify the code 2020-06-07 17:54:30 +02:00
Sylvestre Ledru
5963b15746 refactor(nproc): fix some bugs and use clap 2020-06-02 23:29:21 +02:00
Sylvestre Ledru
ed1ebe09ff refactor(groups): move to clap 2020-06-02 23:16:18 +02:00
Sylvestre Ledru
78c04a254e refactor ~ rename MinSRV => MinRustV 2020-06-02 12:23:48 -05:00
Roy Ivy III
fbbd881ca9 docs ~ reduce sub-crate meta-information keywords to the maximum of five 2020-05-31 15:48:54 -05:00
Roy Ivy III
b2a566d50d fix/mknod ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
2fd7e15d63 fix/install ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
4b0dd73adb fix/chmod ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
923c47a408 refactor ~ remove outdated clippy attributes 2020-05-30 01:36:02 -05:00
Roy Ivy III
fb5ab86aee refactor help text and variable names 2020-05-30 01:36:02 -05:00
Roy Ivy III
8cf58de0a7 docs ~ polish/update comments 2020-05-30 01:36:02 -05:00
Roy Ivy III
619d0ab72b docs ~ add markdown-lint directives 2020-05-30 01:36:02 -05:00
Roy Ivy III
f82de13847 docs ~ spell-check repairs and addition of exceptions 2020-05-30 01:36:02 -05:00
Roy Ivy III
38ebc14b29 maint/build ~ remove .gitignore from sub-crate 'cut' 2020-05-29 22:59:48 -05:00
Roy Ivy III
21a4da905f fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
ea3235c7e2 change ~ new_coreopts!() => app!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
4b8fc7445b change ~ disp_err!() => show_usage_error!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
6f465eeb9f deps ~ update utils to uucore/uucore_procs v0.0.4 2020-05-29 22:59:48 -05:00
Roy Ivy III
e3fd15e73c fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
156031b929 fix/sync ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
fc9abdc179 fix/tail ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
64f888d364 fix/cp ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
251905da3d fix/du ~ update to correct WinAPI usage (fixes #1496) 2020-05-29 22:59:47 -05:00
Roy Ivy III
131bca3d53 fix/split ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
3129c8fbe5 fix/od ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
d4aa3a2231 fix 'edition="2018"' module import errors
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388> @@ <https://archive.is/iCaXp>
2020-05-29 22:59:47 -05:00
Roy Ivy III
d70db1f7d2 docs ~ improve/update sub-crate meta information 2020-05-29 22:59:47 -05:00
Roy Ivy III
45a1609a38 update held/pinned dependencies (to maintain MinSRV v1.31.0) 2020-05-29 22:59:47 -05:00
Roy Ivy III
7cfa8be5f2 docs ~ add meta information to sub-crates 2020-05-29 22:59:47 -05:00
Roy Ivy III
6cb609aeee docs/codespell ~ fix spelling errors 2020-05-29 22:59:47 -05:00
Roy Ivy III
db2e950918 change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00
Roy Ivy III
6606408ce9 refactor/polish ~ whitespace normalization (consistent indentation [either tabs *or* spaces], EOF EOLNs, no trailing whitespace) 2020-05-24 17:29:07 -05:00
Roy Ivy III
09abcf8cbe
Merge pull request #1525 from nbraud/factor/faster
Performance improvements for `factor`
2020-05-24 16:54:04 -05:00
Nicolas Braud-Santoni
4c3682aec7
factor::Factors::add: Split up to work without NLL
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-24 19:14:37 +02:00
nicoo
36a2948959 factor::miller_rabin: Avoid unecessary exponentiation
Instead of computing a^r and a^(n-1) = a^(r 2ⁱ) separately,
compute the latter by repeatedly squaring the former.

33.6% performance improvement
2020-05-24 19:10:34 +02:00
nicoo
543c7b941a factor::rho: Small refactor 2020-05-24 19:10:29 +02:00
nicoo
30fd6a0309 factor::numeric: Replace lose functions with an Arithmetic trait 2020-05-24 18:16:21 +02:00