Skip to content

Set strict=false for DI in HomotopyContinuation#626

Merged
ChrisRackauckas merged 1 commit into
masterfrom
ChrisRackauckas-patch-1
May 26, 2025
Merged

Set strict=false for DI in HomotopyContinuation#626
ChrisRackauckas merged 1 commit into
masterfrom
ChrisRackauckas-patch-1

Conversation

@ChrisRackauckas

Copy link
Copy Markdown
Member
/home/runner/work/NonlinearSolve.jl/NonlinearSolve.jl/lib/NonlinearSolveHomotopyContinuation/test/single_root.jl:151
  Got exception outside of a @test
  PreparationMismatchError (inconsistent types between preparation and execution):
    - f!:- y:- backend:- x:- prep: Vector{Float64}
      - exec: Base.ReinterpretArray{Float64, 1, ComplexF64, Vector{ComplexF64}, false}
    - contexts: ✅
  If you are confident that this check is superfluous, you can disable it by running preparation with the keyword argument `strict=Val(false)` inside DifferentiationInterface.
  

Reinterpret seems to bug it so it's easiest to just remove it.

```julia
/home/runner/work/NonlinearSolve.jl/NonlinearSolve.jl/lib/NonlinearSolveHomotopyContinuation/test/single_root.jl:151
  Got exception outside of a @test
  PreparationMismatchError (inconsistent types between preparation and execution):
    - f!: ✅
    - y: ✅
    - backend: ✅
    - x: ❌
      - prep: Vector{Float64}
      - exec: Base.ReinterpretArray{Float64, 1, ComplexF64, Vector{ComplexF64}, false}
    - contexts: ✅
  If you are confident that this check is superfluous, you can disable it by running preparation with the keyword argument `strict=Val(false)` inside DifferentiationInterface.
  
```

Reinterpret seems to bug it so it's easiest to just remove it.
prep = DI.prepare_jacobian(f, autodiff, tmp, DI.Constant(p), strict = Val(false))
else
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p))
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))
prep = DI.prepare_jacobian(
f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))

tmp = Vector{ComplexF64}(undef, length(u0))
if variant == Inplace
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p))
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))
prep = DI.prepare_jacobian(
f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))

prep = DI.prepare_jacobian(f, tmp, autodiff, copy(tmp), DI.Constant(p), strict = Val(false))
else
prep = DI.prepare_jacobian(f, autodiff, tmp, DI.Constant(p))
prep = DI.prepare_jacobian(f, autodiff, tmp, DI.Constant(p), strict = Val(false))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
prep = DI.prepare_jacobian(f, autodiff, tmp, DI.Constant(p), strict = Val(false))
prep = DI.prepare_jacobian(
f, autodiff, tmp, DI.Constant(p), strict = Val(false))

@ChrisRackauckas ChrisRackauckas merged commit 943fd30 into master May 26, 2025
9 of 15 checks passed
@ChrisRackauckas ChrisRackauckas deleted the ChrisRackauckas-patch-1 branch May 26, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant