max when values agree?
还没有人认领这个 Issue。
评估
调研方向
从 issue #53 中描述的 Base.max 行为开始,并复现 max(Dual(3,1), Dual(3,-1))。在修改代码之前,先确定值相等且 partial 相等和不相等时的预期结果;当所选择的行为由测试覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
The partial derivative of max currently uses the Julia Base implementation:
max(x,y) = ifelse(y < x, x, y)
Unfortunately, this may cause incorrect results when the Dual values agree but the partials do not:
max(Dual(3,1), Dual(3,-1))
Here, the values are both 3 but the partials have opposite signs. I think the partial here may be undefined.
Maybe something like:
function Base.max(a::Dual, b::Dual)
if value(a) > value(b)
return a
elseif value(a) < value(b)
return b
else # value(a) == value(b)
return ifelse(epsilon(a) == epsilon(b), a, Dual(value(a), NaN))
end
end
- 主要语言
- Julia
- 星标
- 80
- 派生
- 27
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaDiff/DualNumbers.jl 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
JuliaDiff/DualNumbers.jl#94 · 2 条评论 ·
-
div() and rem()未关闭
难度 5/5 一周以上 新手友好度 25/100
JuliaDiff/DualNumbers.jl#93 ·
-
难度 5/5 一周以上 新手友好度 30/100
JuliaDiff/DualNumbers.jl#92 · 5 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
JuliaDiff/DualNumbers.jl#88 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
JuliaDiff/DualNumbers.jl#87 ·
查看 JuliaDiff/DualNumbers.jl 的全部 Issue
相似的 Issue
-
🕷️ bug
难度 2/5 1-3 小时 新手友好度 78/100
CliMA/ClimaSeaIce.jl#203 ·
维护者通常 2 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 64/100
JuliaPhysics/BeamletOptics.jl#221 ·
维护者通常 1 天内回复
-
release preparation spack
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
30-minutes algorithm any-language codewars dart easy elixir hackerrank hacktoberfest haskell help wanted interview-prep julia leetcode lua open-source r scala students zig
难度 2/5 1-3 小时 新手友好度 68/100
Huerte/algo-solutions-python#163 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
QuantumSavory/QuantumClifford.jl#853 ·
维护者通常 1 天内回复