-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for linear algebra #68
Comments
Looks like a missing overload of |
Closed by #65. |
This MWE is still not working for me with SCT v0.4.0, though the error has changed: (jl_YQ9xYx) pkg> st
Status `/tmp/jl_YQ9xYx/Project.toml`
[47edcb42] ADTypes v1.2.1
[9f842d2f] SparseConnectivityTracer v0.4.0
julia> using ADTypes, SparseConnectivityTracer, LinearAlgebra
julia> ADTypes.hessian_sparsity(logdet, rand(2, 2), TracerSparsityDetector())
ERROR: Function > requires primal value(s).
A dual-number tracer for local sparsity detection can be used via `local_hessian_pattern`.
Stacktrace:
[1] >(tx::SparseConnectivityTracer.HessianTracer{…}, ty::SparseConnectivityTracer.HessianTracer{…})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/JvHcU/src/overload_dual.jl:30
[2] generic_lufact!(A::Matrix{SparseConnectivityTracer.HessianTracer{BitSet, Set{…}}}, pivot::RowMaximum; check::Bool)
@ LinearAlgebra ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:152
[3] generic_lufact!
@ ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:134 [inlined]
[4] lu!
@ ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:132 [inlined]
[5] #lu#164
@ ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:300 [inlined]
[6] lu (repeats 2 times)
@ ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:299 [inlined]
[7] logabsdet(A::Matrix{SparseConnectivityTracer.HessianTracer{BitSet, Set{Tuple{Int64, Int64}}}})
@ LinearAlgebra ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:1676
[8] logdet(A::Matrix{SparseConnectivityTracer.HessianTracer{BitSet, Set{Tuple{Int64, Int64}}}})
@ LinearAlgebra ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:1701
[9] trace_function(::Type{SparseConnectivityTracer.HessianTracer{BitSet, Set{…}}}, f::typeof(logdet), x::Matrix{Float64})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/JvHcU/src/pattern.jl:32
[10] hessian_pattern(f::Function, x::Matrix{Float64}, ::Type{BitSet}, ::Type{Set{Tuple{Int64, Int64}}})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/JvHcU/src/pattern.jl:326
[11] hessian_sparsity(f::Function, x::Matrix{Float64}, ::TracerSparsityDetector{BitSet, Set{Tuple{Int64, Int64}}})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/JvHcU/src/adtypes.jl:45
[12] top-level scope
@ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
|
That's because julia> local_hessian_pattern(logdet, rand(2, 2))
4×4 SparseArrays.SparseMatrixCSC{Bool, Int64} with 16 stored entries:
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1 |
Yes, exactly.
julia> using LinearAlgebra
julia> using SparseConnectivityTracer
julia> local_hessian_pattern(det, rand(2, 2))
4×4 SparseArrays.SparseMatrixCSC{Bool, Int64} with 9 stored entries:
⋅ 1 ⋅ 1
1 1 1 1
⋅ 1 ⋅ ⋅
1 1 ⋅ ⋅
julia> local_hessian_pattern(logdet, rand(2, 2))
4×4 SparseArrays.SparseMatrixCSC{Bool, Int64} with 16 stored entries:
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1 |
I reopened because we should add the local/global option to our ADTypes interface |
Agreed. This probably requires a PR to ADTypes to differentiate between local and global sparsity detection. |
We could add local tracing as a kwarg to For this reason, I would argue that local and global sparsity detection should be distinguished between on the level of ADTypes. |
Let's switch to #72 |
Prompted by JuliaDiff/DifferentiationInterface.jl#263, linked but not equivalent to #55
Here's an MWE:
In this case I think the bug is not linalg-related, but for functions that are not in pure Julia we might want to add vector- or matrix-based overloads
The text was updated successfully, but these errors were encountered: