I tried to have the result of `` but it gave error. So, I tried adj_factor.L*adj_factor.U*adj_factor.F*V but it gave different result with adj*V.
Could you please tell me what is the correct order of L,U,P to have the same result between?
Edit: as stevengj mentions, normally you decompose to solve a system, not to multiply the matrix with something (in that case you could directly use your matrix)
My main goal is to find a way to accelerate the multiplication of two matrices (one or both are sparse/s). So, I though that factorizing one and multiplying it by the other can be faster.
I am profiling my code (takes 5 sec) against another program (coded in Fortran and takes 2.13 sec). It is a time loop simulation 1:25e-6:0.6.
I found my code spends 1.5 sec at the line of multiplication (as in my first post). So, I started to think if there is a faster way to do the multiplication. I tried to use “MKLSparse.jl” but no gain. I am not sure if it is activated correctly in my julia.
How long is the Fortran spending in each part? The Fortran is likely using the same libraries as Julia for the multiplication, so I would think the time difference would be in a different part.
I would suggest to describe the problem in detail. It is possible to find examples of poor performance when multiplying matrices, especially when mixing dense and sparse matrices.
Just do x = A_factor \ b. (This is the first example in the KLU.jl README.)
Factoring matrices loses sparsity, so it will slow down multiplication. The reason to factor matrices is to do other things, like solving Ax=b.
Before you can optimize your code, you’re really going to have to learn a bit about how sparse-matrix algorithms work, in order to get some sense of what is fast and what is slow.
It’s good, but is it the best (feel free to send me a private message, if not helpful here)? I saw a new format, and Julia package for recently, and while I didn’t mean to interject, I thought it might be relevant to the user here; see on other question where I also posted:
For you the LU factorization you should also generally do F \ b with F = lu(A) in Julia. This is mathematically equivalent to U \ (L \ P*b) but is easier and probably more efficient (because it uses specialized lower-level routines and tries to work more in-place with fewer temporary vectors).