|
1 | 1 | module PreallocationTools
|
2 | 2 |
|
3 |
| -using ForwardDiff, ArrayInterface, LabelledArrays, Adapt |
| 3 | +using ForwardDiff, ArrayInterfaceCore, LabelledArrays, Adapt |
4 | 4 |
|
5 | 5 | struct DiffCache{T<:AbstractArray, S<:AbstractArray}
|
6 | 6 | du::T
|
7 | 7 | dual_du::S
|
8 | 8 | end
|
9 | 9 |
|
10 | 10 | function DiffCache(u::AbstractArray{T}, siz, chunk_sizes) where {T}
|
11 |
| - x = adapt(ArrayInterface.parameterless_type(u), zeros(T, prod(chunk_sizes .+ 1)*prod(siz))) |
| 11 | + x = adapt(ArrayInterfaceCore.parameterless_type(u), zeros(T, prod(chunk_sizes .+ 1)*prod(siz))) |
12 | 12 | DiffCache(u, x)
|
13 | 13 | end
|
14 | 14 |
|
@@ -40,23 +40,23 @@ function get_tmp(dc::DiffCache, u::T) where T<:ForwardDiff.Dual
|
40 | 40 | if nelem > length(dc.dual_du)
|
41 | 41 | enlargedualcache!(dc, nelem)
|
42 | 42 | end
|
43 |
| - ArrayInterface.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
| 43 | + ArrayInterfaceCore.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
44 | 44 | end
|
45 | 45 |
|
46 | 46 | function get_tmp(dc::DiffCache, u::AbstractArray{T}) where T<:ForwardDiff.Dual
|
47 | 47 | nelem = div(sizeof(T), sizeof(eltype(dc.dual_du)))*length(dc.du)
|
48 | 48 | if nelem > length(dc.dual_du)
|
49 | 49 | enlargedualcache!(dc, nelem)
|
50 | 50 | end
|
51 |
| - ArrayInterface.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
| 51 | + ArrayInterfaceCore.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
52 | 52 | end
|
53 | 53 |
|
54 | 54 | function get_tmp(dc::DiffCache, u::LabelledArrays.LArray{T,N,D,Syms}) where {T,N,D,Syms}
|
55 | 55 | nelem = div(sizeof(T), sizeof(eltype(dc.dual_du)))*length(dc.du)
|
56 | 56 | if nelem > length(dc.dual_du)
|
57 | 57 | enlargedualcache!(dc, nelem)
|
58 | 58 | end
|
59 |
| - _x = ArrayInterface.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
| 59 | + _x = ArrayInterfaceCore.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem))) |
60 | 60 | LabelledArrays.LArray{T,N,D,Syms}(_x)
|
61 | 61 | end
|
62 | 62 |
|
|
0 commit comments