Skip to content

Commit

Permalink
Merge pull request #41 from blegat/typed
Browse files Browse the repository at this point in the history
New design : implementation independent API
  • Loading branch information
blegat authored Aug 15, 2017
2 parents 83297a5 + c7bec44 commit ef33a4b
Show file tree
Hide file tree
Showing 54 changed files with 1,531 additions and 2,216 deletions.
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ julia:
- nightly
notifications:
email: false
# uncomment the following lines to override the default test script
#script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia -e 'Pkg.clone(pwd()); Pkg.build("MultivariatePolynomials"); Pkg.test("MultivariatePolynomials"; coverage=true)'
matrix:
allow_failures:
- julia: nightly
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- 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)'
after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
# update doc
- julia -e 'Pkg.add("Documenter")'
- julia -e 'cd(Pkg.dir("MultivariatePolynomials")); include(joinpath("docs", "make.jl"))'
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
julia 0.5
Compat 0.17
julia 0.6
6 changes: 5 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"MultivariatePolynomials\"); Pkg.build(\"MultivariatePolynomials\")"
Pkg.clone(pwd(), \"MultivariatePolynomials\");
Pkg.clone(\"https://github.com/blegat/DynamicPolynomials.jl\");
Pkg.clone(\"https://github.com/rdeits/TypedPolynomials.jl\");
Pkg.checkout(\"TypedPolynomials\", \"typed\");
Pkg.build(\"MultivariatePolynomials\")"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"MultivariatePolynomials\")"
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
19 changes: 19 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Documenter, MultivariatePolynomials

makedocs(
format = :html,
sitename = "MultivariatePolynomials",
pages = [
"Introduction" => "index.md",
"Reference" => "apireference.md",
]
)

deploydocs(
repo = "github.com/blegat/MultivariatePolynomials.jl.git",
target = "build",
osname = "linux",
julia = "0.6",
deps = nothing,
make = nothing,
)
50 changes: 50 additions & 0 deletions docs/src/apireference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
```@meta
CurrentModule = MultivariatePolynomials
```

# API

## Variables

```@docs
name
```

## Terms

```@docs
term
zeroterm
coefficient
monomial
exponent
deg
isconstant
divides
```

## Polynomials

```@docs
terms
monomials
mindeg
maxdeg
extdeg
leadingterm
leadingcoefficient
leadingmonomial
removeleadingterm
removemonomials
vars
nvars
```

## Monomial Vectors

```@docs
monovec
monovectype
sortmonovec
mergemonovec
```
18 changes: 18 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# MultivariatePolynomials

[MultivariatePolynomials.jl](https://github.com/blegat/MultivariatePolynomials.jl) is an implementation independent library for manipulating multivariate polynomials.
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.
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.

Supported operations are : basic arithmetic, rational polynomials, differentiation and evaluation/substitution, division and duality operations between polynomials and moments.
There is also support for solving systems of equations (soon!) and building (semi)algebraic sets.

Currently, the following implementations are available:

* [TypedPolynomials](https://github.com/rdeits/TypedPolynomials.jl)
* [DynamicPolynomials](https://github.com/blegat/DynamicPolynomials.jl)

```@contents
Pages = ["apireference.md"]
Depth = 3
```
42 changes: 23 additions & 19 deletions src/MultivariatePolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,40 @@ __precompile__()

module MultivariatePolynomials

using Compat
#using DocStringExtensions

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

@compat abstract type PolyType{C} end
export iscomm
iscomm{C}(::PolyType{C}) = C
zero{C}(::Type{PolyType{C}}) = zero(Polynomial{C, Int})
one{C}(::Type{PolyType{C}}) = one(Polynomial{C, Int})
zero{C}(p::PolyType{C}) = zero(PolyType{C})
one{C}(p::PolyType{C}) = one(PolyType{C})
export AbstractPolynomialLike, AbstractTermLike, AbstractMonomialLike
abstract type AbstractPolynomialLike{T} end
abstract type AbstractTermLike{T} <: AbstractPolynomialLike{T} end
abstract type AbstractMonomialLike <: AbstractTermLike{Int} end

export AbstractVariable, AbstractMonomial, AbstractTerm, AbstractPolynomial
abstract type AbstractVariable <: AbstractMonomialLike end
abstract type AbstractMonomial <: AbstractMonomialLike end
abstract type AbstractTerm{T} <: AbstractTermLike{T} end
abstract type AbstractPolynomial{T} <: AbstractPolynomialLike{T} end

const APL{T} = AbstractPolynomialLike{T}

include("zip.jl")
include("mono.jl")
include("term.jl")
include("poly.jl")

include("rational.jl")
include("measure.jl")
include("exp.jl")

include("conversion.jl")
include("promote.jl")
include("substitution.jl")

include("operators.jl")
include("comp.jl")

include("alg.jl")
include("calg.jl")
include("ncalg.jl")

include("diff.jl")
include("subs.jl")
include("algebraicset.jl")
include("norm.jl")

include("div.jl")

include("show.jl")
Expand Down
27 changes: 0 additions & 27 deletions src/alg.jl

This file was deleted.

37 changes: 0 additions & 37 deletions src/algebraicset.jl

This file was deleted.

Loading

0 comments on commit ef33a4b

Please sign in to comment.