Comments (5)
Hmm, the IndexLinear
stuff is a bit ill-defined for QuasiArrays.jl. So I'm wondering if this should just be removed as a concept?
Probably for now we just need to add an error_if_canonical_getindex
overload
from continuumarrays.jl.
Actually, I'd be happy if I could just evaluate any function, however complicated, as long as it's defined on the Inclusion
and returns a scalar. It feels I too often have to second-guess what QuasiBroadcastArray
can handle.
For full context: to implement absorbing boundary conditions, I use a imaginary or complex potential at the far end of the box. It's a simple function that smoothly goes from zero to large imaginary part.
Here is a MWE (depends on Elliptic.jl):
using CompactBases
using IntervalSets
import Elliptic.Jacobi: cn
struct ComplexAbsorbingPotential{T,I}
Emin::T
kmin::T
δ::T
Δr::T
interval::I
end
capx(cap::ComplexAbsorbingPotential) =
r -> 2cap.δ*cap.kmin*r
capy(cap::ComplexAbsorbingPotential) =
x -> -im*cap.Emin*√(cn(x/√2,1/2)^(-4) - 1)
R = StaggeredFiniteDifferences(100, 0.5)
cap = ComplexAbsorbingPotential(1.0, √2, 0.1, 9.27037338650686,
40.97962661349314..50.25)
r = axes(R,1)
i = cap.interval
a,b = i.left,i.right
# Translate cap to interval
x = capx(cap).(r .- a)
v = (a .< r .≤ b) .* capy(cap).(x)
R'*QuasiDiagonal(v)*R
which fails with an error similar to the above.
EDIT: Yet another example:
using IntervalSets
using QuasiArrays
using ContinuumArrays
x = Inclusion(0.0..20.0)
exp.(x)[2.0] # Works
exp.(-x)[2.0] # Crashes
exp.(x.^2)[2.0] # Crashes
exp.(-x.^2/(20/2))[2.0] # Crashes
from continuumarrays.jl.
Super, thanks! I was just about to push my own fix, but this looks better.
from continuumarrays.jl.
Can you see if that branch fixes all the issues?
from continuumarrays.jl.
Indeed, it works perfectly!
from continuumarrays.jl.
Related Issues (20)
- simplify macro does not permit templating? HOT 1
- How to handle Linear operators / functionals? HOT 4
- export diagonal?
- Continuum indices HOT 10
- 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.