/[escript]/trunk/cusplibrary/testing/data/random_10x10/generator.py
ViewVC logotype

Contents of /trunk/cusplibrary/testing/data/random_10x10/generator.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (show annotations)
Mon Sep 15 01:25:23 2014 UTC (5 years, 9 months ago) by caltinay
File MIME type: text/x-python
File size: 377 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

1 from scipy.sparse import coo_matrix
2 from scipy.io import mmwrite
3 from numpy.random import permutation
4 M = N = 10
5
6 for nnz in [0, 1, 2, 5, 8, 10, 15, 20, 30, 50, 80, 100]:
7 P = permutation(M * N)[:nnz]
8 I = P / N
9 J = P % N
10 V = permutation(nnz) + 1
11
12 A = coo_matrix( (V,(I,J)) , shape=(M,N))
13 filename = '%03d_nonzeros.mtx' % (nnz,)
14 mmwrite(filename, A)
15

  ViewVC Help
Powered by ViewVC 1.1.26