JuliaDiff / JuliaDiff/ForwardDiff.jl
no promotion exists for ForwardDiff.Dual{N,T<:Real} and Float64
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 1k
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
Hi all !
I would like to concatenate a vector of Dual with a Real as the following
T = 1
p = Array{Dual}(N)
k = 2
ps = vcat(p[1:k], T)
# z = rand(Categorical(ps))
Yet I get the error no promotion exists for ForwardDiff.Dual{N,T<:Real} and Float64.
Therefore I tried to extends the vcat function:
function Base.vcat{T<:Real}(a::Array{Dual{T}}, x::T)
N = length(a)
new_a = Array{Dual}(N+1)
new_a[1:N] = a
new_a[N+1] = Dual(x)
new_a
end
Unfortunatly this does not work.
How shall I proceed ?
Thanks for your help,
Emile
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Julia snippet in the issue and trace how ForwardDiff.Dual values are handled during vcat and numeric promotion. Determine the intended behavior for concatenating Dual and Real values, then verify that the example no longer raises the reported promotion error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100