Autorej.py

(a.k.a. Autoreg, for Automatic Regularization. Autorej uses my initials, REJ)

A Python Module for Automatic Regularization of Ill-Conditioned Linear Systems

 

What this is:

Autorej.py is a complete package for AUTOMATICALLY solving difficult linear algebra systems (or “matrix problems”). The methods here are based on my Ph.D. dissertion quite some years ago. These methods have been available narrowly in C++ for several years, but we recently decided to migrate them to Python. Please see the Tutorial below for a full presentation on this method. These methods, at their core, rely on detailed analysis of the Picard Condition. Basically, these methods completely free the user who has a difficult, usually ill-conditioned problem from worrying about :

·         choosing a rank to use

·         choosing a level of singular value to zero when using a Generalized Inverse

·         estimating the error in the matrix coefficients

·         estimating the error in the right hand side

·         choosing the Tikhonov regularization parameter, lambda

To solve a matrix problem, A*x=b, create the matrix A and right hand side vector b (preferably using np.array) and call autoreg:

Import autorej

. . . . define the numpy 2-D array, or “matrix” A and the right hand side b . . . .

P=Problem(A,b)

x=P.solve()

If the solution must be nonnegative and the above result does not satisfy that, just say:

X=P.solve_nonneg()

If you have a special situation, such as needing the solution to add to, say, 100.0 percent, then just create the constraint equation coefficients and the desired sum, or whatever is on the right hand side, and call for a constrained solution:

X=P.solve_constrained(np.ones(A.shape[1]),100.0)

Then sit back and see the magic!

Resources:

You may download this Python module here:  autorej.py.

Here is a brief Guide to use of autorej.py.

To see the short demo of autorej working please down demo1.py and run it in Python.  In this demo we set up a classic difficult matrix problem (with a Hilbert matrix) and solve it with PseudoInverse (bad) and autorej (good).

To see Demo2,  download this zip file: demo2.zip  and unzip the files into your Python work area. In Demo2.py we read a 13 row by 17 column inverse heat problem from a file, solve it two different ways. We also show how read a problem from a file, save the results to a file, and save the graphs as *.png files.

These fully worked small examples do not require you  to run anything:

Demo 3: Garden Fertilizer Calculation  

Demo4: A Problem from Oil-Well Logging

Demo5: A Problem with Stucco color

Demo 6: Solving Equations to Play MineSweeper

Here is a tutorial for beginners on why linear equation can be so hard to solve.

Contact us:

Rondall E. Jones, Ph.D. (*)

rejones7@msn.com

Sandia Laboratories, Albuquerque, 1967-2011

Publications: Please Google “Rondall Jones Sandia” and ignore results not containing the exact spelling of “Rondall”

(*) University of New Mexico, 1985

Dissertation: Solving Linear Algebraic Systems Arising in the Solution of Integral Equations of the First Kind

Advisor: Cleve B. Moler, creator of MATLAB and co-founder of MathWorks