Skip to content

Commit 497a2e9

Browse files
Merge pull request #125 from thomvet/thomvet-patch-1
Removes allocations with get_tmp that occur in some cases
2 parents 9e3fea0 + ed86553 commit 497a2e9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name = "LabelledArrays"
22
uuid = "2ee39098-c373-598a-b85f-a56591580800"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "1.11.1"
4+
version = "1.11.2"
55

66
[deps]
77
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
88
ArrayInterfaceStaticArrays = "b0d46f97-bff5-4637-a19a-dd75974142cd"
99
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
10+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1011
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1112
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
1213
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
@@ -17,6 +18,7 @@ RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
1718
ArrayInterfaceCore = "0.1.13"
1819
ArrayInterfaceStaticArrays = "0.1"
1920
ChainRulesCore = "1"
21+
ForwardDiff = "0.10.3"
2022
MacroTools = "0.5"
2123
PreallocationTools = "0.4"
2224
RecursiveArrayTools = "2"

src/LabelledArrays.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module LabelledArrays
22

33
using LinearAlgebra, StaticArrays, ArrayInterfaceCore
4-
import RecursiveArrayTools, PreallocationTools
4+
import RecursiveArrayTools, PreallocationTools, ForwardDiff
55

66
include("slarray.jl")
77
include("larray.jl")
@@ -65,7 +65,8 @@ end
6565
ArrayInterfaceCore.can_setindex(::Type{<:SLArray}) = false
6666

6767
function PreallocationTools.get_tmp(dc::PreallocationTools.DiffCache,
68-
u::LArray{T, N, D, Syms}) where {T, N, D, Syms}
68+
u::LArray{T, N, D, Syms}) where {T <: ForwardDiff.Dual,
69+
N, D, Syms}
6970
nelem = div(sizeof(T), sizeof(eltype(dc.dual_du))) * length(dc.du)
7071
if nelem > length(dc.dual_du)
7172
PreallocationTools.enlargedualcache!(dc, nelem)

0 commit comments

Comments
 (0)