-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Address review comments * up * Fixes * Fix cap * Fix
- Loading branch information
Showing
12 changed files
with
203 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
struct Rational{T} | ||
num::T | ||
den::T | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) | ||
include(file) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters