|
| 1 | +# Generate the routines divide by slicot-chapters for sphinx-doc. |
| 2 | +# Only prints out the names, copy & past them into slycot_outer.rst and slycot_inner.rst. |
1 | 3 | import re |
2 | 4 | import pandas as pd |
3 | 5 | import matplotlib.pyplot as plt |
|
9 | 11 | def get_slycot_routines(sly): |
10 | 12 | all_attributes = dir(sly) |
11 | 13 | r = re.compile("[a-z][a-z][0-9][0-9a-z][a-z][a-z]") |
12 | | - matched_attributes = list(filter(r.match, all_attributes)) # Read Note below |
| 14 | + matched_attributes = list(filter(r.match, all_attributes)) |
13 | 15 | return matched_attributes |
14 | 16 |
|
15 | 17 | slycot_wrapper = get_slycot_routines(slycot) |
16 | 18 | slycot_wrapper.sort() |
17 | 19 | slycot_f2py_wrapper = get_slycot_routines(slycot._wrapper) |
18 | 20 | slycot_f2py_wrapper.sort() |
19 | 21 |
|
| 22 | +from itertools import groupby |
| 23 | +from operator import itemgetter |
| 24 | + |
20 | 25 | print(f"\nslycot_wrapper {len(slycot_wrapper)}\n") |
21 | | -for routine in slycot_wrapper: |
22 | | - print(routine) |
| 26 | +for chapter_letter, chapter_routines in groupby(sorted(slycot_wrapper), key=itemgetter(0)): |
| 27 | + print(chapter_letter) |
| 28 | + for routine in chapter_routines: |
| 29 | + print(routine) |
| 30 | + print("\n") |
23 | 31 |
|
24 | 32 | print(f"\nslycot_f2py_wrapper {len(slycot_f2py_wrapper)}\n") |
25 | | -for routine in slycot_f2py_wrapper: |
26 | | - print("_wrapper."+routine) |
27 | | - |
| 33 | +for chapter_letter, chapter_routines in groupby(sorted(slycot_f2py_wrapper), key=itemgetter(0)): |
| 34 | + print(chapter_letter) |
| 35 | + for routine in chapter_routines: |
| 36 | + print("_wrapper."+routine) |
| 37 | + print("\n") |
0 commit comments