Created
May 23, 2018 18:04
-
-
Save ben-albrecht/57dcee924fe469d1bf9ce6b3b842b858 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Time; | |
use LinearAlgebra.Sparse; | |
use MatrixUtils; | |
var t: Timer; | |
// | |
t.start(); | |
write('Reading and creating A: '); | |
stdout.flush(); | |
var r = openreader('rep.txt'); | |
var spsD = csrDomain(r); | |
r.close(); | |
var A: [spsD] real = 1.0; | |
writeln(t.elapsed()); | |
t.clear(); | |
// | |
write('A.dot(A): '); | |
stdout.flush(); | |
A.dot(A); | |
writeln(t.elapsed()); | |
t.clear(); | |
// | |
write('transpose(A): '); | |
stdout.flush(); | |
var AT = transpose(A); | |
writeln(t.elapsed()); | |
t.clear(); | |
// | |
write('AT.dot(AT): '); | |
stdout.flush(); | |
AT.dot(AT); | |
writeln(t.elapsed()); | |
t.clear(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use IO; | |
use LayoutCS; | |
proc csrDomain(handle: channel) { | |
var rows: int, cols: int, nnz: int; | |
handle.read(rows); | |
handle.read(cols); | |
handle.read(nnz); | |
var indices: [1..nnz] (int, int); | |
for ind in indices { | |
handle.readf("%i,%i", ind[1], ind[2]); | |
} | |
var D = {1..rows, 1..cols}; | |
var spsD: sparse subdomain(D) dmapped CS(); | |
spsD.bulkAdd(indices); | |
return spsD; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2553515 | |
2553515 | |
3300832 | |
i, j | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment