In Intel® MKL mkl_dcscmv and gemv produce different result .

At first,I use the mkl_dcscmv to compute K*X=ANS ,where matrix K(2280,2280) converts to the sparse format CSC (COPPTR,ROWIND,VALUES or ROWIND,VALUES,pointer_B,pointer_E) as follows:

program CSC_MATRIX_VECTOR

implicit none

integer::i,j

integer,parameter::nRows=2280

integer,parameter::nNonzero=25395

integer,allocatable::COPPTR(:),ROWIND(:),pointer_B(:),pointer_E(:)

double precision,allocatable::VALUES(:)

double precision,allocatable::X(:),ANS(:)

double precision::alpha,beta

character(6):: matdescra

allocate(COPPTR(nRows+1))

open(unit=10,file='COPPTR.txt')

read(10,*)COPPTR

close(10,status="keep")

allocate(ROWIND(nNonzero))

open(unit=10,file='ROWIND.txt')

read(10,*)ROWIND

close(10,status="keep")

allocate(VALUES(nNonzero))

open(unit=10,file='VALUES.txt')

read(10,*)VALUES

close(10,status="keep")

allocate(X(nRows))

allocate(ANS(nRows))

open(unit=10,file='X.txt')

read(10,*)X

close(10,status="keep")

alpha=1.0

beta=0.0

matdescra='SLNF'

allocate(pointer_B(nRows))

allocate(pointer_E(nRows))

do i=1,nRows

pointer_B(i)=COPPTR(i)

pointer_E(i)=COPPTR(i+1)

end do

call mkl_dcscmv('N', nRows, nRows, alpha, matdescra, VALUES, ROWIND, pointer_B,

pointer_E,X, beta, ANS)

open(unit=10,file='ANS.txt')

write(10,'(D24.16)')ANS

end

result::

ANS(CSC).txt

Secondly,I use gemv to compute K*X=ANS,as follows:

include 'blas.f90'

program FULL_MATRIX_VECTOR

use MKL95_BLAS

use f95_precision

implicit none

integer::i,j

integer,parameter::nRows=2280

double precision,allocatable::K(:,:),X(:),ANS(:)

double precision::alpha,beta

allocate(K(nRows,nRows))

open(unit=10,file='K.txt')

read(10,*)((K(i,j),j=1,nRows),i=1,nRows)

close(10,status="keep")

allocate(X(nRows))

open(unit=10,file='X.txt')

read(10,*)X

close(10,status="keep")

allocate(ANS(nRows))

alpha=1.0

beta=0.0

call gemv(K, X, ANS,alpha ,beta ,'N')

open(unit=10,file='ANS.txt')

write(10,'(D24.16)')ANS

end

the result is

ANS(full).txt

Some elements in the results are quite different,I don't understand why the mkl_dcscmv and gemv cannot produce the same accuracy.

Thanks for your help.