Comments (3)
The second case seems to trigger this fallback:
Tuples are the default because it is the only safe choice. The reason the fallback is triggered is that [2,3]
is not (yet) recognized as a Domain, it is only converted to a WrappedDomain
later by the TupleProductDomain
constructor. A solution may be to write instead:
ProductDomain(domains...) = _ProductDomain(map(Domain, domains)...)
_ProductDomain(domains...) = TupleProductDomain(domains...)
_ProductDomain(domains::VcatDomainElement...) = VcatDomain(domains...)
?
Perhaps conversion to a wrapped domain can also be avoided, but that is what currently happens anyway. An alternative may be to improve the logic of the ProductDomain
constructor a bit and make it more robust.
from domainsets.jl.
I don't really need this yet so no rush, but perhaps when it comes up I can have a go and remove the need for WrappedDomain
by making Domain
and "interface".
from domainsets.jl.
Meanwhile I checked and the "fix" above seems to work at least for the example you gave.
More generally, Domain
is largely an interface already but not everywhere. In this case, for future reference, there are at least two issues here:
- I've often used
convert(Domain{T}, d)
as a generic way to ensure that the domaind
actually has element typeT
, for example if the user has specified aT
type in some concrete domain constructor. Ifd
is not aDomain
, this is where it ends up being wrapped (perhaps needlessly). However, it would be odd ifconvert(Domain{T}, d)
returns something that is not actually a subtype ofDomain
, so we may want to use a different syntax for this purpose, so that anArray{T}
can remain anArray{T}
. And perhaps so that anArray{S}
is converted to anArray{T}
. - The
VcatDomain
assumes that the member domains have adimension
. It can then figure out how to efficiently go back and forth between static vectors and the elements of the member domains with the right size (e.g. (1,2,2) for a product of a univariate and two 2D-domains into a 5DVcatDomain
.) The logic of thedimension
function needs to be expanded somewhat to deal with non-Domain arguments, perhaps by looking at theeltype
. Perhaps the name is too generic for that purpose.
So for these two reasons it is currently not possible to avoid the wrapping of the array.
from domainsets.jl.
Related Issues (20)
- More Spaces HOT 18
- Center for HyperRectangle? HOT 4
- Should boundary(::Rectangle) use simpler types? HOT 2
- Failure on julia master `Method overwriting is not permitted during Module precompile.` HOT 1
- Precompiling ParameterEstimation fails HOT 2
- Hashes of domains should be consistent with equality HOT 3
- Getting the domain/support of objects, and domain type hierarchy HOT 61
- Support constructors along with `convert` HOT 3
- arithmetic operations with broadcasting
- package extensions and interoperability with different domain types HOT 1
- Roadmap for future development of DomainSets HOT 3
- A confusing bug HOT 9
- VcatDomain(ℝ, ℕ) causes MethodError HOT 2
- Removing points from interval HOT 3
- Depend on EltypeExtensions.jl? HOT 6
- Triangles? HOT 1
- Add Makie extension? HOT 3
- Fix codecov
- `RealNumbers` vs `RealLine` HOT 3
- Allow Makie v0.21 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from domainsets.jl.