Skip to content

Commit ef33a4b

Browse files
authored
Merge pull request #41 from blegat/typed
New design : implementation independent API
2 parents 83297a5 + c7bec44 commit ef33a4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1531
-2216
lines changed

.travis.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ julia:
77
- nightly
88
notifications:
99
email: false
10-
# uncomment the following lines to override the default test script
11-
#script:
12-
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
13-
# - julia -e 'Pkg.clone(pwd()); Pkg.build("MultivariatePolynomials"); Pkg.test("MultivariatePolynomials"; coverage=true)'
10+
matrix:
11+
allow_failures:
12+
- julia: nightly
13+
script:
14+
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
15+
- julia -e 'Pkg.clone(pwd()); Pkg.clone("https://github.com/blegat/DynamicPolynomials.jl"); Pkg.clone("https://github.com/rdeits/TypedPolynomials.jl"); Pkg.checkout("TypedPolynomials", "typed"); Pkg.build("MultivariatePolynomials"); Pkg.test("MultivariatePolynomials"; coverage=true)'
1416
after_success:
1517
# push coverage results to Coveralls
1618
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
1719
# push coverage results to Codecov
1820
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
21+
# update doc
22+
- julia -e 'Pkg.add("Documenter")'
23+
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); include(joinpath("docs", "make.jl"))'

REQUIRE

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
julia 0.5
2-
Compat 0.17
1+
julia 0.6

appveyor.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ build_script:
2929
# Need to convert from shallow to complete for Pkg.clone to work
3030
- IF EXIST .git\shallow (git fetch --unshallow)
3131
- C:\projects\julia\bin\julia -e "versioninfo();
32-
Pkg.clone(pwd(), \"MultivariatePolynomials\"); Pkg.build(\"MultivariatePolynomials\")"
32+
Pkg.clone(pwd(), \"MultivariatePolynomials\");
33+
Pkg.clone(\"https://github.com/blegat/DynamicPolynomials.jl\");
34+
Pkg.clone(\"https://github.com/rdeits/TypedPolynomials.jl\");
35+
Pkg.checkout(\"TypedPolynomials\", \"typed\");
36+
Pkg.build(\"MultivariatePolynomials\")"
3337

3438
test_script:
3539
- C:\projects\julia\bin\julia -e "Pkg.test(\"MultivariatePolynomials\")"

docs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

docs/make.jl

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Documenter, MultivariatePolynomials
2+
3+
makedocs(
4+
format = :html,
5+
sitename = "MultivariatePolynomials",
6+
pages = [
7+
"Introduction" => "index.md",
8+
"Reference" => "apireference.md",
9+
]
10+
)
11+
12+
deploydocs(
13+
repo = "github.com/blegat/MultivariatePolynomials.jl.git",
14+
target = "build",
15+
osname = "linux",
16+
julia = "0.6",
17+
deps = nothing,
18+
make = nothing,
19+
)

docs/src/apireference.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
```@meta
2+
CurrentModule = MultivariatePolynomials
3+
```
4+
5+
# API
6+
7+
## Variables
8+
9+
```@docs
10+
name
11+
```
12+
13+
## Terms
14+
15+
```@docs
16+
term
17+
zeroterm
18+
coefficient
19+
monomial
20+
exponent
21+
deg
22+
isconstant
23+
divides
24+
```
25+
26+
## Polynomials
27+
28+
```@docs
29+
terms
30+
monomials
31+
mindeg
32+
maxdeg
33+
extdeg
34+
leadingterm
35+
leadingcoefficient
36+
leadingmonomial
37+
removeleadingterm
38+
removemonomials
39+
vars
40+
nvars
41+
```
42+
43+
## Monomial Vectors
44+
45+
```@docs
46+
monovec
47+
monovectype
48+
sortmonovec
49+
mergemonovec
50+
```

docs/src/index.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# MultivariatePolynomials
2+
3+
[MultivariatePolynomials.jl](https://github.com/blegat/MultivariatePolynomials.jl) is an implementation independent library for manipulating multivariate polynomials.
4+
It defines abstract types and an API for multivariate monomials, terms, polynomials, moments and measures and gives default implementation for common operations on them using the API.
5+
If you want to manipulate multivariate polynomials easily and efficiently while being able to easily switch between different implementations, this library is exactly what you are looking for.
6+
7+
Supported operations are : basic arithmetic, rational polynomials, differentiation and evaluation/substitution, division and duality operations between polynomials and moments.
8+
There is also support for solving systems of equations (soon!) and building (semi)algebraic sets.
9+
10+
Currently, the following implementations are available:
11+
12+
* [TypedPolynomials](https://github.com/rdeits/TypedPolynomials.jl)
13+
* [DynamicPolynomials](https://github.com/blegat/DynamicPolynomials.jl)
14+
15+
```@contents
16+
Pages = ["apireference.md"]
17+
Depth = 3
18+
```

src/MultivariatePolynomials.jl

+23-19
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,40 @@ __precompile__()
22

33
module MultivariatePolynomials
44

5-
using Compat
5+
#using DocStringExtensions
66

7-
import Base: show, length, getindex, vect, isless, isempty, start, done, next, convert, dot, copy, eltype, zero, one
7+
import Base: *, +, -, /, ^, ==,
8+
promote_rule, convert, show, isless, size, getindex,
9+
one, zero, transpose, isapprox, @pure, dot, copy
810

9-
@compat abstract type PolyType{C} end
10-
export iscomm
11-
iscomm{C}(::PolyType{C}) = C
12-
zero{C}(::Type{PolyType{C}}) = zero(Polynomial{C, Int})
13-
one{C}(::Type{PolyType{C}}) = one(Polynomial{C, Int})
14-
zero{C}(p::PolyType{C}) = zero(PolyType{C})
15-
one{C}(p::PolyType{C}) = one(PolyType{C})
11+
export AbstractPolynomialLike, AbstractTermLike, AbstractMonomialLike
12+
abstract type AbstractPolynomialLike{T} end
13+
abstract type AbstractTermLike{T} <: AbstractPolynomialLike{T} end
14+
abstract type AbstractMonomialLike <: AbstractTermLike{Int} end
1615

16+
export AbstractVariable, AbstractMonomial, AbstractTerm, AbstractPolynomial
17+
abstract type AbstractVariable <: AbstractMonomialLike end
18+
abstract type AbstractMonomial <: AbstractMonomialLike end
19+
abstract type AbstractTerm{T} <: AbstractTermLike{T} end
20+
abstract type AbstractPolynomial{T} <: AbstractPolynomialLike{T} end
21+
22+
const APL{T} = AbstractPolynomialLike{T}
23+
24+
include("zip.jl")
1725
include("mono.jl")
26+
include("term.jl")
1827
include("poly.jl")
28+
1929
include("rational.jl")
20-
include("measure.jl")
21-
include("exp.jl")
30+
31+
include("conversion.jl")
2232
include("promote.jl")
33+
include("substitution.jl")
2334

35+
include("operators.jl")
2436
include("comp.jl")
2537

26-
include("alg.jl")
27-
include("calg.jl")
28-
include("ncalg.jl")
29-
3038
include("diff.jl")
31-
include("subs.jl")
32-
include("algebraicset.jl")
33-
include("norm.jl")
34-
3539
include("div.jl")
3640

3741
include("show.jl")

src/alg.jl

-27
This file was deleted.

src/algebraicset.jl

-37
This file was deleted.

0 commit comments

Comments
 (0)