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

get_vectorsnot working on a (nested) Power manifold of a product manifold. #199

Closed
kellertuer opened this issue Aug 7, 2024 · 6 comments

Comments

@kellertuer
Copy link
Member

Consider

using Manifolds
S = Sphere(2) × ℝ^1
N = PowerManifold(S, NestedPowerRepresentation(), 2)
q = rand(N)
C = get_basis(N, q, DefaultOrthonormalBasis())
get_vectors(N, q, C)

This throws an error

ERROR: MethodError: no method matching iterate(::ProductBasisData{Tuple{CachedBasis{ℝ, DefaultOrthonormalBasis{…}, Vector{…}}, CachedBasis{ℝ, DefaultOrthonormalBasis{…}, Vector{…}}}})

Closest candidates are:
  iterate(::Core.Compiler.InstructionStream, ::Int64)
   @ Base show.jl:2778
  iterate(::Core.Compiler.InstructionStream)
   @ Base show.jl:2778
  iterate(::LazyString)
   @ Base strings/lazy.jl:94
  ...

Stacktrace:
 [1] _get_vectors(M::PowerManifold{ℝ, ProductManifold{…}, Tuple{…}, NestedPowerRepresentation}, p::Vector{ArrayPartition{…}}, B::CachedBasis{ℝ, DefaultOrthonormalBasis{…}, PowerBasisData{…}})
   @ ManifoldsBase ~/Repositories/Julia/ManifoldsBase.jl/src/PowerManifold.jl:828
 [2] get_vectors(M::PowerManifold{ℝ, ProductManifold{…}, Tuple{…}, NestedPowerRepresentation}, p::Vector{ArrayPartition{…}}, B::CachedBasis{ℝ, DefaultOrthonormalBasis{…}, PowerBasisData{…}})
   @ ManifoldsBase ~/Repositories/Julia/ManifoldsBase.jl/src/bases.jl:821
 [3] top-level scope
   @ REPL[7]:1
Some type information was truncated. Use `show(err)` to see complete types.

So in line

for v in b_i.data

it seems that the ProdyctBasisData is not iterable. I could fix that with writing instead of

        for v in b_i.data

just

        for v in get_vectors(M.manifold, p_i, b_i)

but that materialises all vectors here. So what is the right fix for this?

@mateuszbaran
Copy link
Member

My quick guess is than for v in get_vectors(M.manifold, p_i, b_i) is fine in this case. Anyway, if you are doing get_vectors on a power manifold, you're doing something extremely sub-optimally anyway.

@kellertuer
Copy link
Member Author

Yes, we are on the way of debugging something and are generating a full matrix representation of some linear operator on a tangent space.

Sure that is not the reasonable final version, but it also should not error ;)

@mateuszbaran
Copy link
Member

If for v in get_vectors(M.manifold, p_i, b_i) works fine then I'm fine with that fix in ManifoldsBase 🙂

@kellertuer
Copy link
Member Author

Ok, I was just not sure about performance, but maybe if one wants all vectors on a power manifold, performance is nothing to worry about any longer anyways (we only needed about 200 vectors or such)

@mateuszbaran
Copy link
Member

For debugging it should be fast enough. In the main computations it shouldn't be used so it being slow doesn't matter.

@kellertuer
Copy link
Member Author

Ok, sure. Then I will do a PR soon with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants