Giter Club home page Giter Club logo

Comments (6)

shashi avatar shashi commented on September 21, 2024

It seems to be an intersection of #15 and global access:

julia> const Z = Int[1,2]
2-element Array{Int64,1}:
 1
 2
# This works! --
julia> sparsity!([1,2],[2,3]) do du,u
                 Z[:] .= u[:]
                du[1] = Z[1]
              end
Explored path: SparsityDetection.Path(Bool[], 1)
2×2 SparseMatrixCSC{Bool,Int64} with 1 stored entry:
  [1, 1]  =  1

# This doesn't --
julia> sparsity!([1,2],[2,3]) do du,u
                 Z[:] .= u[:]
                du[:] .= Z[:]
              end
Explored path: SparsityDetection.Path(Bool[], 1)
2×2 SparseMatrixCSC{Bool,Int64} with 0 stored entries

from sparsitydetection.jl.

ChrisRackauckas avatar ChrisRackauckas commented on September 21, 2024

Interesting. So even the mul! works, it's just @. DA = D*(MyA + AMx)?

from sparsitydetection.jl.

shashi avatar shashi commented on September 21, 2024

Yes.

from sparsitydetection.jl.

shashi avatar shashi commented on September 21, 2024

I fixed the above problem,

mul! didn't need to work, and it doesn't.

const N = 12

const My = Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1])
My[1,2] = 2.0
My[end,end-1] = 2.0

function f(du,u,p,t)
  mul!(du,My,u)
end

using SparsityDetection
input = rand(N,N)
output = similar(input)
sparsity_pattern = sparsity!(f,output,input,nothing,0.0)
# empty

from sparsitydetection.jl.

shashi avatar shashi commented on September 21, 2024

Ok that was actually not a problem, I screwed up while moving between branches and found a commit in the reflog which I had missed out in the #18. :/ :/

spy

Does this look right to you for a 16x16 problem?

from sparsitydetection.jl.

ChrisRackauckas avatar ChrisRackauckas commented on September 21, 2024

It's a bit hard to do this one in my head, but that seems about right. A good test would be to calculate the full Jacobian with forward diff and then zero it out, or MTK. Of course, you can only do that on the small problems, and MTK will quickly out of memory if it's like 32x32 haha.

from sparsitydetection.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.