JuliaIntervals / IntervalLinearAlgebra.jl

Linear algebra done rigorously
MIT License
36 stars 9 forks source link

data structure for affine expressions #104

Closed lucaferranti closed 2 years ago

lucaferranti commented 2 years ago

PR description

Preliminary structure for linear expressions for PILS.

Quick showcase

julia> @linvars x y z
z

julia> p1 = x + y + z + 1
x+y+z+1

julia> p1([1, 1, 1])
4

julia> p1 - 2
x+y+z-1

julia> p2 = x + y
x+y

julia> p1 - p2
z+1

Related issues

Checklist

Other

codecov-commenter commented 2 years ago

Codecov Report

Merging #104 (92109df) into main (dd1de39) will increase coverage by 6.21%. The diff coverage is 98.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
+ Coverage   90.96%   97.18%   +6.21%     
==========================================
  Files          14       15       +1     
  Lines         487      568      +81     
==========================================
+ Hits          443      552     +109     
+ Misses         44       16      -28     
Impacted Files Coverage Δ
src/pils/linexpr.jl 98.73% <98.73%> (ø)
src/IntervalLinearAlgebra.jl 100.00% <100.00%> (ø)
src/linear_systems/enclosures.jl 85.52% <0.00%> (+0.19%) :arrow_up:
src/linear_systems/oettli.jl 100.00% <0.00%> (+50.00%) :arrow_up:
src/linear_systems/oettli_nonlinear.jl 100.00% <0.00%> (+100.00%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dd1de39...92109df. Read the comment docs.

lucaferranti commented 2 years ago

I'm merging this since it's needed to get the first prototype of PILS solver (see #113 ). The idea is that this is a small simple symbolic functionality to make the package "battery included", but of course users could (and should) use e.g. Symbolics.jl or other stronger packages if they need symbolic manipulation. The AffineParametricArray is parametrised on the type of variables, so it should work (once the code to parse input from Symbolics.jl is added, which is delegated to an upcoming PR)