I need to revove a column from a large sparse matrix that is stored in CSR format, using MKL. I cannot find an MKL routine that does this directly. Can anyone tell me how it can be done? I'm using Fortran. Thx. Bob
Here is an example where the input 8 X 8 matrix is symmetric and only the upper triangle is processed. The example shows the third column being deleted. The call to mkl_ddnscsr() is only for printing purposes, and is not needed for the column deletion.
[NOTE: The program listing is portrayed by the formatter as double spaced. That was not intended, and I request the Intel people to tell me how to avoid such unintended double spacing.]
[fortran] PROGRAM pardiso_sym
C.. All other variables
INTEGER maxfct, mnum, mtype, phase, n, nrhs, error, msglvl
INTEGER i, j,k,kn, idum,job(6), info, jdel
REAL*8 waltime1, waltime2, ddum
C.. Fill all arrays containing matrix data.
DATA n /8/, nrhs /1/, maxfct /1/, mnum /1/
DATA ia /1,5,8,10,12,15,17,18,19/
1 /1, 3, 6,7,
2 2,3, 5,
3 3, 8,
4 4, 7,
6 6, 8,
1 /7.d0, 1.d0, 2.d0,7.d0,
2 -4.d0,8.d0, 2.d0,
3 1.d0, 5.d0,
4 7.d0, 9.d0,
6 -1.d0, 5.d0,
c Drop column 3
jdel = 3 ! column to delete
kn = 0
do k=ia(i),ia(i+1)-1 ! row i
write(*,*)'info = ',info
Here is an example that shows how to perform the column deletion that you sought. I show how to delete a column in a symmetric matrix represented by only its upper triangular part. Please note that the call to mkl_ddnscsr() is not needed for the column deletion, but to facilitate printing the modified matrix.
[Note to Forum Moderators: My first response (#2) was held up for approval for several hours. Then, after it was approved, I noticed that the inline code was formatted with double spacing, and added a couple of sentences to #2 to disclaim that I had inserted the extra blank lines. When I did the edits and clicked "SUBMIT", the whole of #2 evaporated, and the forum TOC showed the number of replies as 0. In response to this event, I posted #3. Subsequently, #2 appeared again. There is much duplication between the two: readers please note this!]
mecej4, Thx so much. It works great. Do you happen to have a version of this code that would work on an non-symmetric, sparse matrix. If you do, that would be very helpful too.