Solving System of Linear Equations in Microsoft EXCEL with Various Open Source Libraries

General purpose open source numerical analysis libraries for solving system of linear equations are used to interface with more specified numerical analysis procedures such as Finite Element Analysis.
They are built as dynamic link libraries and iterfaced with VBA, so that they can be easily used as EXCEL’s worksheet functions.

Open Source Libraries Used and their dlls

  1. EIGEN
    eigen.dll
  2. ALGLIB
    alglib.dll
  3. LAPACK with OpenBLAS
    lapack_and_openblas.dll
  4. Reference algorithm implementations
    targa.dll
    triangular_solver.dll
  5. Additional libraries related to MSYS2
    libwinpthread-1.dll
    libgcc_s_seh-1.dll
    libgfortran-5.dll
    libquadmath-0.dll
    lapack and openblas dlls are built under MSYS2 and depend on these additional libraries

Installation

  1. Copy library files to your specific folder (e.g. C:\NumericalAnalysisLibrary).
  2. Add that folder to PATH environment variable of Windows.

Testing in Microsoft EXCEL

  1. Open NumericalAnalysisLibrary.xlam
    Optionally, if this file is registered as an EXCEL ADD-IN, it is not necessary to open this file every time you use this library.
  2. Open test_NumericalAnalysisLibrary.xlsm
  3. In test_NumericalAnalysisLibrary.xlsm, input equation (variable) numbers in D4 cell and right hand side vector numbers in D5 cell and select solver to test in D6 cell. Available solvers are listed in range M5:M39

Sample Test Result

If equations and rhs columns are set to 5 and 3 and EIGEN’s PartialPivLU_decompose is selected as an solver, then the intermediate process and results will be output as follows. At the end of the result worksheet, residual value of solution is also output as an verification of the solver. You can also refer to named ranges defined in output worksheet.

Download

Support or Contact

Having any question using this library, please leave a reply to this post or contact me by jangwj7@gmail.com.