-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EmptySet: shorten docs & throw ArgumentErrors
- Loading branch information
Showing
26 changed files
with
31 additions
and
378 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
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
""" | ||
an_element(∅::EmptySet) | ||
Return some element of an empty set. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
An error. | ||
""" | ||
function an_element(::EmptySet) | ||
return error("an empty set does not contain any element") | ||
throw(ArgumentError("an empty set does not contain any element")) | ||
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
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
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 |
---|---|---|
@@ -1,20 +1,3 @@ | ||
""" | ||
diameter(∅::EmptySet, [p]::Real=Inf) | ||
Return the diameter of an empty set. | ||
It is the maximum distance between any two elements of the set or, equivalently, | ||
the diameter of the enclosing ball (of the given ``p``-norm) of minimal volume | ||
with the same center. | ||
### Input | ||
- `∅` -- empty set | ||
- `p` -- (optional, default: `Inf`) norm | ||
### Output | ||
An error. | ||
""" | ||
function diameter(::EmptySet, ::Real=Inf) | ||
return error("the diameter of an empty set is undefined") | ||
throw(ArgumentError("the diameter of an empty set is undefined")) | ||
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
""" | ||
dim(∅::EmptySet) | ||
Return the dimension of an empty set. | ||
### Input | ||
- `∅` -- an empty set | ||
### Output | ||
The dimension of the empty set. | ||
""" | ||
function dim(∅::EmptySet) | ||
return ∅.dim | ||
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 |
---|---|---|
@@ -1,39 +1,7 @@ | ||
""" | ||
high(∅::EmptySet) | ||
Return a vector with the highest coordinates of an empty set in each canonical | ||
direction. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
An error. | ||
### Notes | ||
See also [`high(∅::EmptySet, i::Int)`](@ref). | ||
""" | ||
function high(::EmptySet) | ||
return error("the upper bound of an empty set is undefined") | ||
throw(ArgumentError("the upper bound of an empty set is undefined")) | ||
end | ||
|
||
""" | ||
high(∅::EmptySet, i::Int) | ||
Return the highest coordinate of an empty set in the given direction. | ||
### Input | ||
- `∅` -- empty set | ||
- `i` -- dimension of interest | ||
### Output | ||
An error. | ||
""" | ||
function high(::EmptySet, ::Int) | ||
return error("the upper bound of an empty set is undefined") | ||
throw(ArgumentError("the upper bound of an empty set is undefined")) | ||
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 |
---|---|---|
@@ -1,24 +1,3 @@ | ||
""" | ||
∈(x::AbstractVector, ∅::EmptySet) | ||
Check whether a given point is contained in an empty set. | ||
### Input | ||
- `x` -- point/vector | ||
- `∅` -- empty set | ||
### Output | ||
`false`. | ||
### Examples | ||
```jldoctest | ||
julia> [1.0, 0.0] ∈ ∅(2) | ||
false | ||
``` | ||
""" | ||
function ∈(::AbstractVector, ::EmptySet) | ||
return false | ||
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
""" | ||
isbounded(∅::EmptySet) | ||
Check whether an empty set is bounded. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
`true`. | ||
""" | ||
function isbounded(::EmptySet) | ||
return true | ||
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
""" | ||
isempty(∅::EmptySet) | ||
Check if the empty set is empty. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
`true`. | ||
""" | ||
function isempty(::EmptySet) | ||
return true | ||
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
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 |
---|---|---|
@@ -1,21 +1,7 @@ | ||
""" | ||
linear_map(M::AbstractMatrix{N}, ∅::EmptySet{N}) where {N} | ||
Return the linear map of an empty set. | ||
### Input | ||
- `M` -- matrix | ||
- `∅` -- empty set | ||
### Output | ||
An empty set. | ||
""" | ||
function linear_map(M::AbstractMatrix, ∅::EmptySet) | ||
N = eltype(∅) | ||
@assert size(M, 2) == dim(∅) "cannot apply a $(size(M))-dimensional " * | ||
"matrix to a $(dim(∅))-dimensional set" | ||
|
||
N = eltype(∅) | ||
return EmptySet{N}(size(M, 1)) | ||
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 |
---|---|---|
@@ -1,39 +1,7 @@ | ||
""" | ||
low(∅::EmptySet) | ||
Return a vector with the lowest coordinates of an empty set in each canonical | ||
direction. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
An error. | ||
### Notes | ||
See also [`low(∅::EmptySet, i::Int)`](@ref). | ||
""" | ||
function low(::EmptySet) | ||
return error("the lower bound of an empty set is undefined") | ||
throw(ArgumentError("the lower bound of an empty set is undefined")) | ||
end | ||
|
||
""" | ||
low(∅::EmptySet, i::Int) | ||
Return the lowest coordinate of an empty set in the given direction. | ||
### Input | ||
- `∅` -- empty set | ||
- `i` -- dimension of interest | ||
### Output | ||
An error. | ||
""" | ||
function low(::EmptySet, ::Int) | ||
return error("the lower bound of an empty set is undefined") | ||
throw(ArgumentError("the lower bound of an empty set is undefined")) | ||
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 |
---|---|---|
@@ -1,19 +1,3 @@ | ||
""" | ||
norm(∅::EmptySet, [p]::Real=Inf) | ||
Return the norm of an empty set. | ||
It is the norm of the enclosing ball (of the given ``p``-norm) of minimal volume | ||
that is centered in the origin. | ||
### Input | ||
- `∅` -- empty set | ||
- `p` -- (optional, default: `Inf`) norm | ||
### Output | ||
An error. | ||
""" | ||
function norm(::EmptySet, ::Real=Inf) | ||
return error("the norm of an empty set is undefined") | ||
throw(ArgumentError("the norm of an empty set is undefined")) | ||
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 |
---|---|---|
@@ -1,19 +1,3 @@ | ||
""" | ||
radius(∅::EmptySet, [p]::Real=Inf) | ||
Return the radius of an empty set. | ||
It is the radius of the enclosing ball (of the given ``p``-norm) of minimal | ||
volume with the same center. | ||
### Input | ||
- `∅` -- empty set | ||
- `p` -- (optional, default: `Inf`) norm | ||
### Output | ||
An error. | ||
""" | ||
function radius(::EmptySet, ::Real=Inf) | ||
return error("the radius of an empty set is undefined") | ||
throw(ArgumentError("the radius of an empty set is undefined")) | ||
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
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
""" | ||
rectify(∅::EmptySet) | ||
Concrete rectification of an empty set. | ||
### Input | ||
- `∅` -- empty set | ||
### Output | ||
The empty set. | ||
""" | ||
function rectify(∅::EmptySet) | ||
return ∅ | ||
end |
Oops, something went wrong.