Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address review comments #269

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions paper/.vscode/ltex.dictionary.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
LinearAlgebra
BenchmarkTools
@benchmark
mul
BigInt
SumOfSquares
JuMP
MutableArithmetics
Dowson
Lubin
MultivariatePolynomials
jl
gcd
num
BangBang
MathOptInterface
@rewrite
JuMP-specific
MPZ
17 changes: 17 additions & 0 deletions paper/code/axiom.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function operate!!(op, args...)
T = typeof.(args)
if mutability(T[1], op, T...) isa IsMutable
return operate!(op, args...)
else
return op(args...)
end
end
function operate_to!!(output, op, args...)
O = typeof(output)
T = typeof.(args)
if mutability(O, op, T...) isa IsMutable
return operate_to!(output, op, args...)
else
return op(args...)
end
end
4 changes: 4 additions & 0 deletions paper/code/matmul.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Base.:*(A::Matrix{S}, b::Vector{T}) where {S,T}
c = Vector{U}(undef, size(A, 1)) # What is U ?
return mul_to!(c, A, b)
end
9 changes: 9 additions & 0 deletions paper/code/mul.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function mul!!(a::Rational{S}, b::Rational{T})
if # S can be mutated to `*(::S, ::T)`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha. This breaks the formatter.

mul!(a.num, b.num)
mul!(a.den, b.den)
return a
else
return a * b
end
end
4 changes: 4 additions & 0 deletions paper/code/rational.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct Rational{T}
num::T
den::T
end
7 changes: 7 additions & 0 deletions paper/code/sum.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function sum(x::Vector)
acc = zero(eltype(x))
for el in x
acc = acc + el
end
return acc
end
9 changes: 9 additions & 0 deletions paper/code/term.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct Term{T}
coef::T
sym::SymbolicVariable
end
struct Sum{T}
terms::Vector{Term{T}}
end
Base.:+(s::Sum, t::Term) = Sum(push!(copy(s.terms), t))
Base.zero(::Type{Term{T}}) where {T} = Sum(Term{T}[])
13 changes: 13 additions & 0 deletions paper/code/termsum.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function sum(x)
acc = zero(eltype(x))
for el in x
acc = add!!(acc, el)
end
return acc
end
add!!(a, b) = a + b # default fallback
add!!(a::BigInt, b::BigInt) = Base.GMP.MPZ.add!(a, b)
function add!!(s::Sum, t::Term)
push!(s.terms, t)
return s
end
10 changes: 10 additions & 0 deletions paper/code/verify.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Verify
using MutableArithmetics
struct SymbolicVariable end
for file in readdir(@__DIR__)
path = joinpath(@__DIR__, file)
if path != (@__FILE__) && file != "mul.jl"
include(file)
end
end
end
5 changes: 2 additions & 3 deletions paper/header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
\title{MutableArithmetics: An API for mutable operations}

\author[1]{Benoît Legat}
\affil[1]{Massachusetts Institute of Technology}
\affil[1]{KU Leuven}

\keywords{Julia, Optimization, Performance, Interface}

\hypersetup{
pdftitle = {MutableArithmetics: An API for mutable operations},
pdfsubject = {JuliaCon 2019 Proceedings},
pdfsubject = {JuliaCon 2021 Proceedings},
pdfauthor = {Benoît Legat},
pdfkeywords = {Julia, Optimization, Performance, Interface},
}

188 changes: 61 additions & 127 deletions paper/paper.tex

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion paper/paper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors:
orcid: 0000-0002-5921-368X
affiliation: 1
affiliations:
- name: Massachusetts Institute of Technology
- name: KU Leuven
index: 1
date: 29 July 2021
bibliography: ref.bib
72 changes: 45 additions & 27 deletions paper/ref.bib
Original file line number Diff line number Diff line change
Expand Up @@ -39,49 +39,66 @@ @Article{dunning2017jump
publisher = {SIAM},
}

