Question

Checking this example (API example at the end), I want to ask a few questions.

1) In the example we are supplying matrix a with non zero elements.What is the real size of the matrix though?And these are the elements of the matrix or the positions that contain non zero elements?

2) Can I use at the calculations (use in a function like culaSparseSetDcooData) a matrix A which will contain zero and non zero elements? If I want to create a sample matrix just to test ,should I have to create a matrix with zero elements,then fill it with some elements and then?

Was it helpful?

Solution

Regarding 1) Interestingly, the size of the matrix in COO format is not explicitly specified: It consists of coordinates of the non-zero elements of the matrix. If you have a COO matrix with 1 non-zero element, then this could be

double a[1] =  { 1.0 };
int colInd[1] = { 10 };
int rowInd[1] = { 20 };

and (as you can tell from the row/column indices) describe elements of a matrix that has at least size 11*21, or it could be

double a[1] =  { 1.0 };
int colInd[1] = { 1000 };
int rowInd[1] = { 2000 };

and describe elements of a matrix that has at least size 1001*2001

However, in this example, it seems like this is a quadratic matrix, and n=8 seems to be the size. (Unfortunately, there seems to be no detailed documentation of the culaSparseSetDcooData function...)

Regarding 2) This is not entirely clear. If your question is whether the "non-zero" values may (in reality) have a value of 0.0, then I can say: Yes, this should be allowed. However, the example that you referred to already shows how to create a simple test matrix.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top