I could ask this in MKL - but this is more a straight FORTRAN problem.
Before you call PARDISO - you pack the n by n Stiffness matrix into a set of vectors to take up less space. mecej4 showed me in MAGNI how to pack efficiently - the following code does the packing for taking a stiffness matrix from and turns it into the packed vectors, Pardiso needs the length of the vectors essentially NNZ.
I measure the number of degrees of freedom of the problem which gives you a size, but trying to relate NNZ to the degrees of freedom is interesting -
I was thinking just counting the number of non-zero elements in the stiffness matrix and than set NNZ - but I have to loop thru a large matrix
Is there a simpler method, I was just using 9 times the number of degrees of freedom and that usually works, but it did not on the current problem
subroutine PardisoSolver(GK,nl,nk,ndf,X)
implicit none
include 'mkl_pardiso.fi'
integer nl,nk,ndf
REAL (KIND=dp) GK(nl,nk),X(ndf)
REAL (KIND=dp), ALLOCATABLE :: a(:), b(:), c(:,:), atemp(:)
integer, allocatable :: ja(:), ia(:), iatemp(:), jatemp(:)
INTEGER :: nnodes = 5
integer error, iaN
integer :: nnz , istat, i, j , count
integer :: size = 0
integer :: size1 = 0
integer :: size2 = 0
integer :: flag = 0
REAL (KIND=dp) :: delta = 0.000000000000001
nnz = 90*ndf
!open(16, file="a.mat", STATUS = 'old')
! read(16,*)count
count = ndf
!nnodes = count
iaN = count+1
ALLOCATE (a(nnz), ja(nnz), ia(iaN), jatemp(nnz), iatemp(iaN), b(count), c(count,count), atemp(nnz), STAT=istat)
IF (istat.NE.0) THEN
WRITE (*, *) '*** Could not allocate some arrays in LINSOLVE'
STOP
END IF
b = 1.0D0
a = 0.0d0
c = 0.0d0
iatemp = 0
jatemp = 0
atemp = 0
ia = 0
ja = 0
do 200 i = 1, count
flag = 0
do 300 j = 1, count
c(i,j) = gk(i,j)
if(abs(c(i,j)) .gt. delta) then
size = size + 1
if(size .gt. nnz) then
Write(*,2030)nnz, ndf
2030 Format( " NNZ is set at :: ",I6, " NDF is :: ",I6)
stop ' Insufficient memory allocation in PARDISO to solve the inversion problem'
endif
jatemp(size) = j
iatemp(size1 + 1) = size+1
atemp(size) = c(i,j)
if(flag .eq. 0) then
size1 = size1 + 1
iatemp(size1) = size
flag = 1
endif
endif
300 end do
400 format(5(1x,F10.3))
200 end do