Skip to content

Commit

Permalink
Fix to assoc parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pw0908 committed Nov 12, 2024
1 parent 011ac18 commit 965b78d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/database/params/paramvectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ end
Base.eltype(m::AssocView{T}) where T = T

#returns the absolute index. that is. it is directly indexable by the parent array
function validindex(m::AssocView{T},i::Int,j::Int,symmetric = true) where T
if m.at[1] > m.at[2] && symmetric
i,j = j,i
function validindex(m::AssocView{T},i::Int,j::Int,symmetric = false) where T
if m.at[1] == m.at[2] || symmetric
i,j = minmax(i,j)
end
indices = view(m.values.inner_indices,m.indices)
@inbounds begin
Expand All @@ -282,7 +282,7 @@ function Base.getindex(m::AssocView{T},i::Int,j::Int) where T
return m.values.values[idx]
end

function Base.setindex!(m::AssocView{T},value,a::Int,b::Int,symmetric = true) where T
function Base.setindex!(m::AssocView{T},value,a::Int,b::Int,symmetric = false) where T
idx = validindex(m,a,b)
iszero(idx) && throw(BoundsError())
vals = m.values.values
Expand Down

0 comments on commit 965b78d

Please sign in to comment.