Skip to content

Instantly share code, notes, and snippets.

@wenming
Created June 3, 2012 22:52
Show Gist options
  • Save wenming/2865308 to your computer and use it in GitHub Desktop.
Save wenming/2865308 to your computer and use it in GitHub Desktop.
svdlibc
program convertsongdat
c
integer nrows, ncols, tnnz
integer nrow(384546), matrix(384546)
integer rowe, matrixe, rowi, coli, ncol, nonzero
c
nrows=384546
ncols=1019318
tnnz=48373586
c
open(71,file='results_int.txt')
open(81,file='songsMatrix')
c
write(81,*) nrows, ncols, tnnz
c
coli=0
rowi=1
nonzero=0
do 1000 i=1,tnnz
read(71,*) ncol, rowe, matrixe
c
if (ncol.eq.coli) then
c
nrow(rowi)=rowe
matrix(rowi)=matrixe
rowi=rowi+1
nonzero=nonzero+1
if (i.eq.tnnz) then
print *, i
write(81,*) nonzero
do 1020 j=1,nonzero
write(81,*) nrow(j), matrix(j)
1020 continue
stop
endif
c
else
c
write(81,*) nonzero
do 1010 j=1,nonzero
write(81,*) nrow(j), matrix(j)
1010 continue
nrow(1)=rowe
matrix(1)=matrixe
rowi=2
nonzero=1
coli=ncol
c
endif
c
1000 continue
c
close(71)
close(81)
c
stop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment