- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
rencently,I have run a program using Intel MKL sparse format and MATLAB respectively.I find an accuracy problem in my result. Let me briefly summarize what I did.
At first,I use the MKL libary to compute K*X=KX ,as follows:
the full format symmetric matrix K converts to the sparse format CSC (COPPTR,ROWIND,VALUES or ROWIND,VALUES,pointer_B,pointer_E)
program exe101
implicit none
integer::i,j
integer,parameter::DP=8
integer::nRows,nNonzero
integer,allocatable::COPPTR(:),ROWIND(:),pointer_B(:),pointer_E(:)
real(kind=DP),allocatable::VALUES(:)
real(kind=DP),allocatable::X(:),KX(:)
real(kind=DP)::alpha,beta
character(6):: matdescra
open(unit=10,file='nRows.txt')
read(10,*)nRows
close(10,status="keep")
open(unit=10,file='nNonzero.txt')
read(10,*)nNonzero
close(10,status="keep")
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(KX(nRows))
X=1.0
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, KX)
open(unit=10,file='KX.txt')
write(10,'(1X,1f40.21)')KX
end
output::
KX=
1999999999.999993562698364257812
-0.000006198883056640625
2000000000.000000000000000000000
0.000000000000000000000
0.000000000000000000000
0.000000000000000000000
0.000002384185791015625
0.000001907348632812500
Secondly,I use MATLAB to compute K*X=KX
output::
1999999999.99999
-6.19888305664063e-06
2000000000.00000
0
0
0
2.14576721191406e-06
1.90734863281250e-06
where
input::
K=
5.414213562373090e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 -2.000000000000000e+009 0.000000000000000e+000 -7.071067811865480e+008 -7.071067811865480e+008
0.000000000000000e+000 3.414213562373090e+009 0.000000000000000e+000 -2.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 -7.071067811865480e+008 -7.071067811865480e+008
0.000000000000000e+000 0.000000000000000e+000 4.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 -2.000000000000000e+009 0.000000000000000e+000
0.000000000000000e+000 -2.000000000000000e+009 0.000000000000000e+000 2.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000
-2.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 2.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000
0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 2.000000000000000e+009 0.000000000000000e+000 -2.000000000000000e+009
-7.071067811865480e+008 -7.071067811865480e+008 -2.000000000000000e+009 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 2.707106781186550e+009 7.071067811865480e+008
-7.071067811865480e+008 -7.071067811865480e+008 0.000000000000000e+000 0.000000000000000e+000 0.000000000000000e+000 -2.000000000000000e+009 7.071067811865480e+008 2.707106781186550e+009
X=
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
I want to know why two results are different and how to improve the accuracy of sparse(dense) matrix- vector.
Thank you,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page