Skip to content

Commit 44ad0cd

Browse files
committed
Put everything under _map to avoid ambiguities
1 parent b3142f6 commit 44ad0cd

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

src/transform/ardtransform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dim(t::ARDTransform) = length(t.v)
2424
(t::ARDTransform)(x::Real) = first(t.v) * x
2525
(t::ARDTransform)(x) = t.v .* x
2626

27-
Base.map(t::ARDTransform, x::AbstractVector{<:Real}) = t.v' .* x
27+
_map(t::ARDTransform, x::AbstractVector{<:Real}) = t.v' .* x
2828
_map(t::ARDTransform, x::ColVecs) = ColVecs(t.v .* x.X)
2929
_map(t::ARDTransform, x::RowVecs) = RowVecs(t.v' .* x.X)
3030

src/transform/chaintransform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Base.:∘(tc::ChainTransform, t::Transform) = ChainTransform(vcat(t, tc.transfor
2727

2828
(t::ChainTransform)(x) = foldl((x, t) -> t(x), t.transforms; init=x)
2929

30-
function Base.map(t::ChainTransform, x::AbstractVector)
30+
function _map(t::ChainTransform, x::AbstractVector)
3131
return foldl((x, t) -> map(t, x), t.transforms; init=x)
3232
end
3333

src/transform/functiontransform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end
1515

1616
(t::FunctionTransform)(x) = t.f(x)
1717

18-
Base.map(t::FunctionTransform, x::AbstractVector{<:Real}) = map(t.f, x)
18+
_map(t::FunctionTransform, x::AbstractVector{<:Real}) = map(t.f, x)
1919
_map(t::FunctionTransform, x::ColVecs) = ColVecs(mapslices(t.f, x.X; dims=1))
2020
_map(t::FunctionTransform, x::RowVecs) = RowVecs(mapslices(t.f, x.X; dims=2))
2121

src/transform/lineartransform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ end
2727
(t::LinearTransform)(x::Real) = vec(t.A * x)
2828
(t::LinearTransform)(x::AbstractVector{<:Real}) = t.A * x
2929

30-
Base.map(t::LinearTransform, x::AbstractVector{<:Real}) = ColVecs(t.A * x')
30+
_map(t::LinearTransform, x::AbstractVector{<:Real}) = ColVecs(t.A * x')
3131
_map(t::LinearTransform, x::ColVecs) = ColVecs(t.A * x.X)
3232
_map(t::LinearTransform, x::RowVecs) = RowVecs(x.X * t.A')
3333

src/transform/scaletransform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set!(t::ScaleTransform,ρ::Real) = t.s .= [ρ]
1919

2020
(t::ScaleTransform)(x) = first(t.s) .* x
2121

22-
Base.map(t::ScaleTransform, x::AbstractVector{<:Real}) = first(t.s) .* x
22+
_map(t::ScaleTransform, x::AbstractVector{<:Real}) = first(t.s) .* x
2323
_map(t::ScaleTransform, x::ColVecs) = ColVecs(first(t.s) .* x.X)
2424
_map(t::ScaleTransform, x::RowVecs) = RowVecs(first(t.s) .* x.X)
2525

src/transform/transform.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include("selecttransform.jl")
66
include("chaintransform.jl")
77

88

9-
Base.map(t::Transform, x::Union{ColVecs, RowVecs}) = _map(t, x)
9+
Base.map(t::Transform, x::AbstractVector) = _map(t, x)
1010

1111
"""
1212
IdentityTransform()
@@ -16,7 +16,6 @@ Return exactly the input
1616
struct IdentityTransform <: Transform end
1717

1818
(t::IdentityTransform)(x) = x
19-
Base.map(::IdentityTransform, x::AbstractVector) = x
2019
_map(::IdentityTransform, x::AbstractVector) = x
2120

2221
### TODO Maybe defining adjoints could help but so far it's not working

0 commit comments

Comments
 (0)