Skip to content

Commit 05475c1

Browse files
Drop inds element
1 parent 544a082 commit 05475c1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/traces.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,18 @@ end
166166

167167
struct Traces{names,T,N,E} <: AbstractTraces{names,E}
168168
traces::T
169-
inds::NamedTuple{names,NTuple{N,Int}}
170169
end
171170

172171
function Adapt.adapt_structure(to, t::Traces{names,T,N,E}) where {names,T,N,E}
173172
data = Adapt.adapt_structure(to, t.traces)
174173
# FIXME: `E` is not adapted here
175-
Traces{names,typeof(data),length(names),E}(data, t.inds)
174+
Traces{names,typeof(data),length(names),E}(data)
176175
end
177176

178177
function Traces(; kw...)
179178
data = map(x -> convert(AbstractTrace, x), values(kw))
180179
names = keys(data)
181-
inds = NamedTuple(k => i for (i, k) in enumerate(names))
182-
Traces{names,typeof(data),length(names),typeof(values(data))}(data, inds)
180+
Traces{names,typeof(data),length(names),typeof(values(data))}(data)
183181
end
184182

185183

@@ -223,30 +221,26 @@ end
223221
function Base.:(+)(t1::AbstractTraces{k1,T1}, t2::AbstractTraces{k2,T2}) where {k1,k2,T1,T2}
224222
ks = (k1..., k2...)
225223
ts = (t1, t2)
226-
inds = (; (k => 1 for k in k1)..., (k => 2 for k in k2)...)
227-
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts, inds)
224+
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts)
228225
end
229226

230227
function Base.:(+)(t1::AbstractTraces{k1,T1}, t2::Traces{k2,T,N,T2}) where {k1,T1,k2,T,N,T2}
231228
ks = (k1..., k2...)
232229
ts = (t1, t2.traces...)
233-
inds = merge(NamedTuple(k => 1 for k in k1), map(v -> v + 1, t2.inds))
234-
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts, inds)
230+
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts)
235231
end
236232

237233

238234
function Base.:(+)(t1::Traces{k1,T,N,T1}, t2::AbstractTraces{k2,T2}) where {k1,T,N,T1,k2,T2}
239235
ks = (k1..., k2...)
240236
ts = (t1.traces..., t2)
241-
inds = merge(t1.inds, (; (k => length(ts) for k in k2)...))
242-
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts, inds)
237+
Traces{ks,typeof(ts),length(ks),Tuple{T1.types...,T2.types...}}(ts)
243238
end
244239

245240
function Base.:(+)(t1::Traces{k1,T1,N1,E1}, t2::Traces{k2,T2,N2,E2}) where {k1,T1,N1,E1,k2,T2,N2,E2}
246241
ks = (k1..., k2...)
247242
ts = (t1.traces..., t2.traces...)
248-
inds = merge(t1.inds, map(x -> x + length(t1.traces), t2.inds))
249-
Traces{ks,typeof(ts),length(ks),Tuple{E1.types...,E2.types...}}(ts, inds)
243+
Traces{ks,typeof(ts),length(ks),Tuple{E1.types...,E2.types...}}(ts)
250244
end
251245

252246
Base.size(t::Traces) = (mapreduce(length, min, t.traces),)

0 commit comments

Comments
 (0)