Closed
Description
Problems:
- The code for
AutoSparseBackend
is a duplicate ofAutoBackend
, sometimes with misses (see GiveAutoSparseFiniteDiff
the same type parameters asAutoFiniteDiff
#33) - There is no built-in way to specify additional aspects like the sparsity detection method or the coloring algorithm
- It is tedious to enumerate all possible sparse backends
Suggested solutions (instead of #37):
- Replace
AutoSparseBackend
with a wrapper structAutoSparse(AutoBackend)
- Add fields to this wrapper struct for sparse-specific ingredients
struct AutoSparse{B<:AbstractADType,S,C} <: AbstractADType
backend::B
sparsity_detector::S
coloring_algorithm::C
end
To preserve backwards-compatibility we can try to define shortcuts like the following, to be removed in v0.3.0:
const AutoSparseBackend = AutoSparse{<:AutoBackend}
function AutoSparseBackend(args...; sparsity_detector, coloring_algorithm, kwargs...)
backend = AutoBackend(args...; kwargs...)
return AutoSparse(backend, sparsity_detector, coloring_algorithm)
end
However I'm not 100% sure we can keep this from being breaking.
Metadata
Metadata
Assignees
Labels
No labels