File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
name = " AbstractTensors"
2
2
uuid = " a8e43f4a-99b7-5565-8bf1-0165161caaea"
3
3
authors = [" Michael Reed" ]
4
- version = " 0.5.5 "
4
+ version = " 0.5.6 "
5
5
6
6
[deps ]
7
7
Random = " 9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Original file line number Diff line number Diff line change 336
336
end
337
337
end
338
338
339
+ # Diff is slightly different
340
+ @inline LinearAlgebra. diff (a:: TupleVector{N} ; dims= Val (1 )) where N = _diff (Val (N),a,dims)
341
+
342
+ @inline function _diff (sz:: Val , a:: TupleVector , D:: Int )
343
+ _diff (sz,a,Val (D))
344
+ end
345
+ @generated function _diff (:: Val{N} , a:: TupleVector , :: Val{1} ) where N
346
+ Snew = N- 1
347
+ exprs = Array {Expr} (undef, Snew)
348
+ for i1 = Base. product (1 : Snew)
349
+ i2 = copy ([i1... ])
350
+ i2[1 ] = i1[1 ] + 1
351
+ exprs[i1... ] = :(a[$ (i2... )] - a[$ (i1... )])
352
+ end
353
+ return quote
354
+ @_inline_meta
355
+ elements = tuple ($ (exprs... ))
356
+ @inbounds return similar_type (a, eltype (elements), Val ($ Snew))(elements)
357
+ end
358
+ end
359
+
339
360
# Values
340
361
341
362
struct Values{N,T} <: TupleVector{N,T}
You can’t perform that action at this time.
0 commit comments