Skip to content

Commit 32e0153

Browse files
authored
Merge pull request SciML#259 from Vilin97/use-lighter-types
Change Int64 to Int8 in nums_neighbors
2 parents 58881b0 + 2f12e8b commit 32e0153

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/spatial/topology.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct CartesianGridRej{N, T}
109109
dims::NTuple{N, Int}
110110

111111
"number of neighbor for each site"
112-
nums_neighbors::Vector{Int}
112+
nums_neighbors::Vector{Int8}
113113
CI::CartesianIndices{N, T}
114114
LI::LinearIndices{N, T}
115115

@@ -127,7 +127,7 @@ function CartesianGridRej(dims::Tuple)
127127
CI = CartesianIndices(dims)
128128
LI = LinearIndices(dims)
129129
offsets = potential_offsets(dim)
130-
nums_neighbors = [count(x -> x + CI[site] in CI, offsets) for site in 1:prod(dims)]
130+
nums_neighbors = Int8[count(x -> x + CI[site] in CI, offsets) for site in 1:prod(dims)]
131131
CartesianGridRej(dims, nums_neighbors, CI, LI, offsets)
132132
end
133133
CartesianGridRej(dims) = CartesianGridRej(Tuple(dims))
@@ -147,7 +147,7 @@ end
147147
# neighbor sampling is iterator-based
148148
struct CartesianGridIter{N, T}
149149
dims::NTuple{N, Int}
150-
nums_neighbors::Vector{Int}
150+
nums_neighbors::Vector{Int8}
151151
CI::CartesianIndices{N, T}
152152
LI::LinearIndices{N, T}
153153
offsets::Vector{CartesianIndex{N}}
@@ -157,7 +157,7 @@ function CartesianGridIter(dims::Tuple)
157157
CI = CartesianIndices(dims)
158158
LI = LinearIndices(dims)
159159
offsets = potential_offsets(dim)
160-
nums_neighbors = [count(x -> x + CI[site] in CI, offsets) for site in 1:prod(dims)]
160+
nums_neighbors = Int8[count(x -> x + CI[site] in CI, offsets) for site in 1:prod(dims)]
161161
CartesianGridIter(dims, nums_neighbors, CI, LI, offsets)
162162
end
163163
CartesianGridIter(dims) = CartesianGridIter(Tuple(dims))

0 commit comments

Comments
 (0)