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

Deprecate ProductArray #368

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions src/product_representations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@ abstract type AbstractReshaper end
StaticReshaper()

Reshaper that constructs `SizedArray` from the `StaticArrays.jl` package.


!!! note

Usage of this type has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
struct StaticReshaper <: AbstractReshaper end

"""
make_reshape(reshaper::AbstractReshaper, ::Type{Size}, data) where Size

Reshape array `data` to size `Size` using method provided by `reshaper`.

!!! note

Usage of this function has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
function make_reshape(reshaper::AbstractReshaper, ::Type{Size}, data) where {Size}
return error(
Expand All @@ -25,6 +36,11 @@ end
ArrayReshaper()

Reshaper that constructs `Base.ReshapedArray`.

!!! note

Usage of this type has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
struct ArrayReshaper <: AbstractReshaper end

Expand Down Expand Up @@ -74,6 +90,11 @@ numbers and is second, so the next four numbers are allocated to it (`4:7`).
represent points. In this case, `Sphere(2)` expects a three-element vector, so
the corresponding size is `Tuple{3}`. On the other hand, `Rotations(2)`
expects two-by-two matrices, so its size specification is `Tuple{2,2}`.

!!! note

Usage of this type has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
struct ShapeSpecification{TRanges,TSizes,TReshapers}
reshapers::TReshapers
Expand Down Expand Up @@ -104,6 +125,11 @@ An array-based representation for points and tangent vectors on the
product manifold. `data` contains underlying representation of points
arranged according to `TRanges` and `TSizes` from `shape`.
Internal views for each specific sub-point are created and stored in `parts`.

!!! note

Usage of this type has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
struct ProductArray{
TM<:ShapeSpecification,
Expand Down Expand Up @@ -182,6 +208,11 @@ corresponds to array representations expected by `Sphere(2)` and `Euclidean(2)`.

Next, the desired point on the product manifold can be obtained by calling
`Manifolds.prod_point(Mshape, [1.0, 0.0, 0.0], [-3.0, 2.0])`.

!!! note

Usage of this type has been deprecated. Please switch to [`ProductRepr`](@ref)
as a representation of points and tangent vectors on product manifolds.
"""
function prod_point(M::ShapeSpecification, pts...)
data = mapreduce(vcat, pts) do pt
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include("utils.jl")
@testset "Ambiguities" begin
# TODO: reduce the number of ambiguities for Julia 1.6
if VERSION.prerelease == () && !Sys.iswindows() && VERSION < v"1.6.0"
@test length(Test.detect_ambiguities(ManifoldsBase)) <= 58
@test length(Test.detect_ambiguities(ManifoldsBase)) <= 65
@test length(Test.detect_ambiguities(Manifolds)) == 0
@test length(our_base_ambiguities()) <= 24
else
Expand Down