You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/core/time_arrays.jl
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -244,15 +244,15 @@ end
244
244
245
245
function Base.getindex(mat::TimestepMatrix{FixedTimestep{FIRST, STEP, LAST}, T_data, 1}, ts::TimestepValue{T_time}, idx::AnyIndex) where {T_data, FIRST, STEP, LAST, T_time}
246
246
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
247
-
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] +1: view_offset =0
247
+
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] -1: view_offset =0
248
248
t = t - view_offset
249
249
data = mat.data[t, idx]
250
250
_missing_data_check(data, t)
251
251
end
252
252
253
253
function Base.getindex(mat::TimestepMatrix{VariableTimestep{TIMES}, T_data, 1}, ts::TimestepValue{T_time}, idx::AnyIndex) where {T_data, TIMES, T_time}
254
254
t =_get_time_value_position(TIMES, ts)
255
-
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] +1: view_offset =0
255
+
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] -1: view_offset =0
256
256
t = t - view_offset
257
257
data = mat.data[t, idx]
258
258
_missing_data_check(data, t)
@@ -267,15 +267,15 @@ end
267
267
268
268
function Base.getindex(mat::TimestepMatrix{FixedTimestep{FIRST, STEP, LAST}, T_data, 2}, idx::AnyIndex, ts::TimestepValue{T_time}) where {T_data, FIRST, STEP, LAST, T_time}
269
269
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
270
-
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] +1: view_offset =0
270
+
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] -1: view_offset =0
271
271
t = t - view_offset
272
272
data = mat.data[idx, t]
273
273
_missing_data_check(data, t)
274
274
end
275
275
276
276
function Base.getindex(mat::TimestepMatrix{VariableTimestep{TIMES}, T_data, 2}, idx::AnyIndex, ts::TimestepValue{T_time}) where {T_data, TIMES, T_time}
277
277
t =_get_time_value_position(TIMES, ts)
278
-
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] +1: view_offset =0
278
+
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] -1: view_offset =0
279
279
t = t - view_offset
280
280
data = mat.data[idx, t]
281
281
_missing_data_check(data, t)
@@ -306,28 +306,28 @@ end
306
306
307
307
function Base.setindex!(mat::TimestepMatrix{FixedTimestep{FIRST, STEP, LAST}, T_data, 1}, val, ts::TimestepValue{T_time}, idx::AnyIndex) where {T_data, FIRST, STEP, LAST, T_time}
308
308
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
309
-
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] +1: view_offset =0
309
+
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] -1: view_offset =0
310
310
t = t - view_offset
311
311
setindex!(mat.data, val, t, idx)
312
312
end
313
313
314
314
function Base.setindex!(mat::TimestepMatrix{VariableTimestep{TIMES}, T_data, 1}, val, ts::TimestepValue{T_time}, idx::AnyIndex) where {T_data, TIMES, T_time}
315
315
t =_get_time_value_position(TIMES, ts)
316
-
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] +1: view_offset =0
316
+
mat.data isa SubArray ? view_offset = mat.data.indices[1][1] -1: view_offset =0
317
317
t = t - view_offset
318
318
setindex!(mat.data, val, t, idx)
319
319
end
320
320
321
321
function Base.setindex!(mat::TimestepMatrix{FixedTimestep{FIRST, STEP, LAST}, T_data, 2}, val, idx::AnyIndex, ts::TimestepValue{T_time}) where {T_data, FIRST, STEP, LAST, T_time}
322
322
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
323
-
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] +1: view_offset =0
323
+
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] -1: view_offset =0
324
324
t = t - view_offset
325
325
setindex!(mat.data, val, idx, t)
326
326
end
327
327
328
328
function Base.setindex!(mat::TimestepMatrix{VariableTimestep{TIMES}, T_data, 2}, val, idx::AnyIndex, ts::TimestepValue{T_time}) where {T_data, TIMES, T_time}
329
329
t =_get_time_value_position(TIMES, ts)
330
-
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] +1: view_offset =0
330
+
mat.data isa SubArray ? view_offset = mat.data.indices[2][1] -1: view_offset =0
331
331
t = t - view_offset
332
332
setindex!(mat.data, val, idx, t)
333
333
end
@@ -397,7 +397,7 @@ function Base.getindex(arr::TimestepArray{FixedTimestep{FIRST, STEP, LAST}, T_da
397
397
_single_index_check(arr.data, idxs)
398
398
idxs1, ts, idxs2 =split_indices(idxs, ti)
399
399
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
400
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
400
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
401
401
t = t - view_offset
402
402
return arr.data[idxs1..., t, idxs2...]
403
403
end
@@ -406,7 +406,7 @@ function Base.getindex(arr::TimestepArray{VariableTimestep{TIMES}, T_data, N, ti
406
406
_single_index_check(arr.data, idxs)
407
407
idxs1, ts, idxs2 =split_indices(idxs, ti)
408
408
t =_get_time_value_position(TIMES, ts)
409
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
409
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
410
410
t = t - view_offset
411
411
return arr.data[idxs1..., t, idxs2...]
412
412
end
@@ -441,7 +441,7 @@ function Base.setindex!(arr::TimestepArray{FixedTimestep{FIRST, STEP, LAST}, T_d
441
441
_single_index_check(arr.data, idxs)
442
442
idxs1, ts, idxs2 =split_indices(idxs, ti)
443
443
t =_get_time_value_position([FIRST:STEP:LAST...], ts)
444
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
444
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
445
445
t = t - view_offset
446
446
setindex!(arr.data, val, idxs1..., t, idxs2...)
447
447
end
@@ -450,7 +450,7 @@ function Base.setindex!(arr::TimestepArray{VariableTimestep{TIMES}, T_data, N, t
450
450
_single_index_check(arr.data, idxs)
451
451
idxs1, ts, idxs2 =split_indices(idxs, ti)
452
452
t =_get_time_value_position(TIMES, ts)
453
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
453
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
454
454
t = t - view_offset
455
455
setindex!(arr.data, val, idxs1..., t, idxs2...)
456
456
end
@@ -475,15 +475,15 @@ end
475
475
function Base.getindex(arr::TimestepArray{FixedTimestep{FIRST, STEP, LAST}, T_data, N, ti}, idxs::Union{Array{TimestepValue{T_time},1}, AnyIndex}...) where {T_data, N, ti, FIRST, STEP, LAST, T_time}
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
478
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
479
479
ts_idxs = ts_idxs .- view_offset
480
480
return arr.data[idxs1..., ts_idxs, idxs2...]
481
481
end
482
482
483
483
function Base.getindex(arr::TimestepArray{VariableTimestep{TIMES}, T_data, N, ti}, idxs::Union{Array{TimestepValue{T_time},1}, AnyIndex}...) where {T_data, N, ti, TIMES, T_time}
484
484
idxs1, ts_array, idxs2 =split_indices(idxs, ti)
485
485
ts_idxs =_get_ts_indices(ts_array, TIMES)
486
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
486
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
487
487
ts_idxs = ts_idxs .- view_offset
488
488
return arr.data[idxs1..., ts_idxs, idxs2...]
489
489
end
@@ -497,15 +497,15 @@ end
497
497
function Base.setindex!(arr::TimestepArray{FixedTimestep{FIRST, STEP, LAST}, T_data, N, ti}, vals, idxs::Union{Array{TimestepValue{T_time},1}, AnyIndex}...) where {T_data, N, ti, FIRST, STEP, LAST, T_time}
function Base.setindex!(arr::TimestepArray{VariableTimestep{TIMES}, T_data, N, ti}, vals, idxs::Union{Array{TimestepValue{T_time},1}, AnyIndex}...) where {T_data, N, ti, TIMES, T_time}
506
506
idxs1, ts_array, idxs2 =split_indices(idxs, ti)
507
507
ts_idxs =_get_ts_indices(ts_array, TIMES)
508
-
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] +1: view_offset =0
508
+
arr.data isa SubArray ? view_offset = arr.data.indices[ti][1] -1: view_offset =0
0 commit comments