8000 Update doc · PythonOptimizers/HSL.py@7bc5f39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7bc5f39

Browse files
committed
Update doc
1 parent 8dbb29c commit 7bc5f39

File tree

6 files changed

+60
-2
lines changed

6 files changed

+60
-2
lines changed

doc/source/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Then, :program:`metis` and its dependencies can be installed automatically in `/
5252

5353
.. code-block:: bash
5454
55-
git clone https://github.com/PythonOptimizers/cysparse.git
55+
git clone https://github.com/PythonOptimizers/HSL.py.git
5656
5757
5858
2. Install the :program:`Python` dependencies:

doc/source/mc60_rcmk_sloan.pdf

18 KB
Binary file not shown.

doc/source/mc60_rcmk_sloan.png

24.4 KB
Loading

doc/source/ordering.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,26 @@ Example
3737

3838
.. literalinclude:: ../../examples/demo_mc60.py
3939
:linenos:
40+
41+
.. code-block:: none
42+
43+
The number of supervariables is 4
44+
The variable permutation is [3 5 4 1 2]
45+
The profile is 10.0
46+
The maximum wavefront is 3.0
47+
The semibandwidth is 3.0
48+
The root-mean-square wavefront is 2.09761769634
49+
50+
Using a matrix market matrix through :program:`CySparse`
51+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52+
.. literalinclude:: ../../examples/demo_rcmk_sloan.py
53+
:linenos:
54+
55+
.. figure:: mc60_rcmk_sloan.*
56+
57+
The sparsity pattern of the orginal matrix is shown on the left plot.
58+
The middle and right plots show the same matrix after a symmetric permutation of the rows and columns
59+
aiming to reduce the bandwidth, profile and/or wavefront. This is done respectively via the
60+
reverse Cuthill-McKee method and the algorithm of Sloan.
61+
62+

doc/source/scaling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Example
2626

2727
Output
2828

29-
.. code-block:: python
29+
.. code-block:: bash
3030
3131
orignal values:
3232
i j val

examples/demo_rcmk_sloan.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from hsl.ordering.mc60 import sloan, rcmk
2+
from cysparse.sparse.ll_mat import *
3+
import cysparse.types.cysparse_types as types
4+
5+
from pyorder.tools.spy import FastSpy
6+
import numpy as np
7+
import matplotlib.pyplot as plt
8+
9+
10+
A = LLSparseMatrix(mm_filename='bcsstk01.mtx', itype=types.INT32_T, dtype=types.FLOAT64_T)
11+
m, n = A.shape
12+
irow, jcol, val = A.find()
13+
14+
A_csc = A.to_csc()
15+
colptr, rowind, values = A_csc.get_numpy_arrays()
16+
17+
perm1, rinfo1 = rcmk(n, rowind, colptr) # Reverse Cuthill-McKee
18+
perm2, rinfo2 = sloan(n, rowind, colptr) # Sloan's method
19+
20+
left = plt.subplot(131)
21+
FastSpy(n, n, irow, jcol, sym=True,
22+
ax=left.get_axes(), title='Original')
23+
24+
# Apply permutation 1 and plot reordered matrix
25+
middle = plt.subplot(132)
26+
FastSpy(n, n, perm1[irow], perm1[jcol], sym=True,
27+
ax=middle.get_axes(), title='Rev. Cuthill-McKee (semibandwidth=%d)' % rinfo1[2])
28+
29+
# Apply permutation 2 and plot reordered matrix
30+
right = plt.subplot(133)
31+
FastSpy(n, n, perm2[irow], perm2[jcol], sym=True,
32+
ax=right.get_axes(), title='Sloan (semibandwidth=%d)' % rinfo2[2])
33+
34+
plt.savefig('mc60_rcmk_sloan.png',bbox_inches='tight')
35+
# plt.show()

0 commit comments

Comments
 (0)
0