Skip to content

Instantly share code, notes, and snippets.

huanglangwen

  • ETHZ
  • Zurich, Swizerland
Block or report user

Report or block huanglangwen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huanglangwen
huanglangwen / Benchmarkjac.jl
Last active Sep 22, 2019
Benchmarking the performance of `forward_color_jacobian!` and `ForwardDiff.jacobian!`
View Benchmarkjac.jl
using ForwardDiff, SparseDiffTools, DiffTests, DiffResults
using BenchmarkTools
######################Test/utils.jl
using ForwardDiff: DEFAULT_CHUNK_THRESHOLD
using Test
using Random
# seed RNG, thus making result inaccuracies deterministic
# so we don't have to retune EPS for arbitrary inputs
@huanglangwen
huanglangwen / StructralMatrices.md
Created Sep 8, 2019
Doc for coloring of structured matrices and integration of sparsediff in OrdinaryDiffEq.jl
View StructralMatrices.md

Structured Matrices

We specialize matrix coloring and iterating in ArrayInterface.jl for structured matrices including:

  • Diagonal
  • Bidiagonal
  • Tridiagonal
  • BandedMatrix
  • BlockBandedMatrix
  • BandedBlockBandedMatrix

Coloring

The coloring function matrix_colors for structured matrices are overloaded by analytical results assuming all of the valid entries in the structured matrices are non-zero. Therefore, it is several magnitude faster than the default coloring algorithm. It is recommended to use the overloaded matrix_colors as long as the majority of the entries are filled by nonzero values. If not, you could further exploit the sparsity by convert the structured matrix into SparseCSC matrix and apply default coloring algorithm to it.

You can’t perform that action at this time.