@Article{legat2021mathoptinterface,
author = {Legat, Beno\^{\i}t and Dowson, Oscar and Garcia, Joaquim Dias and Lubin, Miles},
journal = {INFORMS Journal on Computing},
title = {{MathOptInterface}: a data structure for mathematical optimization problems},
year = {2021},
note = {In press},
@article{legat2021mathoptinterface,
title={{MathOptInterface}: a data structure for mathematical optimization problems},
author={Legat, Beno{\^\i}t and Dowson, Oscar and Dias Garcia, Joaquim and Lubin, Miles},
journal={INFORMS Journal on Computing},
year={2021},
volume={34},
number={2},
pages={672--689},
doi={10.1287/ijoc.2021.1067},
publisher={INFORMS}
}

@software{legat2021multivariatepolynomials,
author = {Benoît Legat and
Sascha Timme and
Robin Deits},
title = {{JuliaAlgebra/MultivariatePolynomials.jl: v0.3.18}},
month = jul,
year = 2021,
title = {{JuliaAlgebra/MultivariatePolynomials.jl: v0.5.4}},
month = jan,
year = 2024,
publisher = {Zenodo},
version = {v0.3.18},
doi = {10.5281/zenodo.5083796},
url = {https://doi.org/10.5281/zenodo.5083796}
version = {v0.5.4},
doi = {10.5281/zenodo.10468722},
url = {https://zenodo.org/doi/10.5281/zenodo.10468722}
}

@software{verzani2021polynomials,
author = {John Verzani and
Miles Lucas and
Zdeněk Hurák and
Jameson Nash},
title = {{JuliaMath/Polynomials.jl: v2.0.14}},
version = {v2.0.14},
title = {{JuliaMath/Polynomials.jl: v4.0.5}},
version = {v4.0.5},
url = {https://github.com/JuliaMath/Polynomials.jl}
}

@software{takafumi2021bangbang,
author = {Takafumi Arakaki},
title = {{JuliaFolds/BangBang.jl: v0.3.31}},
version = {v0.3.31},
url = {https://github.com/JuliaFolds/BangBang.jl}
title = {{JuliaFolds2/BangBang.jl: v0.4.1}},
version = {v0.4.1},
url = {https://github.com/JuliaFolds2/BangBang.jl}
}

@article{gowda2021high,
title={High-performance symbolic-numerics via multiple dispatch},
author={Gowda, Shashi and Ma, Yingbo and Cheli, Alessandro and Gwozdz, Maja and Shah, Viral B and Edelman, Alan and Rackauckas, Christopher},
journal={arXiv preprint arXiv:2105.03949},
year={2021}
author = {Shashi Gowda and
Yingbo Ma and
Alessandro Cheli and
Maja Gw{\'{o}}zdz and
Viral B. Shah and
Alan Edelman and
Christopher Rackauckas},
title = {High-performance symbolic-numerics via multiple dispatch},
journal = {{ACM} Commun. Comput. Algebra},
volume = {55},
number = {3},
pages = {92--96},
year = {2021},
url = {https://doi.org/10.1145/3511528.3511535},
doi = {10.1145/3511528.3511535},
timestamp = {Sat, 28 Jan 2023 18:54:19 +0100},
biburl = {https://dblp.org/rec/journals/cca/GowdaMCGSER21.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}

@inproceedings{AbstractAlgebra.jl-2017,
Expand Down Expand Up @@ -113,9 +130,10 @@ @ARTICLE{BenchmarkTools.jl-2016
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@Conference{legat2020sumofsquares,
author = {Legat, Beno{\^\i}t and Weisser, Tillmann},
title = {SumOfSquares: A Julia package for Polynomial Optimization},
booktitle = {INFORMS Annual Meeting},
year = {2020},
@Conference{weisser2019polynomial,
author = {Weisser, Tillmann and Legat, Beno{\^\i}t and Coey, Chris and Kapelevich, Lea and Vielma, Juan Pablo},
title = {Polynomial and Moment Optimization in Julia and JuMP},
booktitle = {JuliaCon},
year = {2019},
url = {https://pretalx.com/juliacon2019/talk/QZBKAU/},
}
Loading