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:
|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:
import oct2py import numpy as np def myinv(A,b,maxentLambda): oc = oct2py.Oct2Py(oned_as='column') oc.addpath('ReguTools') xhat = oc.maxent(A,b,maxentLambda) return xhat
PC Hansen AIRtools and Regutools in Python.