-
Notifications
You must be signed in to change notification settings - Fork 71
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
Make Map into a type #133
Labels
Milestone
Comments
I think maps should work like this: m=Map(Interval(),Line())
m(x) # replaces fromcanonical(Line(),x)
m'(x) # replaces fromcanonicalD(Line(),x)
inv(m)(x) # replaces tocanonical(Line(),x)
inv(m)'(x) # replaces tocanonicalD(Line(),x) |
dlfivefifty
changed the title
Split Domains to Map, CanonicalDomain and MappedDomain?
Make Map into a type
May 24, 2015
I think # represent map from type T to type V
abstract type Map{T, V} <: Callable end
# x -> c
struct ConstantMap{T} <: Map{T,T}
c::T
end
(f::ConstantMap)(x) = f.c
# A*x + b
struct AffineMap{T, V} <: Map{T, V}
A::T
b::V
end
(f::AffineMap)(x) = f.A*x + f.b
inv(f::AffineMap) = AffineMap(inv(f.A), f.A \ f.b)
ctranspose(f::AffineMap) = ConstantMap(f.A) # derivative
# represent (az + b)/(cz + d)
struct MobiusMap{T} <: Map{T,T}
a::T
b::T
c::T
d::T
end
∘(m::MobiusMap, a::AffineMap) = MobiusMap(m.a*a.A , m.b + m.a*a.b, m.c*a.A, m.d + m.c*a.b)
# default maps
Map(d1::Segment, d2::Segment) = AffineMap((d2.b - d2.a)/(d1.b - d1.a) , (d1.b*d2.a - d2.b*d1.a)/(d1.b - d1.a))
Map(d1::Circle, d2::Circle) = AffineMap( ... )
function Map(d1::PeriodicInterval, d2::Line)
if d1 == Circle()
MobiusMap(-im, im, 1, 1)
else
m1 = Map(d1, Interval())
Map(Interval(), Circle()) ∘ m1
end
end |
@marcusdavidwebb @daanhb this is related to our conversation at OPSFA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should domains be more systematic, with canonical domains and maps? I'm thinking something like this
The text was updated successfully, but these errors were encountered: