需要将三列数据(ia,ja,acsr)输出至txt文件,单独输出一个变量时没有问题,三列同时输出的时候,ja是接在ia后面输出,acsr的值跟单独输出的时候也不一样。另,三列长度不同,ia为2401行,ja acsr为13320行。求指导如何正确输出文件。[Fortran] 纯文本查看 复制代码 program converters
implicit none
! Definition arrays for sparse matrix formats
integer,parameter :: m=2400, n=2400, lda=2400, nzmax=13320
integer :: ia(m+1), ja(nzmax)
real :: adns(m,n) , acsr(nzmax)
! Declairation of local variables:
integer :: job(8), i, j, info, ibase1, ibase2, locat
info = 0
locat = 2
ibase1 = 1
ibase2 = 1
job(2) = ibase1
job(3) = ibase2
job(4) = locat
job(5) = nzmax
! Task1: densly matrix to csr
open(11,file="Vollmatrix.txt")
do i=1,m
read(11,*) adns(i,:)
end do
close(11)
job(1) = 0
job(6) = 1
call mkl_sdnscsr(job, m, n, adns, lda, acsr, ja, ia ,info)
open(12,file="csr.txt")
write(12,"(2x,'IA ;',2x,'JA ;',5x,'Value ;')")
write(12,100) ia,ja,acsr
100 format(I6,2x,I6,E13.5)
close(12)
end program converters
|