forked from JuliaDiff/DifferentiationInterface.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDifferentiationInterfaceSparseMatrixColoringsExt.jl
More file actions
99 lines (71 loc) · 2.81 KB
/
DifferentiationInterfaceSparseMatrixColoringsExt.jl
File metadata and controls
99 lines (71 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
module DifferentiationInterfaceSparseMatrixColoringsExt
using ADTypes: ADTypes, AutoSparse, coloring_algorithm, dense_ad, sparsity_detector
import DifferentiationInterface as DI
using SparseMatrixColorings:
AbstractColoringResult,
ColoringProblem,
coloring,
column_colors,
row_colors,
ncolors,
column_groups,
row_groups,
sparsity_pattern,
decompress!
import SparseMatrixColorings as SMC
## SMC overloads
abstract type SMCSparseJacobianPrep{SIG} <: DI.SparseJacobianPrep{SIG} end
"""
SMC.sparsity_pattern(prep::DI.SparseJacobianPrep)
Return the sparsity pattern of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.sparsity_pattern(prep::DI.SparseJacobianPrep) = prep.sparsity
"""
SMC.column_colors(prep::DI.SparseJacobianPrep)
Return the column colors of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.column_colors(prep::DI.SparseJacobianPrep) = column_colors(prep.coloring_result)
"""
SMC.column_groups(prep::DI.SparseJacobianPrep)
Return the column groups of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.column_groups(prep::DI.SparseJacobianPrep) = column_groups(prep.coloring_result)
"""
SMC.row_colors(prep::DI.SparseJacobianPrep)
Return the row colors of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.row_colors(prep::DI.SparseJacobianPrep) = row_colors(prep.coloring_result)
"""
SMC.row_groups(prep::DI.SparseJacobianPrep)
Return the row groups of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.row_groups(prep::DI.SparseJacobianPrep) = row_groups(prep.coloring_result)
"""
SMC.ncolors(prep::DI.SparseJacobianPrep)
Return the number of colors of a sparse `prep` object created by [`prepare_jacobian`](@ref).
"""
SMC.ncolors(prep::DI.SparseJacobianPrep) = ncolors(prep.coloring_result)
"""
SMC.sparsity_pattern(prep::DI.SparseHessianPrep)
Return the sparsity pattern of a sparse `prep` object created by [`prepare_hessian`](@ref).
"""
SMC.sparsity_pattern(prep::DI.SparseHessianPrep) = prep.sparsity
"""
SMC.column_colors(prep::DI.SparseHessianPrep)
Return the column colors of a sparse `prep` object created by [`prepare_hessian`](@ref).
"""
SMC.column_colors(prep::DI.SparseHessianPrep) = column_colors(prep.coloring_result)
"""
SMC.column_groups(prep::DI.SparseHessianPrep)
Return the column groups of a sparse `prep` object created by [`prepare_hessian`](@ref).
"""
SMC.column_groups(prep::DI.SparseHessianPrep) = column_groups(prep.coloring_result)
"""
SMC.ncolors(prep::DI.SparseHessianPrep)
Return the number of colors of a sparse `prep` object created by [`prepare_hessian`](@ref).
"""
SMC.ncolors(prep::DI.SparseHessianPrep) = ncolors(prep.coloring_result)
include("jacobian.jl")
include("jacobian_mixed.jl")
include("hessian.jl")
end