polynomial ![Build Status](https://camo.githubusercontent.com/e7f0ab461ac4d80b25a59387007448c636cce1adbb01fa0eb9d7e2557e0a38fe/68747470733a2f2f7472617669732d63692e6f72672f6d6f6b7573302f706f6c796e6f6d69616c2e737667)
Some code for representing and manipulating polynomials. Could use a better README.
Haskell library for manipulating and evaluating polynomials
Some code for representing and manipulating polynomials. Could use a better README.
Currently the package claims to be tested with GHC 7.8.4 — 8.1.* (whatever that asterisk means).
Is it reasonable to maintain such far-reaching backwards compatibility, considering that this is not an infrastructure package?
I propose that we instead test against 8.0.2, 8.2.2, 8.4.4, 8.6.4 and 8.6.5. For the future, I propose that we pin the support window to some well known package, such as haskell-CI
.
If there is consensus, I can try my hand at making the required changes.
The instances in src/Data/VectorSpace/WrappedNum.hs
do not compile, with the error involving the second type argument of ‘U.MVector’ has role Nominal
Please consider submitting this library to stackage. That way, other people will fix compatibility issues for you :)
$ ./dist/build/polynomial-test/polynomial-test --test-seed 1421927705 -t chebyshevFit
Math.Polynomial.Chebyshev:
chebyshevFit:
sane (Double): [OK, passed 100 tests]
sane (Float): [Failed]
*** Failed! Falsifiable (after 97 tests):
NonNegative {getNonNegative = 16}
<function>
(used seed 1421927705)
Properties Total
Passed 1 1
Failed 1 1
Total 2 2
Looks like the cabal file only includes test/Tests.hs and not the other modules, so the source as uploaded to hackage cannot be tested.
polynomial does not build with recent versions of ghc
I noticed that debian has patched it, and the patches are not completely trivial base version bumps, so this might save some time:
https://sources.debian.org/patches/haskell-polynomial/0.7.3-5/newer-base/
https://sources.debian.org/patches/haskell-polynomial/0.7.3-5/newer-hunit/
Since version 1.1.2.0 pretty provides the same class as prettyclass does so later is no longer required. Simple removal of prettyclass does the trick for ghc 7.10, better constraints might be required to support earlier versions.
This package (e.g. the currently published version on hackage, 0.7.3-r1) does not support compilation with newer GHC and base
versions. This should be fixed. Merging PRs #12, #16 would probably fix most of it.
It seems that this package isn't really maintained anymore, as no change occured since 2019 (and no substantial changes occured since 2017).
I think it would be helpful to add a polyPowerMod function to Math.Polynomial. It comes in handy, for instance, when working with Galois fields.
As for a signature, probably mirroring the one for powerMod in arithmoi would work well:
polyPowerMod base exponent modulus
I am running The Glorious Glasgow Haskell Compilation System, version 8.0.1 on Mac OS 10.12
I ran cabal install polynomial and it failed. Log file is below.
cabal: Entering directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-2327/polynomial-0.7.2'
Configuring polynomial-0.7.2...
Building polynomial-0.7.2...
Preprocessing library polynomial-0.7.2...
[ 1 of 15] Compiling Data.List.ZipSum ( src/Data/List/ZipSum.hs, dist/build/Data/List/ZipSum.o )
on the commandline: warning: [-Wunsafe]
‘Data.List.ZipSum’ has been inferred as unsafe!
Reason:
src/Data/List/ZipSum.hs:3:1: error:
Data.AdditiveGroup: Can't be safely imported!
The module itself isn't safe.
[ 2 of 15] Compiling Data.VectorSpace.WrappedNum ( src/Data/VectorSpace/WrappedNum.hs, dist/build/Data/VectorSpace/WrappedNum.o )
src/Data/VectorSpace/WrappedNum.hs:22:18: error:
• Not in scope: type variable ‘a’
• In the Template Haskell quotation
[t| (U.Unbox a) => WrappedNum a -> a |]
src/Data/VectorSpace/WrappedNum.hs:22:35: error:
• Not in scope: type variable ‘a’
• In the Template Haskell quotation
[t| (U.Unbox a) => WrappedNum a -> a |]
src/Data/VectorSpace/WrappedNum.hs:22:40: error:
• Not in scope: type variable ‘a’
• In the Template Haskell quotation
[t| (U.Unbox a) => WrappedNum a -> a |]
cabal: Leaving directory '/var/folders/sr/jktws8p56m58qw9h6k53dbfr0000gn/T/cabal-tmp-2327/polynomial-0.7.2'
I'm wondering if it would make sense to supply an alternate version of evalPoly
at type (Num a) => Poly a -> a -> a
instead of (Num a, Eq a) => Poly a -> a -> a
.
It looks like the current version uses the Eq
context to check if the argument is zero before evaluating the polynomial, presumably either for efficiency or to be sure to get the exact result.
However this context requirement is a burden when the polynomial is over an abstract domain like an Ivory IDouble
which doesn't supply an Eq
context.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.