From 7a8786539346990f63816efe464a6f51086bff26 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 20 Apr 2018 08:30:32 +0200 Subject: [PATCH] Fix some typos regarding compositions --- src/generic/GenericTypes.jl | 6 +++--- src/generic/Map.jl | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/generic/GenericTypes.jl b/src/generic/GenericTypes.jl index 007a2a5fec..586d053414 100644 --- a/src/generic/GenericTypes.jl +++ b/src/generic/GenericTypes.jl @@ -658,8 +658,8 @@ mutable struct CompositeMap{D, C} <: AbstractAlgebra.Map{D, C, AbstractAlgebra.S map1::AbstractAlgebra.Map map2::AbstractAlgebra.Map - function CompositeMap(map1::AbstractAlgebra.Map{U, C}, map2::AbstractAlgebra.Map{D, U}) where {D, U, C} - return new{D, C}(domain(map2), codomain(map1), map1, map2) + function CompositeMap(map1::AbstractAlgebra.Map{D, U}, map2::AbstractAlgebra.Map{U, C}) where {D, U, C} + return new{D, C}(domain(map1), codomain(map2), map1, map2) end end @@ -699,7 +699,7 @@ mutable struct FunctionalCompositeMap{D, C} <: AbstractAlgebra.Map{D, C, Abstrac fn_cache::Function function FunctionalCompositeMap(map1::Map(AbstractAlgebra.FunctionalMap){U, C}, map2::Map(AbstractAlgebra.FunctionalMap){D, U}) where {D, U, C} - return new{D, C}(domain(map2), codomain(map1), map1, map2) + return new{D, C}(domain(map1), codomain(map2), map1, map2) end end diff --git a/src/generic/Map.jl b/src/generic/Map.jl index 1c897b7aba..ab04e3a11d 100644 --- a/src/generic/Map.jl +++ b/src/generic/Map.jl @@ -18,8 +18,8 @@ set_field!(M, f) = setfield(M, f) # fall back to Julia builtin domain(f::AbstractAlgebra.Map) = get_field(f, :domain) codomain(f::AbstractAlgebra.Map) = get_field(f, :codomain) -function check_composable(a::AbstractAlgebra.Map{U, C}, b::AbstractAlgebra.Map{D, U}) where {C, U, D} - domain(a) != codomain(b) && error("Incompatible maps") +function check_composable(a::AbstractAlgebra.Map{D, U}, b::AbstractAlgebra.Map{U, C}) where {D, U, C} + codomain(a) != domain(b) && error("Incompatible maps") end *(f::Map, g::Map) = compose(f, g) @@ -37,7 +37,7 @@ function (f::CompositeMap{D, C})(a) where {D, C} return f.map2(f.map1(a))::elem_type(C) end -function compose(f::AbstractAlgebra.Map{U, C}, g::AbstractAlgebra.Map{D, U}) where {D, U, C} +function compose(f::AbstractAlgebra.Map{D, U}, g::AbstractAlgebra.Map{U, C}) where {D, U, C} check_composable(f, g) return CompositeMap(f, g) end @@ -74,12 +74,12 @@ function show(io::IO, M::IdentityMap) println(io, domain(M)) end -function compose(f::AbstractAlgebra.Map(AbstractAlgebra.IdentityMap){C, C}, g::AbstractAlgebra.Map{D, C}) where {D, C} +function compose(f::AbstractAlgebra.Map(AbstractAlgebra.IdentityMap){D, D}, g::AbstractAlgebra.Map{C, D}) where {D, C} check_composable(f, g) return g end -function compose(f::AbstractAlgebra.Map{D, C}, g::AbstractAlgebra.Map(AbstractAlgebra.IdentityMap){D, D}) where {D, C} +function compose(f::AbstractAlgebra.Map{D, C}, g::AbstractAlgebra.Map(AbstractAlgebra.IdentityMap){C, C}) where {D, C} check_composable(f, g) return f end