Skip to content

Docs / tutorial on sparsity? #1868

@gdalle

Description

@gdalle

Related to SciML/ADTypes.jl#127 (comment), would it be possible to add a page about sparsity detection / exploitation to the Reactant docs? It gets mentioned regularly but I'm not sure where to start. For instance, what would be the equivalent of the following workflow with Reactant? How do I get a sparse matrix as the output, and what type does it have?

using ForwardDiff
using DifferentiationInterface
using SparseConnectivityTracer, SparseMatrixColorings

f(x) = map(sin, x) + map(cos, reverse(x))
backend = AutoSparse(
    AutoForwardDiff();
    sparsity_detector = TracerSparsityDetector(),
    coloring_algorithm = GreedyColoringAlgorithm()
);
x = rand(10)
prep = prepare_jacobian(f, backend, x);
jacobian(f, prep, backend, x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions