For those working with real-world inverse problems, P.C. Hansen’s AIRtools and ReguTools are great ways to quickly try out inverse methods.
As in general in Python and Matlab, you need to be sure that your column vector of observations “b” is actually passed into the functions as a column vector.
I’ll illustrate the issue by example.
Assume you have ill-conditioned problem Ax = b, with dimensions:
variable
dimensions
A
256 x 10
x
10 x 1
b
256 x 1
so to use the ReguTools function maxent.m from Python, implementing the
Berg Maximum Entropy method, your myinv.py file would look like:
Assuming an OCR’d book or other text file that has line numbers embedded in file neat.py:
1 # cool program
2 import sys
3 def howneat():
4 sys.exit('Thanks for visiting')
Remove the line numbers by typing in Terminal:
perl -pe 's/^[ t]+d+//' neat.py > neater.py
Regular expression:
^[ t]+d+
\^
beginning of the line
[ t]+
match space or tab (one or more)
d+
match one or more digits
-p
implicitly loop over (read each line of) the file neat.py.
-e
enable PCRE
And we replace with nothing.
This leaves alone the indentation of the code (relevant for Python).
I could have used the -i flag to edit in place, but I instead redirected STDOUT to neater.py in case I made a mistake (inputting the wrong file, for example).
This
Python program extracts the LaTeX
word count and equation count and several other counts such as floating element count from a LaTeX document set, using the Perl script texcount.
Phoronix Test Suite is a well regarded benchmarking suite that supports most operating systems.
This gives the ability to accurately benchmark operating system performance errors, and has been used to find Linux kernel performance regressions.