Attached is a tar ball (~2K size) of a program for matrix inversion "inv.py" (using numpy) and the Qt Designer generated file "inv.ui". To run the program one needs to process "inv.ui" as follows:
pyside-uic inv.ui > ui_inv.py The program can generate a singular or near singular matrix of a certain type and attempt to invert it. The gui shows in a plainTextEdit window the default parametes which may be altered at will. The OK button starts the execution of inversion attempt and displays the results. The inversion is done with numpy package (what else is there?). The default values are for a 5x5 matrix. The five rows are 1, 2, 3, 4, 5 6,7, 8. 9, 10 11,12 etc. In this case numpy correctly identifies the matrix as singular. If the gui program is started from CLI, numpy issues a statement that the matrix is singular. If the gui is started by clicking with the mouse a link to the executable, no warning can be seen and the gui just fails very quietly. That is why I seek help from this list - how can one ensure that the numpy message is identified by the gui? It may be of interest to note that if the first parameter is changed to 2. and OK clicked the program generates a 2x2 matrix, which is not singular, so the program inverts it, displays the inverse and the matrix of inverse * (the original matrix) with the result close to a unit matrix. For 3x3 and 4x4 nothing is detected and the program shows the meaningless, though formally correct, matrix algebra results. In the practical area of analysis of engineering structures, in a large class of problems singularity of stiffness matrix shows that a structure has become unstable. Unfortunately for the structural engineer the stiffness matrix is not a simple set of integers that have been converted to floating variables and the matrix is not "exactly" singular, but only very ill conditioned. The last two paragraphs are well outside the scope of GUI programming, but it clearly shows IMO that it would be useful to "catch" what numpy is saying about the matrix singularity. I just don't know how to "catch" it with PySide (or PyQt for that matter). TIA, OldAl. -- Algis http://akabaila.pcug.org.au
inversion.tar.gz
Description: application/compressed-tar
_______________________________________________ PySide mailing list [email protected] http://lists.openbossa.org/listinfo/pyside
