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

update cached MSA docstrings #2631

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Changes from all 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
50 changes: 24 additions & 26 deletions src/LazyOperations/CachedMinkowskiSumArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ end
"""
CachedMinkowskiSumArray{N, S<:LazySet{N}} <: LazySet{N}

Type that represents the Minkowski sum of a finite number of convex sets.
Type that represents the Minkowski sum of a finite number of sets.
Support vector queries are cached.

### Fields

- `array` -- array of convex sets
- `array` -- array of sets
- `cache` -- cache of support vector query results

### Notes
Expand All @@ -50,16 +50,15 @@ for `CachedMinkowskiSumArray`.
The cache (field `cache`) is implemented as dictionary whose keys are directions
and whose values are pairs `(k, s)` where `k` is the number of elements in the
array `array` when the support vector was evaluated last time, and `s` is the
support vector that was obtained.
Thus this type assumes that `array` is not modified except by adding new sets at
the end.
support vector that was obtained. Thus this type assumes that `array` is not
modified except by adding new sets at the end.

Constructors:

- `CachedMinkowskiSumArray(array::Vector{<:LazySet})` -- default constructor

- `CachedMinkowskiSumArray([n]::Int=0, [N]::Type=Float64)`
-- constructor for an empty sum with optional size hint and numeric type
- `CachedMinkowskiSumArray([n]::Int=0, [N]::Type=Float64)` -- constructor for an
empty sum with optional size hint and numeric type
"""
struct CachedMinkowskiSumArray{N, S<:LazySet{N}} <: LazySet{N}
array::Vector{S}
Expand Down Expand Up @@ -90,15 +89,15 @@ end
"""
array(cms::CachedMinkowskiSumArray)

Return the array of a caching Minkowski sum.
Return the array of a cached Minkowski sum.

### Input

- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

The array of a caching Minkowski sum.
The array of a cached Minkowski sum.
"""
function array(cms::CachedMinkowskiSumArray)
return cms.array
Expand All @@ -107,15 +106,15 @@ end
"""
dim(cms::CachedMinkowskiSumArray)

Return the dimension of a caching Minkowski sum.
Return the dimension of a cached Minkowski sum.

### Input

- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

The ambient dimension of the caching Minkowski sum.
The ambient dimension of the cached Minkowski sum.
"""
function dim(cms::CachedMinkowskiSumArray)
return length(cms.array) == 0 ? 0 : dim(cms.array[1])
Expand All @@ -124,12 +123,12 @@ end
"""
σ(d::AbstractVector, cms::CachedMinkowskiSumArray)

Return the support vector of a caching Minkowski sum in a given direction.
Return the support vector of a cached Minkowski sum in a given direction.

### Input

- `d` -- direction
- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

Expand All @@ -140,7 +139,7 @@ If the direction has norm zero, the result depends on the summand sets.

The result is cached, i.e., any further query with the same direction runs in
constant time.
When sets are added to the caching Minkowski sum, the query is only performed
When sets are added to the cached Minkowski sum, the query is only performed
Copy link
Member Author

Choose a reason for hiding this comment

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

in several places we had caching instead of cached. i think we should use only one name (?) so cached is better since it is part of the type's name.

for the new sets.
"""
function σ(d::AbstractVector, cms::CachedMinkowskiSumArray)
Expand Down Expand Up @@ -171,11 +170,11 @@ end
"""
isbounded(cms::CachedMinkowskiSumArray)

Determine whether a caching Minkowski sum is bounded.
Determine whether a cached Minkowski sum is bounded.

### Input

- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

Expand All @@ -188,11 +187,11 @@ end
"""
isempty(cms::CachedMinkowskiSumArray)

Return if a caching Minkowski sum array is empty or not.
Return if a cached Minkowski sum array is empty or not.

### Input

- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

Expand All @@ -203,7 +202,7 @@ Return if a caching Minkowski sum array is empty or not.
Forgotten sets cannot be checked anymore.
Usually they have been empty because otherwise the support vector query should
have crashed before.
In that case, the caching Minkowski sum should not be used further.
In that case, the cached Minkowski sum should not be used further.
"""
function isempty(cms::CachedMinkowskiSumArray)
return any(isempty, array(cms))
Expand All @@ -212,14 +211,13 @@ end
"""
forget_sets!(cms::CachedMinkowskiSumArray)

Tell a caching Minkowski sum to forget the stored sets (but not the support
vectors).
Only those sets are forgotten such that for each cached direction the support
vector has been computed before.
Tell a cached Minkowski sum to forget the stored sets (but not the support
vectors). Only those sets are forgotten such that for each cached direction the
support vector has been computed before.

### Input

- `cms` -- caching Minkowski sum
- `cms` -- cached Minkowski sum

### Output

Expand Down