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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5863 - (hide annotations)
Wed Jan 13 02:25:48 2016 UTC (4 years, 6 months ago) by jfenwick
File MIME type: text/x-python
File size: 1021 byte(s)
Copyright dates updated.
\version for doxygen to read

1 sshaw 5706
2 sshaw 5707 ##############################################################################
3     #
4 jfenwick 5863 # Copyright (c) 2003-2016 by The University of Queensland
5 sshaw 5707 # http://www.uq.edu.au
6     #
7     # Primary Business: Queensland, Australia
8     # Licensed under the Open Software License version 3.0
9     # http://www.opensource.org/licenses/osl-3.0.php
10     #
11     # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     # Development 2012-2013 by School of Earth Sciences
13     # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14     #
15     ##############################################################################
16    
17 sshaw 5706 from __future__ import print_function, division
18    
19 caltinay 4955 from scipy.sparse import coo_matrix
20     from scipy.io import mmwrite
21     from numpy.random import permutation
22     M = N = 10
23    
24     for nnz in [0, 1, 2, 5, 8, 10, 15, 20, 30, 50, 80, 100]:
25     P = permutation(M * N)[:nnz]
26     I = P / N
27     J = P % N
28     V = permutation(nnz) + 1
29    
30     A = coo_matrix( (V,(I,J)) , shape=(M,N))
31     filename = '%03d_nonzeros.mtx' % (nnz,)
32     mmwrite(filename, A)
33    

  ViewVC Help
Powered by ViewVC 1.1.26