Skip to content

Commit e1cb835

Browse files
committed
Update docstrings
1 parent ad85dab commit e1cb835

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/IntervalArithmetic.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,31 @@ Configure the default behavior for:
202202
- **Bound Type**: The default numerical type used to represent the bounds of the
203203
intervals. The default is `Float64`, but other subtypes of
204204
[`IntervalArithmetic.NumTypes`](@ref) can be used to adjust precision.
205+
Keyword: `numtype`. Available options: subtypes of `IntervalArithmetic.NumTypes`.
205206
206207
- **Flavor**: The interval representation that adhere to the IEEE Standard
207208
1788-2015. By default, it uses the set-based flavor, which excludes infinity
208209
to be part of an interval. Learn more: [`IntervalArithmetic.Flavor`](@ref).
210+
Keyword: `flavor`. Available options: `:set_based` (default).
209211
210212
- **Interval Rounding**: Controls the rounding behavior for interval arithmetic
211213
operations. By default, the library employs correct rounding to ensure that
212214
bounds are computed as tightly as possible. Learn more:
213215
[`IntervalArithmetic.IntervalRounding`](@ref).
216+
Keyword: `rounding`. Available options: `:correct` (default), `:none`.
214217
215218
- **Power mode**: A performance setting for power operations. The default mode
216219
uses an efficient algorithm prioritizing fast computation, but it can be
217220
adjusted for more precise, slower calculations if needed. Learn more:
218221
[`IntervalArithmetic.PowerMode`](@ref).
222+
Keyword: `power`. Available options: `:fast` (default), `:slow`.
219223
220224
- **Matrix Multiplication mode**: A performance setting for matrix
221225
multiplication operations. The default mode uses an efficient algorithm
222226
prioritizing fast computation, but it can be changed to use the standard
223227
definition of matrix multiplication. Learn more:
224228
[`IntervalArithmetic.MatMulMode`](@ref).
229+
Keyword: `matmul`. Available options: `:fast` (default), `:slow`.
225230
"""
226231
function configure(; numtype::Type{<:NumTypes}=Float64, flavor::Symbol=:set_based, rounding::Symbol=:correct, power::Symbol=:fast, matmul::Symbol=:slow)
227232
configure_numtype(numtype)

src/intervals/construction.jl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ isguaranteed(::Number) = false
340340
#
341341

342342
"""
343-
interval(T, a, b, d = com)
343+
interval([T,] a, b, d = com; format = :infsup)
344344
345345
Create the interval ``[a, b]`` according to the IEEE Standard 1788-2015. The
346346
validity of the interval is checked by [`is_valid_interval`](@ref): if `true`
@@ -386,8 +386,6 @@ end
386386
interval(a, d::Decoration = com; format::Symbol = :infsup) = interval(promote_numtype(numtype(a), numtype(a)), a, d; format = format)
387387

