/usr/share/pyshared/SparsExamples/jdsym_demo.py is in python-sparse-examples 1.1-1.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import os
from pysparse import spmatrix, itsolvers, jdsym, precon
path = os.path.join(os.environ['HOME'], 'matrices')
A = spmatrix.ll_mat_from_mtx(os.path.join(path, 'edge6x3x5_A.mtx'))
M = spmatrix.ll_mat_from_mtx(os.path.join(path, 'edge6x3x5_B.mtx'))
sigma = 25.0
Asigma = A.copy()
Asigma.shift(-sigma, M)
K = precon.jacobi(Asigma.to_sss())
del Asigma
##n = A.shape[0]
##I = spmatrix.ll_mat(n, n)
##for i in xrange(n):
## I[i,i] = 1.0
##K = precon.jacobi(I)
k_conv, lmbd, Q, it, it_inner = \
jdsym.jdsym(A.to_sss(), M.to_sss(), K, 5, sigma, 1e-10, 150, itsolvers.qmrs,
jmin=5, jmax=10, eps_tr=1e-4, toldecay=2.0, linitmax=200, clvl=1, strategy=1)
print k_conv, lmbd, it, it_inner
##path = '/homes/geus/jdbsym/test/'
##A = spmatrix.ll_mat_from_mtx(path + 'sameh_10000.mtx').to_sss()
##K = precon.ssor(A)
##k_conv, lmbd, Q, it, it_inner = jdsym.jdsym(A, None, K, 4, 0.0, 1e-10, 50, itsolvers.qmrs,
## jmax=20, eps_tr=1e-4, toldecay=2.0, linitmax=60, clvl=1)
##path = '../spmatrix/'
##A_ll = spmatrix.ll_mat_from_mtx(path + 'cop18_el5_A.mtx')
##M_ll = spmatrix.ll_mat_from_mtx(path + 'cop18_el5_M.mtx')
##A = A_ll.to_sss()
##M = M_ll.to_sss()
##k_conv, lmbd, Q, it, it_inner = jdsym.jdsym(A, M, None, 5, 5.0, 1e-4, 50, itsolvers.minres,
## linitmax=3000, strategy=1, clvl=1)
##path = '/homes/geus/jdbsym/test/'
##A = spmatrix.ll_mat_from_mtx(path + 'node4x3x1_A.mtx').to_sss()
##M = spmatrix.ll_mat_from_mtx(path + 'node4x3x1_M.mtx').to_sss()
##K = precon.jacobi(A)
##k_conv, lmbd, Q, it, it_inner = jdsym.jdsym(A, M, K, 15, 0.0, 1e-10, 150, itsolvers.qmrs,
## jmin=15, jmax=30, eps_tr=1e-4, toldecay=2.0, linitmax=60, clvl=1)
##print lmbd
|