Comments (10)
This may be related.
#17
It seems that only linear continuum indices is supported.
from continuumarrays.jl.
The getindex
approach is a workaround.
julia> g=getindex.((f,),f)
getindex.(Tuple{QuasiArrays.BroadcastQuasiVector{Float64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, Inclusion{Float64, IntervalSets.ClosedInterval{Int64}}, Base.RefValue{Val{2}}}}}, (Inclusion(0..1)) .^ 2)
julia> g[0.5]
0.0625
So we can do this:
julia> Base.getindex(A::AbstractQuasiArray,B::AbstractQuasiArray) = getindex.((A,),B);
g=f[f];
g[0.5]
0.0625
I'm not sure about the efficiency.
from continuumarrays.jl.
It looks like the issue is bounds-checking. That is, we want issubset(Inclusion(0..1).^2, Inclusion(0..1))
to return true.
We could probably do something like:
issubset(a::BroadcastQuasiVector{<:Any, typeof(Base.literal_pow), <:Tuple{Base.RefValue{typeof(^)}, Any, Base.RefValue{Val{2}}}}, b::Inclusion{<:Any,<:ClosedInterval}) = issubset(a.args[1], Inclusion(sqrt(max(0,first(b)), sqrt(max(0,last(b))))
from continuumarrays.jl.
Did that "affine transform" issue use the same workflow? If so, we may cover a few other basic functions.
from continuumarrays.jl.
Actually, we pass through a call to union
, which is what we use to determine the "range":
ContinuumArrays.jl/src/maps.jl
Line 20 in 5fa44ca
ContinuumArrays.jl/src/maps.jl
Line 103 in 5fa44ca
from continuumarrays.jl.
Adding a subtype of Map
should solve my problem. However I would like generic continuum indices to work as well. One reason is that the expression f[f]
is easy to understand. Another reason is that creating and maintaining interfaces for all known maps is exhaustive.
from continuumarrays.jl.
Agreed. Try my suggestion?
from continuumarrays.jl.
Do you mean the issubset
or the union
?
For generic quasivector, the range is usually hard to tell. I prefer passing the responsibility of boundschecking to users.
Although an unknown interval which may exceed bounds makes the whole thing bad-defined, in practice, we always evaluate a finite number of values and all variables reduce to finite vectors which can be boundschecked as usual.
Checking bounds for the whole interval does reduce the cost of checking every value later. I agree we can have this feature for common functions.
My thought is to let issubset
to return true
as default and override it for specific cases. I guess unsafe_view
on continuumarrays won't cause memory problems.
from continuumarrays.jl.
What's the disadvantage of unsafe_view
?
from continuumarrays.jl.
Right, Base.unsafe_getindex
or unsafe_view
might be a good interface
from continuumarrays.jl.
Related Issues (20)
- simplify macro does not permit templating? HOT 1
- How to handle Linear operators / functionals? HOT 4
- export diagonal?
- Continous Linear Algebra HOT 1
- Integral of (basis) functions HOT 1
- Expansion short cut HOT 1
- Split out transform from factorize
- Derivative -> Diff? HOT 2
- Inner product between bases on different grids, basis transforms HOT 1
- Support syntax for kernels HOT 14
- Plot quasivector HOT 5
- [FEATURE]: Issue Template
- [FEATURE]: Pull Request Template
- Support (T/T) \ f for expansions HOT 1
- Product of QuasiDiagonals fails
- Support Plotting HOT 10
- Rename or don't export `grid` HOT 1
- Use bases for operations on AbstractQuasiVector
- Computing bounds on a function over an interval HOT 4
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 continuumarrays.jl.