This post looks at linking Excel to the Scipy linear algebra functions using pyxll, and also using the PyPardiso solver. Previous posts on this topic include:
- Making finite element analysis go faster
- Making finite element analysis go faster – update and pypardiso/
- Installing Pypardiso and speed of scipy spsolve
- LU decomposition with python and scipy
- scipy-linear-algebra-functions-in-excel/
- Speed of scipy linear algebra solvers
The pyLinAlgfuncs3 spreadsheet, with associated Python code in pyLinalgfuncs3.py and pyScipy3.py, are included in the download file:
Details of the required pyxll package (including download, free trial, and full documentation) can be found at: pyxll
For those installing a new copy of pyxll, a 10% discount on the first year’s fees is available using the coupon code “NEWTONEXCELBACH10”.
The pyLinAlgfuncs3 spreadsheet includes links to many different solver functions and associated utility functions, but for most purposes the py_Solve (for dense matrices) or py_SpSolve (for sparse matrices) will be most efficient. Note that the py_SpSolve function calls the fast PyPardiso sparse solver if it is installed, or the Scipy spsolve function if not.

Links to the Scipy on-line help are available for most of the functions by opening the function dialog box, and clicking on “Help on this function” in the bottom left corner:

This links to the Scipy help for the associated Scipy fumction:

Input of the matrix to be solved may be in alternative formats:
- A complete square matrix on the spreadsheet.
- A linked list in COO format on the spreadsheet
- A pyxll cache object. Note that this option allows links to Python generated arrays that would be too big to transfer to a spreadsheet, and will also be much faster for very large matrices.

The SpSolveit sheets has functions linking to 10 alternative sparse iterative solvers.

See Speed of Scipy Linear Algebra Solvers for more information on the relative speed of the solvers for typical structural engineering applications.
The LuSolve sheet has functions for factorisation and solving using LU factorisation.

ChoSolve has Cholesky and banded solvers:

Python_LU has functions demonstrating background to the LU solver approach. See LU decomposition with python and scipy for more details.

Finally the Misc sheet has examples of various matrix related functions:

Pingback: Scipy Linalg functions stopped working | Newton Excel Bach, not (just) an Excel Blog