Skip to content

Commit

Permalink
fix non-vector broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 30, 2019
1 parent bf6be1f commit 3428d61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/larray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Base.BroadcastStyle(::LabelledArrays.LAStyle{T,N,L}, ::LabelledArrays.LAStyle{E,

function Base.similar(bc::Broadcast.Broadcasted{LAStyle{T,N,L}}, ::Type{ElType}) where {T,N,L,ElType}
tmp = similar(Array{ElType},axes(bc))
if axes(bc) != axes(L)
if prod(length.(axes(bc))) != prod(length.(axes(L)))
return tmp
else
return LArray{ElType,N,typeof(tmp),L}(tmp)
Expand Down
12 changes: 6 additions & 6 deletions src/lsliced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end


#####################################
# Array Interface
# Array Interface
# (getindex/getproperty methods are shared with SLArray
#####################################
Base.propertynames(::LArray{T,N,D,S}) where {T,N,D,S<:Tuple{Syms1,Syms2}} where {Syms1,Syms2} = Syms1, Syms2
Expand Down Expand Up @@ -79,7 +79,7 @@ end
#####################################
# Broadcast
#####################################
LAStyle{T,N,Syms}(x::Val{2}) where {T,N,Syms<:Tuple} = LAStyle{T,N,Syms}()
LAStyle{T,N,Syms}(x::Val{i}) where {T,N,Syms<:Tuple,i} = LAStyle{T,N,Syms}()

"""
@LSliced Eltype Size Names
Expand Down Expand Up @@ -122,16 +122,16 @@ end
# A = @LSliced [1 2; 3 4; 5 6] (:a,:b,:c), (:x, :y)
# dimSymbols(A,1) # (:a, :b, :c)
# """
# dimSymbols(::LArray{T,N,D,Syms}, dim::Int) where
# dimSymbols(::LArray{T,N,D,Syms}, dim::Int) where
# {T,N,D<:AbstractArray{T,N},Syms<:Tuple} = Syms.parameters[dim]

# "returns dimSymbols(,1)"
# rowSymbols(::LArray{T,N,D,Syms}) where
# rowSymbols(::LArray{T,N,D,Syms}) where
# {T,N,D<:AbstractArray{T,N},Syms<:Tuple} = Syms.parameters[1]

# "returns dimSymbols(,2)"
# colSymbols(::LArray{T,N,D,Syms}) where
# colSymbols(::LArray{T,N,D,Syms}) where
# {T,N,D<:AbstractArray{T,N},Syms<:Tuple} = Syms.parameters[2]

symbols(::LArray{T,N,D,Syms}) where
symbols(::LArray{T,N,D,Syms}) where
{rows,cols,T,N,D,Syms<:Tuple{rows,cols}} = rows,cols
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ using StaticArrays
@time begin
@time @testset "SLArrays" begin include("slarrays.jl") end
@time @testset "LArrays" begin include("larrays.jl") end
@time @testset "LSliced" begin include("lsliced.jl") end
@time @testset "SLSliced" begin include("slsliced.jl") end
@time @testset "Display" begin include("display.jl") end
@time @testset "DiffEq" begin include("diffeq.jl") end
#@time @testset "LSliced" begin include("lsliced.jl") end
#@time @testset "SLSliced" begin include("slsliced.jl") end
end

0 comments on commit 3428d61

Please sign in to comment.