isdual for AbstractTensorMaps#429
Conversation
|
I am not a great fan of calling Firstly, we could have a method: spaces(t::AbstractTensorMap) = (codomain(t)..., map(dual, domain(t))...)and then you can simply use broadcasting to write |
|
Also, in relation to this and #430 , while |
This will be convenient enough for me 👍. Or maybe even better, instead of write a new
It appears to have a simple solution: explicitly define Base.Broadcast.broadcastable(P::ProductSpace) = P.spacesOtherwise it defaults to |
|
Summarizing my earlier comment, I would like something like this: The following also would make sense to me: in Base we often have the pattern |
We do have |
|
Given that we already support Can you implement the necessary functionality for this in the current PR? |
This PR adds a utility function
isdual(x::AbstractTensorMap)that returns a Boolean vector indicating which spaces of a tensor map are dual spaces. For example:It is mainly used to assert that arrows in a network are preserved, which I frequently need to do.
The name of the function can be changed if you feel that
isdualmust return a singleBool. I don't know how to meaningfully test it, either.