factory 0.3.1.4 → 0.3.2.0
raw patch · 27 files changed
+114/−89 lines, 27 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.markdown +5/−2
- changelog.markdown +6/−2
- copyright +1/−1
- factory.cabal +4/−3
- src-lib/Factory/Data/Polynomial.hs +5/−5
- src-lib/Factory/Data/Ring.hs +20/−3
- src-lib/Factory/Math/Factorial.hs +2/−2
- src-lib/Factory/Math/Fibonacci.hs +2/−2
- src-lib/Factory/Math/Hyperoperation.hs +3/−3
- src-lib/Factory/Math/Implementations/Factorial.hs +6/−6
- src-lib/Factory/Math/Implementations/Pi/AGM/BrentSalamin.hs +3/−3
- src-lib/Factory/Math/Implementations/Pi/BBP/Base65536.hs +2/−2
- src-lib/Factory/Math/Implementations/Pi/BBP/Implementation.hs +2/−2
- src-lib/Factory/Math/Implementations/Pi/BBP/Series.hs +2/−2
- src-lib/Factory/Math/Implementations/Pi/Ramanujan/Classic.hs +2/−2
- src-lib/Factory/Math/Implementations/Primality.hs +13/−13
- src-lib/Factory/Math/Implementations/PrimeFactorisation.hs +4/−4
- src-lib/Factory/Math/Implementations/Primes/Algorithm.hs +5/−5
- src-lib/Factory/Math/Implementations/Primes/SieveOfAtkin.hs +2/−2
- src-lib/Factory/Math/Implementations/SquareRoot.hs +3/−3
- src-lib/Factory/Math/MultiplicativeOrder.hs +3/−3
- src-lib/Factory/Math/PerfectPower.hs +3/−3
- src-lib/Factory/Math/Primality.hs +3/−3
- src-lib/Factory/Math/PrimeFactorisation.hs +6/−6
- src-lib/Factory/Math/Primes.hs +3/−3
- src-lib/Factory/Math/Probability.hs +2/−2
- src-lib/Factory/Math/Radix.hs +2/−2
README.markdown view
@@ -1,6 +1,9 @@ # **Factory** -[](https://hackage.haskell.org/package/factory) [](https://travis-ci.org/functionalley/Factory)+[](https://travis-ci.org/functionalley/Factory)+[](https://hackage.haskell.org/package/factory)+[](https://www.gnu.org/licenses/gpl-3.0)+[](https://haskell.org) This is "**Factory**", a library of number-theory functions. @@ -10,7 +13,7 @@ ## Documentation -More information about this library can be found at [Factory](http://functionalley.eu/Factory/factory.html).+More information about this library can be found at [Factory](https://functionalley.eu/Factory/factory.html). ## License
changelog.markdown view
@@ -14,7 +14,7 @@ * Renamed the function `Factory.Math.Precision.capPrecision` to `Factory.Math.Precision.simplify`. * Removed the module "**Factory.Test.Performance.Exponential**". * Removed the function `Factory.Math.Power.raise`, which was no more efficient than ghc's implementation of `(^)`.-* Uploaded to [Hackage](http://hackage.haskell.org/package/factory).+* Uploaded to [Hackage](https://hackage.haskell.org/package/factory). ## 0.1.0.0 * Amended the *.cabal*-file to more correctly specify the dependency on package "**toolshed**".@@ -43,7 +43,7 @@ * Added `Factory.Math.Primes.primorial`. * Altered `Factory.Math.Implementations.Primes.trialDivision` to take an integer defining the size of a `Factory.Data.PrimeWheel`, from which candidates are extracted. * Removed the command-line option `primesPerformanceGraph`, which appears to memoise data from previous tests.-* Uploaded to [Hackage](http://hackage.haskell.org/packages/hackage.html).+* Uploaded to [Hackage](https://hackage.haskell.org/packages/hackage.html). ## 0.1.0.3 * Qualified `Factory.Math.Implementations.Primes.trialDivision` with pragma "**NOINLINE**", to block optimization which conflicts with rewrite-rule for `Factory.Math.Implementations.Primes.sieveOfEratosthenes` !@@ -163,4 +163,8 @@ * Added specialisation-pragmas to **Factory.Math.Statistics**. ## 0.3.1.4++## 0.3.2.0+* Added **Paths_factory** to **Other-modules** section of cabal file.+* Accounted for **Semigroup** becoming a superclass of **Monoid** in **ghc-8.4**.
copyright view
@@ -5,7 +5,7 @@ Copyright (C) 2011-2013 Dr. Alistair Ward. All Rights Reserved. Home-page:- http://functionalley.eu/Factory/factory.html+ https://functionalley.eu/Factory/factory.html License: GNU GENERAL PUBLIC LICENSE Version 3; see '/usr/share/common-licenses/GPL-3' or '/usr/share/doc/licenses/gpl-3.0.txt' where available, or the local packaged file 'LICENSE'.
factory.cabal view
@@ -14,7 +14,7 @@ -- along with Factory. If not, see <http://www.gnu.org/licenses/>. Name: factory-Version: 0.3.1.4+Version: 0.3.2.0 Cabal-version: >= 1.10 Copyright: (C) 2011-2015 Dr. Alistair Ward License: GPL@@ -25,8 +25,8 @@ Build-type: Simple Description: A library of number-theory functions, for; factorials, square-roots, Pi and primes. Category: Math, Number Theory-Tested-with: GHC == 7.4, GHC == 7.6, GHC == 7.8, GHC == 7.10, GHC == 8.0, GHC == 8.2-Homepage: http://functionalley.eu/Factory/factory.html+Tested-with: GHC == 7.4, GHC == 7.6, GHC == 7.8, GHC == 7.10, GHC == 8.0, GHC == 8.2, GHC == 8.4+Homepage: https://functionalley.eu/Factory/factory.html Maintainer: mailto:factory@functionalley.eu Bug-reports: mailto:factory@functionalley.eu @@ -161,6 +161,7 @@ Factory.Test.Performance.Primes Factory.Test.Performance.SquareRoot Factory.Test.Performance.Statistics+ Paths_factory Build-depends: array,
src-lib/Factory/Data/Polynomial.hs view
@@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -24,7 +24,7 @@ * <https://en.wikipedia.org/wiki/Polynomial>. - * <http://mathworld.wolfram.com/Polynomial.html>.+ * <https://mathworld.wolfram.com/Polynomial.html>. -} module Factory.Data.Polynomial(@@ -167,7 +167,7 @@ {- Uses /Euclidian division/. <https://en.wikipedia.org/wiki/Polynomial_long_division>.- <http://demonstrations.wolfram.com/PolynomialLongDivision/>.+ <https://demonstrations.wolfram.com/PolynomialLongDivision/>. -} _ `quotRem'` MkPolynomial [] = error "Factory.Data.Polynomial.quotRem':\tzero denominator." polynomialN `quotRem'` polynomialD = longDivide polynomialN where@@ -285,7 +285,7 @@ {- | * 'True' if the two specified /polynomials/ are /congruent/ in /modulo/-arithmetic. - * <http://planetmath.org/encyclopedia/PolynomialCongruence.html>.+ * <https://planetmath.org/encyclopedia/PolynomialCongruence.html>. -} areCongruentModulo :: (Integral c, Num e, Ord e) => Polynomial c e -- ^ LHS.@@ -303,7 +303,7 @@ * <https://en.wikipedia.org/wiki/Degree_of_a_polynomial>. - * <http://mathworld.wolfram.com/PolynomialDegree.html>.+ * <https://mathworld.wolfram.com/PolynomialDegree.html>. -} getDegree :: Num e => Polynomial c e -> e getDegree (MkPolynomial []) = -1 -- CAVEAT: debatable, but makes some operations more robust and consistent.
src-lib/Factory/Data/Ring.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {- Copyright (C) 2011 Dr. Alistair Ward @@ -12,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -23,7 +24,7 @@ * <https://en.wikipedia.org/wiki/Ring_%28mathematics%29>. - * <http://www.numericana.com/answer/rings.htm>.+ * <https://www.numericana.com/answer/rings.htm>. -} module Factory.Data.Ring(@@ -57,7 +58,7 @@ (=+=) :: r -> r -> r -- ^ Addition of two members; required to be /commutative/; <https://en.wikipedia.org/wiki/Commutativity>. (=*=) :: r -> r -> r -- ^ Multiplication of two members. additiveInverse :: r -> r -- ^ The operand required to yield /zero/ under addition; <https://en.wikipedia.org/wiki/Additive_inverse>.- multiplicativeIdentity :: r -- ^ The /identity/-member under multiplication; <http://mathworld.wolfram.com/MultiplicativeIdentity.html>.+ multiplicativeIdentity :: r -- ^ The /identity/-member under multiplication; <https://mathworld.wolfram.com/MultiplicativeIdentity.html>. additiveIdentity :: r -- ^ The /identity/-member under addition (AKA /zero/); <https://en.wikipedia.org/wiki/Additive_identity>. (=-=) :: r -> r -> r -- ^ Subtract the two specified /ring/-members.@@ -93,9 +94,17 @@ getProduct :: p -- ^ Access the polymorphic payload. } deriving (Read, Show) +-- Added for 'ghc-8.4', when 'Semigroup' became a superclass of 'Monoid'.+#if MIN_VERSION_base(4,11,0)+instance Ring r => Semigroup (Product r) where+ MkProduct x <> MkProduct y = MkProduct $ x =*= y+#endif+ instance Ring r => Data.Monoid.Monoid (Product r) where mempty = MkProduct multiplicativeIdentity+#if !MIN_VERSION_base(4,11,0) MkProduct x `mappend` MkProduct y = MkProduct $ x =*= y+#endif -- | Returns the /product/ of the list of /ring/-members. product' :: Ring r => Math.DivideAndConquer.BisectionRatio -> Math.DivideAndConquer.MinLength -> [r] -> r@@ -107,9 +116,17 @@ getSum :: s -- ^ Access the polymorphic payload. } deriving (Read, Show) +-- Added for 'ghc-8.4', when 'Semigroup' became a superclass of 'Monoid'.+#if MIN_VERSION_base(4,11,0)+instance Ring r => Semigroup (Sum r) where+ MkSum x <> MkSum y = MkSum $ x =+= y+#endif+ instance Ring r => Data.Monoid.Monoid (Sum r) where mempty = MkSum additiveIdentity+#if !MIN_VERSION_base(4,11,0) MkSum x `mappend` MkSum y = MkSum $ x =+= y+#endif -- | Returns the /sum/ of the list of /ring/-members. sum' :: Ring r => Math.DivideAndConquer.BisectionRatio -> Math.DivideAndConquer.MinLength -> [r] -> r
src-lib/Factory/Math/Factorial.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -23,7 +23,7 @@ the simple algorithms appropriate for that forum, leave a large margin for performance-improvement. This module provides the interface for alternative algorithms. - * <http://mathworld.wolfram.com/Factorial.html>.+ * <https://mathworld.wolfram.com/Factorial.html>. -} module Factory.Math.Factorial(
src-lib/Factory/Math/Fibonacci.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -35,7 +35,7 @@ {- | * The subset of 'fibonacci', /indexed/ by a /prime/-number. - * <http://primes.utm.edu/glossary/page.php?sort=FibonacciPrime>.+ * <https://primes.utm.edu/glossary/page.php?sort=FibonacciPrime>. -} primeIndexedFibonacci :: Integral i => [i] primeIndexedFibonacci = map (fibonacci !!) Data.Numbers.Primes.primes
src-lib/Factory/Math/Hyperoperation.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -61,11 +61,11 @@ (succession : addition : multiplication : exponentiation : tetration : pentation : hexation : _) = [0 ..] {- |- * Returns the /power-tower/ of the specified /base/; <http://mathworld.wolfram.com/PowerTower.html>.+ * Returns the /power-tower/ of the specified /base/; <https://mathworld.wolfram.com/PowerTower.html>. * A synonym for /tetration/; <https://en.wikipedia.org/wiki/Tetration>,- <http://www.tetration.org/Fractals/Atlas/index.html>.+ <https://www.tetration.org/Fractals/Atlas/index.html>. -} powerTower :: (Integral base, Integral hyperExponent, Show base) => base -> hyperExponent -> base powerTower 0 hyperExponent
src-lib/Factory/Math/Implementations/Factorial.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -26,9 +26,9 @@ * <https://en.wikipedia.org/wiki/Factorial>. - * <http://mathworld.wolfram.com/Factorial.html>.+ * <https://mathworld.wolfram.com/Factorial.html>. - * <http://www.luschny.de/math/factorial/FastFactorialFunctions.htm>.+ * <https://www.luschny.de/math/factorial/FastFactorialFunctions.htm>. -} module Factory.Math.Implementations.Factorial(@@ -89,7 +89,7 @@ * General purpose /prime-factorisation/ has /exponential time-complexity/, so use /Legendre's Theorem/, which relates only to the /prime factors/ of /factorials/. - * <http://www.proofwiki.org/wiki/Multiplicity_of_Prime_Factor_in_Factorial>.+ * <https://www.proofwiki.org/wiki/Multiplicity_of_Prime_Factor_in_Factorial>. -} primeMultiplicity :: Integral i => i -- ^ A prime number.@@ -97,7 +97,7 @@ -> i -- ^ The number of times the prime occurs in the factorial. primeMultiplicity prime = sum . takeWhile (> 0) . tail . iterate (`div` prime) --- | Returns the /rising factorial/; <http://mathworld.wolfram.com/RisingFactorial.html>+-- | Returns the /rising factorial/; <https://mathworld.wolfram.com/RisingFactorial.html> risingFactorial :: (Integral i, Show i) => i -- ^ The lower bound of the integer-range, whose product is returned. -> i -- ^ The number of integers in the range above.@@ -106,7 +106,7 @@ risingFactorial 0 _ = 0 risingFactorial x n = Data.Interval.product' (recip 2) 64 $ Data.Interval.normalise (x, pred $ x + n) --- | Returns the /falling factorial/; <http://mathworld.wolfram.com/FallingFactorial.html>+-- | Returns the /falling factorial/; <https://mathworld.wolfram.com/FallingFactorial.html> fallingFactorial :: (Integral i, Show i) => i -- ^ The upper bound of the integer-range, whose product is returned. -> i -- ^ The number of integers in the range beneath.
src-lib/Factory/Math/Implementations/Pi/AGM/BrentSalamin.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -21,8 +21,8 @@ * Implements the /Brent-Salamin/ (AKA /Gauss-Legendre/) algorithm; <https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm>,- <http://mathworld.wolfram.com/Brent-SalaminFormula.html>,- <http://www.pi314.net/eng/salamin.php>.+ <https://mathworld.wolfram.com/Brent-SalaminFormula.html>,+ <https://www.pi314.net/eng/salamin.php>. * The precision of the result approximately doubles for each iteration.
src-lib/Factory/Math/Implementations/Pi/BBP/Base65536.hs view
@@ -12,12 +12,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward - [@DESCRIPTION@] Defines a specific base-@2^16@ /BBP/-formula; <http://mathworld.wolfram.com/PiFormulas.html>+ [@DESCRIPTION@] Defines a specific base-@2^16@ /BBP/-formula; <https://mathworld.wolfram.com/PiFormulas.html> -}
src-lib/Factory/Math/Implementations/Pi/BBP/Implementation.hs view
@@ -12,14 +12,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward [@DESCRIPTION@] - * Implements a /Bailey-Borwein-Plouffe/ formula; <http://mathworld.wolfram.com/PiFormulas.html>+ * Implements a /Bailey-Borwein-Plouffe/ formula; <https://mathworld.wolfram.com/PiFormulas.html> * Surprisingly, because of the huge size of the 'Rational' quantities, it is a /single/ call to @Factory.Math.Summation.sum'@, rather than the calculation of the many terms in the series, which is the performance-bottleneck.
src-lib/Factory/Math/Implementations/Pi/BBP/Series.hs view
@@ -12,12 +12,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward - [@DESCRIPTION@] Defines a /Bailey-Borwein-Plouffe/ formula; <http://mathworld.wolfram.com/PiFormulas.html>+ [@DESCRIPTION@] Defines a /Bailey-Borwein-Plouffe/ formula; <https://mathworld.wolfram.com/PiFormulas.html> -} module Factory.Math.Implementations.Pi.BBP.Series(
src-lib/Factory/Math/Implementations/Pi/Ramanujan/Classic.hs view
@@ -12,12 +12,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward - [@DESCRIPTION@] Defines the /Ramanujan/ series for /Pi/; <http://planetmath.org/encyclopedia/RamanujansFormulaForPi.html>.+ [@DESCRIPTION@] Defines the /Ramanujan/ series for /Pi/; <https://planetmath.org/encyclopedia/RamanujansFormulaForPi.html>. -} module Factory.Math.Implementations.Pi.Ramanujan.Classic(
src-lib/Factory/Math/Implementations/Primality.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -23,7 +23,7 @@ * <https://en.wikipedia.org/wiki/Primality_test>. - * <http://primes.utm.edu/index.html>+ * <https://primes.utm.edu/index.html> * CAVEAT: it doesn't determine the prime-factors of composite numbers, just that they exist. -}@@ -92,17 +92,17 @@ This mind-shift, allows one to introduce concepts like /modular/ arithmetic on polynomials, which merely represent an operation on their coefficients and the pigeon-hole in which they're placed. - [@Manindra Agrawal, Neeraj Kayal and Nitin Saxena@] <http://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf>.+ [@Manindra Agrawal, Neeraj Kayal and Nitin Saxena@] <https://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf>. - [@H. W. Lenstra, Jr. and Carl Pomerance@] <http://www.math.dartmouth.edu/~carlp/PDF/complexity12.pdf>.+ [@H. W. Lenstra, Jr. and Carl Pomerance@] <https://www.math.dartmouth.edu/~carlp/PDF/complexity12.pdf>. - [@Salembier and Southerington@] <http://ece.gmu.edu/courses/ECE746/project/F06_Project_resources/Salembier_Southerington_AKS.pdf>,+ [@Salembier and Southerington@] <https://ece.gmu.edu/courses/ECE746/project/F06_Project_resources/Salembier_Southerington_AKS.pdf>, - [@R. Crandall and J. Papadopoulos@] <http://images.apple.com/acg/pdf/aks3.pdf>,+ [@R. Crandall and J. Papadopoulos@] <https://images.apple.com/acg/pdf/aks3.pdf>, - [@Andreas Klappenecker@] <http://faculty.cs.tamu.edu/klappi/629/aks.ps>,+ [@Andreas Klappenecker@] <https://faculty.cs.tamu.edu/klappi/629/aks.ps>, - [@Vibhor Bhatt and G. K. Patra@] <http://www.cmmacs.ernet.in/cmmacs/Publications/resch_rep/rrcm0307.pdf>,+ [@Vibhor Bhatt and G. K. Patra@] <https://www.cmmacs.ernet.in/cmmacs/Publications/resch_rep/rrcm0307.pdf>, -} isPrimeByAKS :: ( Control.DeepSeq.NFData i,@@ -145,7 +145,7 @@ {- | * Uses the specified 'base' in an attempt to prove the /compositeness/ of an integer. - * This is the opposite of the /Miller Test/; <http://mathworld.wolfram.com/MillersPrimalityTest.html>.+ * This is the opposite of the /Miller Test/; <https://mathworld.wolfram.com/MillersPrimalityTest.html>. * If the result is 'True', then the candidate is /composite/; regrettably the converse isn't true. Amongst the set of possible bases, over three-quarters are /witnesses/ to the compositeness of a /composite/ candidate,@@ -173,15 +173,15 @@ * The test becomes deterministic, for any candidate integer, when the number of tests reaches the limit defined by /Eric Bach/. - * A testing of smaller set of bases, is sufficient for candidates smaller than various thresholds; <http://primes.utm.edu/prove/prove2_3.html>.+ * A testing of smaller set of bases, is sufficient for candidates smaller than various thresholds; <https://primes.utm.edu/prove/prove2_3.html>. * <https://en.wikipedia.org/wiki/Miller-Rabin_primality_test>. - * <http://mathworld.wolfram.com/Rabin-MillerStrongPseudoprimeTest.html>+ * <https://mathworld.wolfram.com/Rabin-MillerStrongPseudoprimeTest.html> - * <http://mathworld.wolfram.com/StrongPseudoprime.html>.+ * <https://mathworld.wolfram.com/StrongPseudoprime.html>. - * <http://oeis.org/A014233>, <http://oeis.org/A006945>.+ * <https://oeis.org/A014233>, <https://oeis.org/A006945>. -} isPrimeByMillerRabin :: (Integral i, Show i) => i -> Bool isPrimeByMillerRabin primeCandidate = not $ witnessesCompositeness primeCandidate (
src-lib/Factory/Math/Implementations/PrimeFactorisation.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -21,7 +21,7 @@ * Implements several different prime-factorisation algorithms. - * <http://www.tug.org/texinfohtml/coreutils.html#factor-invocation>.+ * <https://www.tug.org/texinfohtml/coreutils.html#factor-invocation>. -} module Factory.Math.Implementations.PrimeFactorisation(@@ -76,7 +76,7 @@ {- | * <https://en.wikipedia.org/wiki/Fermat%27s_factorization_method>. - * <http://mathworld.wolfram.com/FermatsFactorizationMethod.html>.+ * <https://mathworld.wolfram.com/FermatsFactorizationMethod.html>. * <https://en.wikipedia.org/wiki/Congruence_of_squares>. @@ -125,7 +125,7 @@ {- | * Decomposes the specified integer, into a product of /prime/-factors,- using <http://mathworld.wolfram.com/DirectSearchFactorization.html>, AKA <https://en.wikipedia.org/wiki/Trial_division>.+ using <https://mathworld.wolfram.com/DirectSearchFactorization.html>, AKA <https://en.wikipedia.org/wiki/Trial_division>. * This works best when the factors are small. -}
src-lib/Factory/Math/Implementations/Primes/Algorithm.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -21,11 +21,11 @@ * Generates the constant list of /prime-numbers/, by a variety of different algorithms. - * <http://www.haskell.org/haskellwiki/Prime_numbers>.+ * <https://www.haskell.org/haskellwiki/Prime_numbers>. - * <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.3936&rep=rep1&type=pdf>.+ * <https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.3936&rep=rep1&type=pdf>. - * <http://larc.unt.edu/ian/pubs/sieve.pdf>.+ * <https://larc.unt.edu/ian/pubs/sieve.pdf>. -} module Factory.Math.Implementations.Primes.Algorithm(@@ -48,7 +48,7 @@ = SieveOfAtkin Integer -- ^ The /Sieve of Atkin/, optimised using a 'Data.PrimeWheel.PrimeWheel' of optimal size, for primes up to the specified maximum bound; <https://en.wikipedia.org/wiki/Sieve_of_Atkin>. | SieveOfEratosthenes Data.PrimeWheel.NPrimes -- ^ The /Sieve of Eratosthenes/ (<https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes>), optimised using a 'Data.PrimeWheel.PrimeWheel'. | TrialDivision Data.PrimeWheel.NPrimes -- ^ For each candidate, confirm indivisibility, by all /primes/ smaller than its /square-root/, optimised using a 'Data.PrimeWheel.PrimeWheel'.- | TurnersSieve -- ^ For each /prime/, the infinite list of candidates greater than its /square/, is filtered for indivisibility; <http://www.haskell.org/haskellwiki/Prime_numbers#Turner.27s_sieve_-_Trial_division>.+ | TurnersSieve -- ^ For each /prime/, the infinite list of candidates greater than its /square/, is filtered for indivisibility; <https://www.haskell.org/haskellwiki/Prime_numbers#Turner.27s_sieve_-_Trial_division>. | WheelSieve Int -- ^ 'Data.Numbers.Primes.wheelSieve'. deriving (Eq, Read, Show)
src-lib/Factory/Math/Implementations/Primes/SieveOfAtkin.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -209,7 +209,7 @@ {- | * Generates the constant /bounded/ list of /prime-numbers/. - * <http://cr.yp.to/papers/primesieves-19990826.pdf>+ * <https://cr.yp.to/papers/primesieves-19990826.pdf> -} sieveOfAtkin :: (Control.DeepSeq.NFData i, Data.Array.IArray.Ix i, Integral i) => Data.PrimeWheel.NPrimes -- ^ Other implementations effectively use a hard-coded value either /2/ or /3/, but /6/ seems better.
src-lib/Factory/Math/Implementations/SquareRoot.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -97,7 +97,7 @@ dx' = Math.Power.square dx / dydx' {-- * /Halley's/ method; <http://mathworld.wolfram.com/HalleysMethod.html>+ * /Halley's/ method; <https://mathworld.wolfram.com/HalleysMethod.html> > X(n+1) = Xn - f(Xn) / [f'(Xn) - f''(Xn) * f(Xn) / 2 * f'(Xn)] > => Xn - (Xn^2 - Y) / [2Xn - 2 * (Xn^2 - Y) / 2 * 2Xn] where Y = X^2, f(X) = X^2 - Y, f'(X) = 2X, f''(X) = 2@@ -131,7 +131,7 @@ <https://en.wikipedia.org/wiki/Solving_quadratic_equations_with_continued_fractions>, <https://en.wikipedia.org/wiki/Generalized_continued_fraction#Roots_of_positive_numbers>, <https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Continued_fraction_expansion>.- <http://www.myreckonings.com/Dead_Reckoning/Online/Materials/General%20Method%20for%20Extracting%20Roots.pdf>+ <https://www.myreckonings.com/Dead_Reckoning/Online/Materials/General%20Method%20for%20Extracting%20Roots.pdf> * The convergence <https://en.wikipedia.org/wiki/Rate_of_convergence> of the /continued-fraction/ is merely /1st order/ (linear). -}
src-lib/Factory/Math/MultiplicativeOrder.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -36,11 +36,11 @@ * The smallest positive integral power to which the specified integral base must be raised, to be congruent with one, in the specified /modular/ arithmetic. - * Based on <http://rosettacode.org/wiki/Multiplicative_order#Haskell>.+ * Based on <https://rosettacode.org/wiki/Multiplicative_order#Haskell>. * <https://en.wikipedia.org/wiki/Multiplicative_order>. - * <http://mathworld.wolfram.com/MultiplicativeOrder.html>.+ * <https://mathworld.wolfram.com/MultiplicativeOrder.html>. -} multiplicativeOrder :: (Math.PrimeFactorisation.Algorithmic primeFactorisationAlgorithm, Control.DeepSeq.NFData i, Integral i, Show i) => primeFactorisationAlgorithm
src-lib/Factory/Math/PerfectPower.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -37,7 +37,7 @@ * <https://en.wikipedia.org/wiki/Square_number>. - * <http://mathworld.wolfram.com/SquareNumber.html>.+ * <https://mathworld.wolfram.com/SquareNumber.html>. * @(Math.Power.square . sqrt)@ is expensive, so the modulus of the operand is tested first, in an attempt to prove it isn't a /perfect square/. The set of tests, and the valid moduli within each test, are ordered to maximize the rate of failure-detection.@@ -71,7 +71,7 @@ * <https://en.wikipedia.org/wiki/Perfect_power>. - * <http://mathworld.wolfram.com/PerfectPower.html>.+ * <https://mathworld.wolfram.com/PerfectPower.html>. * A generalisation of the concept of /perfect squares/, in which only the exponent '2' is significant. -}
src-lib/Factory/Math/Primality.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -50,7 +50,7 @@ * <https://en.wikipedia.org/wiki/Coprime>. - * <http://mathworld.wolfram.com/RelativelyPrime.html>.+ * <https://mathworld.wolfram.com/RelativelyPrime.html>. -} areCoprime :: Integral i => i -> i -> Bool areCoprime i = (== 1) . gcd i@@ -77,7 +77,7 @@ * <https://en.wikipedia.org/wiki/Carmichael_number>. - * <http://mathworld.wolfram.com/CarmichaelNumber.html>.+ * <https://mathworld.wolfram.com/CarmichaelNumber.html>. -} isCarmichaelNumber :: ( Algorithmic algorithm,
src-lib/Factory/Math/PrimeFactorisation.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -76,7 +76,7 @@ * <https://en.wikipedia.org/wiki/Smooth_number>. - * <http://mathworld.wolfram.com/SmoothNumber.html>.+ * <https://mathworld.wolfram.com/SmoothNumber.html>. -} smoothness :: (Algorithmic algorithm, Control.DeepSeq.NFData base, Integral base) => algorithm -> [base] smoothness algorithm = 0 : map (Data.Exponential.getBase . last . primeFactors algorithm) [1 ..]@@ -113,7 +113,7 @@ * <https://en.wikipedia.org/wiki/Euler%27s_totient_function>. - * <http://mathworld.wolfram.com/TotientFunction.html>.+ * <https://mathworld.wolfram.com/TotientFunction.html>. * AKA /EulerPhi/. -}@@ -131,11 +131,11 @@ {- | * A constant, zero-indexed, conceptually infinite, list of the /small omega/ numbers (i.e. the number of /distinct/ prime factors); cf. /big omega/. - * <http://oeis.org/wiki/Omega%28n%29,_number_of_distinct_primes_dividing_n>.+ * <https://oeis.org/wiki/Omega%28n%29,_number_of_distinct_primes_dividing_n>. - * <http://mathworld.wolfram.com/DistinctPrimeFactors.html>+ * <https://mathworld.wolfram.com/DistinctPrimeFactors.html> - * <http://planetmath.org/encyclopedia/NumberOfDistinctPrimeFactorsFunction.html>.+ * <https://planetmath.org/encyclopedia/NumberOfDistinctPrimeFactorsFunction.html>. -} omega :: (Algorithmic algorithm, Integral i) => algorithm -> [i] omega algorithm = map (fromIntegral . length . primeFactors algorithm) [0 :: Integer ..]
src-lib/Factory/Math/Primes.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -40,7 +40,7 @@ * <https://en.wikipedia.org/wiki/Primorial>. - * <http://mathworld.wolfram.com/Primorial.html>.+ * <https://mathworld.wolfram.com/Primorial.html>. -} primorial :: ( Algorithmic algorithm,@@ -57,7 +57,7 @@ * <https://en.wikipedia.org/wiki/Mersenne_prime>. - * <http://mathworld.wolfram.com/MersenneNumber.html>+ * <https://mathworld.wolfram.com/MersenneNumber.html> -} mersenneNumbers :: (Algorithmic algorithm, Integral i) => algorithm -> [i] mersenneNumbers algorithm = map (pred . (2 ^)) (primes algorithm :: [Int]) -- Whilst the exponentiation could be parallelised, not all values are known to be required.
src-lib/Factory/Math/Probability.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -157,7 +157,7 @@ * Uses the supplied random-number generator, to generate a conceptually infinite list, of /normally distributed/ random numbers, with standardized /mean/=0, and /variance/=1. - * <https://en.wikipedia.org/wiki/Normal_distribution>, <http://mathworld.wolfram.com/NormalDistribution.html>.+ * <https://en.wikipedia.org/wiki/Normal_distribution>, <https://mathworld.wolfram.com/NormalDistribution.html>. -} generateStandardizedNormalDistribution :: ( RealFloat f,
src-lib/Factory/Math/Radix.hs view
@@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. -} {- | [@AUTHOR@] Dr. Alistair Ward@@ -121,7 +121,7 @@ _ -> error $ "Factory.Math.Radix.fromBase.fromDigit:\tunrecognised char " ++ show c {- |- * <http://mathworld.wolfram.com/DigitSum.html>.+ * <https://mathworld.wolfram.com/DigitSum.html>. * <https://en.wikipedia.org/wiki/Digit_sum>. -}