Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
15 Views

Efficient storage of sparse matrix with constant non-zero elements

I have a sparse matrix whose non-zero elements are always ones ( = 1). Is there a storage scheme supported by MKL that will save the memory space required for storing the data array and stores only the indices arrays?
0 Kudos
3 Replies
Highlighted
Black Belt
15 Views

While I understand your motivation for asking, I feel that there is little use for such a representation, for the following reason.

If any transformation is performed upon or using the special matrix, it will probably cease to have all nonzero values equal to 1. Therefore, the special representation, if it existed, would only apply to the original matrix. It would also be probably necessary to convert (or provide a routine to convert) from the special representation to the usual (ir,jc,v) representation before calling solver routines.
0 Kudos
Highlighted
15 Views

Quoting mecej4
While I understand your motivation for asking, I feel that there is little use for such a representation, for the following reason.

If any transformation is performed upon or using the special matrix, it will probably cease to have all nonzero values equal to 1. Therefore, the special representation, if it existed, would only apply to the original matrix. It would also be probably necessary to convert (or provide a routine to convert) from the special representation to the usual (ir,jc,v) representation before calling solver routines.

I will use this special matrix to multiply it with vectors. My program will not alter it at all!
0 Kudos
Highlighted
Black Belt
15 Views

> I will use this special matrix to multiply it with vectors. My program will not alter it at all!

In that case, the matrix-vector product calculation can be expressed quite simply using only the ir() and jc() arrays, with the implied value of 1, using a couple of lines of code. For example, to compute u = A . x with A in coordinate storage format :

u(1:n) = 0
do iz = 1, nnz
c u(ir(iz)) = u(ir(iz)) + val(ir(iz),jc(iz)) * x(jc(iz)) ! general case
u(ir(iz)) = u(ir(iz)) + x(jc(iz)) ! special case
end do

0 Kudos