|
-
May 29th, 2008, 10:17 PM
#1
Thread Starter
Fanatic Member
Numerical Linear Algebra in Excel - LAPACK
If you've ever wanted to have the power of LAPACK available in Excel, there is a way bring these robust numerical linear algebra routines into the world of VBA:
1. Get a Fortran compiler. There are free ones like G95.
2. Compile the LAPACK routines (source available for free) and create a DLL
3. Within VBA, write API-like delcare statements for each desired LAPACK routine. These statements are the basic interface between the DLL and VBA.
4. Within VBA, write a wrapper routine for each desired LAPACK routine. The wrapper includes the necessary work arrays that LAPACK needs (LAPACK routines don't allocate any memory). The wrapper routines can be written as custom spreadsheet functions and/or called by other VBA routines.
5. Bundle the routines from steps 3 & 4 into an Excel Add-In. The net result is two files: a DLL and an Excel Add-In.
Of course, basic numerical linear algebra can be done using Excel's built-in matrix routines (transpose, multiplication, inverse), but if you want more (e.g. find matrix factorizations such as LU, QR, SVD, LDLT, determine matrix condition numbers, or solve linear equations, least squares problems, constrained least squares problems, or eigenvalue problems), something more is needed. LAPACK is a classic set of robust numerical linear algebra Fortran 77 routines that have been in development since the 70's - the latest version was in 2006.
An even better approach might be to write the wrapper routines in Fortran (to allocate the memory) and create an ActiveX DLL that can be used directly by Excel w/o the tedious API-like statements. I just wish I knew how to do this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|