Miscellaneous
Other possibly useful functionalities.
IntervalLinearAlgebra.AffineExpression
IntervalLinearAlgebra.AffineParametricArray
IntervalLinearAlgebra.Orthants
IntervalLinearAlgebra.comparison_matrix
IntervalLinearAlgebra.enclose
IntervalLinearAlgebra.interval_isapprox
IntervalLinearAlgebra.interval_norm
IntervalLinearAlgebra.interval_norm
IntervalLinearAlgebra.rref
IntervalLinearAlgebra.rref!
IntervalLinearAlgebra.set_multiplication_mode
IntervalLinearAlgebra.@affinevars
Matrix multiplication API
IntervalLinearAlgebra.set_multiplication_mode
— Functionset_multiplication_mode(multype)
Sets the algorithm used to perform matrix multiplication with interval matrices.
Input
multype
– symbol describing the algorithm used:slow
– uses traditional matrix multiplication algorithm.:rank1
– uses rank1 update:fast
– computes an enclosure of the matrix product using the midpoint-radius notation of the matrix [RUM10].
Notes
- By default,
:fast
is used. - Using
fast
is generally significantly faster, but it may return larger intervals, especially if midpoint and radius have the same order of magnitude (50% overestimate at most) [RUM99].
Symbolic Interface
IntervalLinearAlgebra.@affinevars
— Macro@affinevars(x...)
Macro to construct the variables used to represent AffineExpression
.
Examples
julia> @affinevars x
1-element Vector{AffineExpression{Int64}}:
x
julia> @affinevars x y z
3-element Vector{AffineExpression{Int64}}:
x
y
z
julia> @affinevars x[1:4]
4-element Vector{AffineExpression{Int64}}:
x1
x2
x3
x4
IntervalLinearAlgebra.AffineExpression
— TypeAffineExpression{T}
Data structure to represent affine expressions, such as $x+2y+z+4$.
Examples
julia> @affinevars x y z
3-element Vector{AffineExpression{Int64}}:
x
y
z
julia> p1 = x + 2y + z + 4
x+2y+z+4
IntervalLinearAlgebra.AffineParametricArray
— TypeAffineParametricArray{T, N, MT<:AbstractArray{T, N}}
Array whose elements have an affine dependency on a set of parameteres $p₁, p₂, …, pₙ$.
Fields
- coeffs::Vector{MT} – vector of arrays, corresponds to the coefficients of each variable.
Example
julia> @affinevars x y z
3-element Vector{AffineExpression{Int64}}:
x
y
z
julia> A = AffineParametricArray([x+y x-1;x+y+z 1])
2×2 AffineParametricMatrix{Int64, Matrix{Int64}}:
x+y x-1
x+y+z 1
Others
IntervalLinearAlgebra.Orthants
— TypeOrthants
Iterator to go through all the $2ⁿ$ vectors of length $n$ with elements $±1$. This is equivalento to going through the orthants of an $n$-dimensional euclidean space.
Fields
n::Int – dimension of the vector space
Example
julia> for or in Orthants(2)
@show or
end
or = [1, 1]
or = [-1, 1]
or = [1, -1]
or = [-1, -1]
IntervalLinearAlgebra.comparison_matrix
— Methodcomparison_matrix(A::AbstractMatrix{T}) where {T<:Interval}
Computes the comparison matrix $⟨A⟩$ of the given interval matrix $A$ according to the definition $⟨A⟩ᵢᵢ = mig(Aᵢᵢ)$ and $⟨A⟩ᵢⱼ = -mag(Aᵢⱼ)$ if $i≠j$.
Examples
julia> A = [2..4 -1..1; -1..1 2..4]
2×2 Matrix{Interval{Float64}}:
[2, 4] [-1, 1]
[-1, 1] [2, 4]
julia> comparison_matrix(A)
2×2 Matrix{Float64}:
2.0 -1.0
-1.0 2.0
IntervalLinearAlgebra.enclose
— Methodenclose(A::AbstractMatrix{T}, b::AbstractVector{T}) where {T<:Interval}
Computes an enclosure of the solution of the interval linear system $Ax=b$ using the algorithm described in sec. 5.7.1 of [HOR19].
IntervalLinearAlgebra.interval_isapprox
— Methodinterval_isapprox(a::Interval, b::Interval; kwargs)
Checks whether the intervals $a$ and $b$ are approximate equal, that is both their lower and upper bound are approximately equal.
Keywords
Same of Base.isapprox
Example
julia> a = 1..2
[1, 2]
julia> b = a + 1e-10
[1, 2.00001]
julia> interval_isapprox(a, b)
true
julia> interval_isapprox(a, b; atol=1e-15)
false
IntervalLinearAlgebra.interval_norm
— Methodinterval_norm(A::AbstractMatrix{T}) where {T<:Interval}
computes the infinity norm of interval matrix $A$.
Examples
julia> A = [2..4 -1..1; -1..1 2..4]
2×2 Matrix{Interval{Float64}}:
[2, 4] [-1, 1]
[-1, 1] [2, 4]
julia> interval_norm(A)
5.0
IntervalLinearAlgebra.interval_norm
— Methodinterval_norm(A::AbstractVector{T}) where {T<:Interval}
computes the infinity norm of interval vector $v$.
Examples
julia> b = [-2..2, -3..2]
2-element Vector{Interval{Float64}}:
[-2, 2]
[-3, 2]
julia> interval_norm(b)
3.0
IntervalLinearAlgebra.rref!
— Methodrref!(A::AbstractMatrix{T}) where {T<:Interval}
In-place version of rref
.
IntervalLinearAlgebra.rref
— Methodrref(A::AbstractMatrix{T}) where {T<:Interval}
Computes the reduced row echelon form of the interval matrix A
using maximum mignitude as pivoting strategy.
Examples
julia> A = [2..4 -1..1; -1..1 2..4]
2×2 Matrix{Interval{Float64}}:
[2, 4] [-1, 1]
[-1, 1] [2, 4]
julia> rref(A)
2×2 Matrix{Interval{Float64}}:
[2, 4] [-1, 1]
[0, 0] [1.5, 4.5]