1

I'm currently working on FEM with matlab.

my code is like this

function [A,rhs] = Assemble()

pre_process();
[IA,JA,A,rhs] = assemble(pre_processed_parameters); // mex-func
// IA : row index 
// JA : col index
//  A : value

A = sparse(IA,JA,A);

When A is size of ten million x ten million,

pre_process takes less than 1 second

assemble takes about 5 seconds

sparse takes about 820 sec

The major time consuming line is a single line sparse.

Is there any faster way to collect it?

Properties of IA, JA and A are

  1. Pair of (IA[k],JA[k]) have all distinct values for all k.

  2. resulting matrix, A, is lower triangular and have block structure

Dohyun
  • 642
  • 4
  • 15
  • How many elements do you actually have in your sparse matrix? i.e. what is `numel(IA)`? – Suever Jul 12 '16 at 14:09
  • 2
    Upgrade your computer? Given the number of elements that doesn't seem slow and without more information on the data it's pretty much impossible to answer the optimization question. – sco1 Jul 12 '16 at 14:11
  • `nnz` is 855,582,720. I found `fsparse` in user.it.uu.se/~stefane/freeware.html. This makes sparse declaration twice faster. – Dohyun Jul 12 '16 at 15:13
  • Maybe they do not use Compressed Row/Column Storage format (which is the format you are using). Google it and have a look at : https://www.mathworks.com/help/pdf_doc/otherdocs/simax.pdf – epsi1on Jul 13 '16 at 05:22

0 Answers0