c - Blocked Compressed Row Storage format of Sparse Matrix -


I am writing a program that will change the spurs matrix for compressed cry storage.

I know how to get Ropert, Collind (not in code) and A_F.

Code:

  p = 0; {Row_ptr [++ p] = (row_ptr [p-1] + count_blocks (A, I, N)) for (i = 0; i & lt; m; i ++); (J = 0; j & lt; n; j ++) (if (a [i] [j]) {a_f] [a] = a [i] [j]; k ++}}}}   

The function I use gives the number of blocks in the row:

  int count_blocks (int matrix [100] [100] (I = 0; i & lt; n - 1; i ++) {if (matrix [row_idx] [i]) {if (!), For int row_idx, int n) {int i; int block_count = 0; Block_count ++; else if (row_idx] [i + 1] and am == n - 2) I] and am == n - 2) {if (matrix [row_idx] [i + 1]) block_count ++; breakdown;}} return block_count;  

But I got trapped in getting NPTRR.

Thanks :)

Here's a function that gives nzptr 5x5 size metrics. It gives the number of items in nzptr , it also calculates the index with cylindrical indexing.

  int computeNzptr (double matrix [5] [5], int njptr []) {int isNewBlock = 1; Int nzIndex = 0; Int nonZeroCount = 0; Int i = 0; Int j = 0; (I = 0; i & lt; 5; ++ i) {for (j = 0; j & lt; 5; ++ j) {if (matrix [i] [j]! = 0.0) {++ nonZeroCount ; If (isNewBlock) {isNewBlock = 0; NZTPR [NJIDX ++] = Non-Xerocount-1; }} Else {isNewBlock = 1; }}} Return nzIndex; In the context image, descriptions and answers do not match.  

PS

When you have 5x5 metrics, which are similar to the matrix in the posted image,

  double matrix [5] [5] = {{5.0, 1.0, 7.0, 0.0, 0.0} , {0.0, 2.0, 0.0, 2.0, 3.0}, {0.0, 2.0, 4.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 3.0, 0.0}, {0.0, 6.0, 0.0, 0.0, 0.0, 3.0}}; The output should be according to the details:  
  0 3 4 6 8 10 11  

in reference Different from output

I agree that the description of the reference document is correct and the output is incorrect.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -