From 8ff49305796292e154d646bada59e008c0f0eb23 Mon Sep 17 00:00:00 2001 From: "Bowen S. Zhu" Date: Sat, 8 Oct 2022 19:08:02 -0400 Subject: [PATCH] Update README `jacobian_sparsity` --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16eb49df..a72097a3 100644 --- a/README.md +++ b/README.md @@ -43,18 +43,17 @@ end For this function, we know that the sparsity pattern of the Jacobian is a `Tridiagonal` matrix. However, if we didn't know the sparsity pattern for -the Jacobian, we could use the `jacobian_sparsity` function to automatically -detect the sparsity pattern. This function is only available if you -load SparsityDetection.jl as well. We declare that the function `f` outputs a -vector of length 30 and takes in a vector of length 30, and `jacobian_sparsity` spits -out a `Sparsity` object which we can turn into a `SparseMatrixCSC`: +the Jacobian, we could use the `Symbolics.jacobian_sparsity` function to automatically +detect the sparsity pattern. We declare that the function `f` outputs a +vector of length 30 and takes in a vector of length 30, and `jacobian_sparsity` returns +a `SparseMatrixCSC`: ```julia -using Symbolics, SparseArrays +using Symbolics input = rand(30) output = similar(input) sparsity_pattern = Symbolics.jacobian_sparsity(f,output,input) -jac = Float64.(sparse(sparsity_pattern)) +jac = Float64.(sparsity_pattern) ``` Now we call `matrix_colors` to get the colorvec vector for that matrix: