Skip to content

Commit

Permalink
refactor(src): rename linkedlist.jl to common_datatypes.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Nov 6, 2024
1 parent 4e51849 commit 71f7bf4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Stuffing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export QTrees, getshift, getcenter, setshift!, setcenter!, outofbounds, outofker
dynamiccollisions, partialcollisions, totalcollisions, collision, findroom_uniform, findroom_gathering,
DynamicColliders, locate!, linked_spacial_qtree, hash_spacial_qtree
export Trainer, train!, fit!, Momentum, SGD
include("linkedlist.jl")
include("common_datatypes.jl")
include("qtrees.jl")
include("fit.jl")
using .QTrees
Expand Down
6 changes: 3 additions & 3 deletions src/linkedlist.jl → src/common_datatypes.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module LinkedList
export DoubleList, ListNode, movetofirst!, IntMap, next, prev, value, setvalue!, ishead, istail, seek_head, seek_tail
module CommonDatatypes
export DoubleList, ListNode, IntMap, movetofirst!, next, prev, value, setvalue!, ishead, istail, seek_head, seek_tail
mutable struct ListNode{T}
value::T
prev::ListNode{T}
Expand Down Expand Up @@ -137,11 +137,11 @@ function collect!(filter, l::DoubleList, collection, firstn)
end
Base.collect(l::DoubleList{T}, args...) where T = collect!(l, Vector{T}(), args...)
Base.collect(filter, l::DoubleList{T}, args...) where T = collect!(filter, l, Vector{T}(), args...)

struct IntMap{T}
map::T
end
Base.haskey(im::IntMap, key) = isassigned(im.map, key)
Base.getindex(im::IntMap, ind...) = getindex(im.map, ind...)
Base.setindex!(im::IntMap, v, ind...) = setindex!(im.map, v, ind...)

end
6 changes: 3 additions & 3 deletions src/fit_helper.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ..LinkedList
using ..CommonDatatypes
abstract type AbstractOptimiser end
function apply(o::AbstractOptimiser, x, Δ) end
function apply!(o::AbstractOptimiser, x, Δ)
Expand Down Expand Up @@ -95,8 +95,8 @@ function Base.push!(lru::LRU, v)
end
v
end
collect!(lru::LRU, args...) = LinkedList.collect!(lru.list, args...)
Base.collect(lru::LRU, args...) = LinkedList.collect(lru.list, args...)
collect!(lru::LRU, args...) = CommonDatatypes.collect!(lru.list, args...)
Base.collect(lru::LRU, args...) = CommonDatatypes.collect(lru.list, args...)
Base.broadcastable(lru::LRU) = Ref(lru)

intlru(n) = LRU{Int}(IntMap(Vector{ListNode{Int}}(undef, n)))
Expand Down
2 changes: 1 addition & 1 deletion src/qtrees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export AbstractStackedQTree, StackedQTree, ShiftedQTree, buildqtree!,
kernelsize, place!, overlap, overlap!, decode, charimage

using Random
using ..LinkedList
using ..CommonDatatypes

const PERM4 = ((0, 1, 2, 3), (0, 1, 3, 2), (0, 2, 1, 3), (0, 2, 3, 1), (0, 3, 1, 2), (0, 3, 2, 1),
(1, 0, 2, 3), (1, 0, 3, 2), (1, 2, 0, 3), (1, 2, 3, 0), (1, 3, 0, 2), (1, 3, 2, 0),
Expand Down

0 comments on commit 71f7bf4

Please sign in to comment.