388388
# some useful extra constructor
389-
interval(::Type{T}, a::Tuple, d::Decoration = com; format::Symbol = :infsup) where {T} = interval(T, a..., d; format = format)
390-
interval(a::Tuple, d::Decoration = com; format::Symbol = :infsup) = interval(a..., d; format = format)
391389
interval(::Type{T}, A::AbstractArray, d::Decoration = com; format::Symbol = :infsup) where {T} = interval.(T, A, d; format = format)
392390
interval(A::AbstractArray, d::Decoration = com; format::Symbol = :infsup) = interval.(A, d; format = format)
393391
interval(::Type{T}, A::AbstractArray, B::AbstractArray, d::Decoration = com; format::Symbol = :infsup) where {T} = interval.(T, A, B, d; format = format)
@@ -401,7 +399,7 @@ interval(T::Type, d::Decoration; format::Symbol = :infsup) = throw(MethodError(i
401399
# standard format
402400

403401
"""
404-
_interval_infsup(T<:NumTypes, a, b, [d::Decoration])
402+
_interval_infsup(T<:NumTypes, a, b, d::Decoration)
405403
406404
Internal constructor for intervals described by their lower and upper bounds,
407405
i.e. of the form ``[a, b]``.
@@ -459,52 +457,52 @@ function _interval_infsup(::Type{T}, x, y::Union{BareInterval,Interval}, d::Deco
459457
end
460458
end
461459

462-
_interval_infsup(::Type{T}, a::Complex, b::Union{BareInterval,Interval}, d::Decoration = com) where {T<:NumTypes} =
460+
_interval_infsup(::Type{T}, a::Complex, b::Union{BareInterval,Interval}, d::Decoration) where {T<:NumTypes} =
463461
complex(_interval_infsup(T, real(a), real(b), d), _interval_infsup(T, imag(a), imag(b), d))
464-
_interval_infsup(::Type{T}, a::Union{BareInterval,Interval}, b::Complex, d::Decoration = com) where {T<:NumTypes} =
462+
_interval_infsup(::Type{T}, a::Union{BareInterval,Interval}, b::Complex, d::Decoration) where {T<:NumTypes} =
465463
complex(_interval_infsup(T, real(a), real(b), d), _interval_infsup(T, imag(a), imag(b), d))
466464

467-
_interval_infsup(::Type{T}, a::Complex, b::Complex, d::Decoration = com) where {T<:NumTypes} =
465+
_interval_infsup(::Type{T}, a::Complex, b::Complex, d::Decoration) where {T<:NumTypes} =
468466
complex(_interval_infsup(T, real(a), real(b), d), _interval_infsup(T, imag(a), imag(b), d))
469-
_interval_infsup(::Type{T}, a::Complex, b, d::Decoration = com) where {T<:NumTypes} =
467+
_interval_infsup(::Type{T}, a::Complex, b, d::Decoration) where {T<:NumTypes} =
470468
complex(_interval_infsup(T, real(a), real(b), d), _interval_infsup(T, imag(a), imag(b), d))
471-
_interval_infsup(::Type{T}, a, b::Complex, d::Decoration = com) where {T<:NumTypes} =
469+
_interval_infsup(::Type{T}, a, b::Complex, d::Decoration) where {T<:NumTypes} =
472470
complex(_interval_infsup(T, real(a), real(b), d), _interval_infsup(T, imag(a), imag(b), d))
473471

474472
# midpoint constructors
475473

476474
"""
477-
_interval_midpoint(T<:NumTypes, m, r, d = com)
475+
_interval_midpoint(T<:NumTypes, m, r, d::Decoration)
478476
479477
Internal constructor for intervals described by their midpoint and radius, i.e.
480478
of the form ``m \\pm r``.
481479
"""
482-
function _interval_midpoint(::Type{T}, m, r, d::Decoration = com) where {T<:NumTypes}
480+
function _interval_midpoint(::Type{T}, m, r, d::Decoration) where {T<:NumTypes}
483481
x = _interval_infsup(T, m, m, d)
484482
r = _interval_infsup(T, r, r, d)
485483
precedes(zero(r), r) && return _interval_infsup(T, x - r, x + r, d)
486484
return throw(DomainError(r, "must be positive"))
487485
end
488486

489-
_interval_midpoint(::Type{T}, m::Complex, r, d::Decoration = com) where {T<:NumTypes} =
487+
_interval_midpoint(::Type{T}, m::Complex, r, d::Decoration) where {T<:NumTypes} =
490488
complex(_interval_midpoint(T, real(m), r, d), _interval_midpoint(T, imag(m), r, d))
491489

492-
function _interval_midpoint(::Type{T}, m, r::Complex{<:Interval}, d::Decoration = com) where {T<:NumTypes}
490+
function _interval_midpoint(::Type{T}, m, r::Complex{<:Interval}, d::Decoration) where {T<:NumTypes}
493491
isthinzero(imag(r)) || return throw(DomainError(r, "imaginary part must be zero"))
494492
return _interval_midpoint(T, m, real(r), d)
495493
end
496494

497-
function _interval_midpoint(::Type{T}, m, r::Complex, d::Decoration = com) where {T<:NumTypes}
495+
function _interval_midpoint(::Type{T}, m, r::Complex, d::Decoration) where {T<:NumTypes}
498496
iszero(imag(r)) || return throw(DomainError(r, "imaginary part must be zero"))
499497
return _interval_midpoint(T, m, real(r), d)
500498
end
501499

502-
function _interval_midpoint(::Type{T}, m::Complex, r::Complex{<:Interval}, d::Decoration = com) where {T<:NumTypes}
500+
function _interval_midpoint(::Type{T}, m::Complex, r::Complex{<:Interval}, d::Decoration) where {T<:NumTypes}
503501
isthinzero(imag(r)) || return throw(DomainError(r, "imaginary part must be zero"))
504502
return _interval_midpoint(T, m, real(r), d)
505503
end
506504

507-
function _interval_midpoint(::Type{T}, m::Complex, r::Complex, d::Decoration = com) where {T<:NumTypes}
505+
function _interval_midpoint(::Type{T}, m::Complex, r::Complex, d::Decoration) where {T<:NumTypes}
508506
iszero(imag(r)) || return throw(DomainError(r, "imaginary part must be zero"))
509507
return _interval_midpoint(T, m, real(r), d)
510508
end

0 commit comments

Comments
 (0)