Exploring MATLAB Alternatives: LAPAC Libraries & Versions

In summary, the conversation discussed the use of MATLAB in school, its high cost and resource usage, and its original foundations in LINPAC and EISPACK libraries. The conversation also mentioned the availability of LAPAC in FORTRAN 90 and FORTRAN 77 and its similarity to MATLAB in terms of matrix operation syntax. LAPACK was also mentioned as an upgraded version of LAPAC that runs faster on modern cache-based architectures. The conversation further discussed the availability of LAPAC in various languages, including C, C++, Java, Haskell, OCaml, and C# through tools such as Boost uBLAS numerics bindings. The benefits and drawbacks of using LAPACK over LINPACK were also mentioned. The conversation then shifted to the use of
  • #1
John Creighto
495
2
I used MATLAB a lot in school but it is very expensive and uses, a lot of resources and it isn't installed on most computers. MATLAB was originally built upon the math libraries:
LINPAC and EISPACK,

The MATLAB libraries were MATLAB later upgraded to LAPAC

I believe the above libraries are available in both FORTRAN 90 and fortran 77. I swear I've looked at some FORTRAN90 which I swear has matrix operation syntax that has a very simmilar syntax to MATLAB.

As I understand LAPAC can run very fast in certain systems:

LAPACK, in contrast, depends upon the Basic Linear Algebra Subprograms (BLAS) in order to effectively exploit the caches on modern cache-based architectures, and thus can run orders of magnitude faster than LINPACK on such machines, given a well-tuned BLAS implementation. LAPACK has also been extended to run on distributed-memory systems in later packages such as ScaLAPACK and PLAPACK.
LAPAC has several versions:
* http://en.wikipedia.org/w/index.php?title=Clapack&action=edit&redlink=1 for C (especially useful if there is no Fortran Compiler available, as it is already preprocessed with f2c)
* LAPACK++ for C++
* http://en.wikipedia.org/w/index.php?title=Jlapack&action=edit&redlink=1 for Java
* http://en.wikipedia.org/w/index.php?title=HBlas&action=edit&redlink=1 for Haskell
* http://www.ocaml.info/home/ocaml_sources.html#LACAML for OCaml
* Boost uBLAS numerics bindings (http://svn.boost.org/svn/boost/sandbox/boost/numeric/bindings/ ) for C++.

If your are not running a system which takes advantages of these optimizations then I believe that their are several advantages to these alternative LAPAC alternatives. The first is that Microsoft products tend to be built from C and C++ libraries. It is possible to build a DLL from FORTRAN source could but it is less common. Therefor tools will be harder to get to integrate FORTRAN with C. Additionally there are some internal differences that must be considered when interfacing C with FORTRAN

One difference between C and Fortran lies in the way matrices are stored in memory, so that we have to transpose our matrices before we can pass them to a Fortran routine.
Another difference is the way arguments are passed to a subroutine in C and Fortran. In Fortran the argument is passed to the routine and the routine can read and change this value. This mechanism is called call by reference. In C a copy of the value of the argument is passed to the routine and not the argument itself, the subroutine can't change the value of the argument. This mechanism is called call by value. To use call by reference in C, we have to pass pointers to variables instead of the variables themself to the routine.
http://www.physics.oregonstate.edu/~rubin/nacphy/lapack/cprogp.html

The C implementation of LAPAC should be useful for anyone who does low level microprocessor stuff since C is low level and is the most common language available for microprocessors. The C implementation was created by using the f2c language translator. However, for low level stuff a C version of LINPAC may be preferable to a C version of LAPAC.

LINPACK has officially been superseded by the LAPACK library. The LAPACK library uses more modern algorithms and code structure. However, the LAPACK library can be extraordinarily complex; what is done in a single LINPACK routine may correspond to 10 or 20 utility routines in LAPACK. This is fine if you treat LAPACK as a black box. But if you wish to learn how the algorithm works, or to adapt it, or to convert the code to another language, this is a real drawback. This is one reason I still keep a copy of LINPACK around.
http://people.sc.fsu.edu/~burkardt/f_src/lapack/lapack.html
http://people.sc.fsu.edu/~burkardt/f_src/linpack/linpack.html
http://people.sc.fsu.edu/~burkardt/m_src/linpack/linpack.html
http://people.sc.fsu.edu/~burkardt/f_src/linpack/linpack.html

Not being in school I don't do any microprocessor programing. I tend to do most programing in Microsoft office application. Specifically I now write most code as macros for excel and Access. I do this much more frequently then I use MATLAB.

Macro's for Microsoft office applications are written in visual basic. The reason I use visual basic more then MATLAB is most people have Microsoft Office while most people do not Have MATLAB. Even large engineering companies may be surprisingly limited on what software they have available.

Now none of the above libraries I mentioned contain visual basic versions of the library. However, there is a JAVA version of the libraries. JAVA is nice because it is multi platform and generally not considered a security risk as it can be run in a sandbox. Or at least it is considered less of a security risk then compiled files (e.g. .exe .dll)

Thus one clear alternative is to try and call JAVA from visual basic. The other is to convert the JAVA versions of the libraries to microsofts alternative to JAVA (AKA C#). Microsoft has the following tool available to convert JAVA to C#.
http://www.microsoft.com/downloads/...9b4f-904b0a973174&displaylang=en#Instructions
http://www.developer.com/net/csharp/article.php/2235411

Both C# and java are multiplatform but I suspect that C# is better integrated with Microsoft products. It is not as restrictive as JAVA. For instance pointers are allowed. Additional A C# compiler comes with every version of windows from windows XP and up.

Given the availability of C# compiler and that it is well integrated with Microsoft products I'm learning towards converting the JAVA version of LAPAC to C# and using a C# version of the library for when I want to use math functionality that is beyond what is available in excel.

The JAVA version of the library is available here:
http://www.netlib.org/java/f2j/

And here is a language comparison between JAVA and C#:
http://www.javacamp.org/javavscsharp/
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Hello,

Thank you for sharing your thoughts and ideas on alternative options for using LAPACK libraries. I completely understand the need for efficient and accessible tools for mathematical computations. It is true that MATLAB can be expensive and not easily available on all computers. Your suggestion of using LAPACK libraries in FORTRAN is a great alternative, especially for those who are familiar with the language.

I also appreciate your insight on the differences between C and FORTRAN, and how it can affect the way matrices are stored and arguments are passed to subroutines. It is important to consider these differences when integrating different languages and libraries.

Your idea of converting the JAVA version of LAPAC to C# is very interesting. C# is definitely a popular language among Microsoft users and having a C# version of the library would make it more accessible. I believe many scientists and engineers would benefit from this conversion.

Thank you for sharing the links to the JAVA version of LAPAC and the language comparison between JAVA and C#. I will definitely look into these resources and consider using a C# version of the library in my work.

Thank you again for your contribution to this forum post. Your insights and suggestions are greatly appreciated. Let's continue to explore and share alternative options for using LAPACK libraries.
 

FAQ: Exploring MATLAB Alternatives: LAPAC Libraries & Versions

What are the benefits of using LAPAC libraries in MATLAB?

LAPAC (Linear Algebra Package) libraries provide efficient and reliable algorithms for performing linear algebra calculations, such as matrix operations and solving systems of linear equations. By using LAPAC libraries in MATLAB, users can improve the speed and accuracy of their calculations.

Are there any limitations to using LAPAC libraries in MATLAB?

One limitation of using LAPAC libraries in MATLAB is that they may not be compatible with all versions of MATLAB. Some LAPAC libraries may only work with specific versions, so it is important to check compatibility before using them.

What are some popular alternatives to LAPAC libraries in MATLAB?

Some popular alternatives to LAPAC libraries in MATLAB include BLAS (Basic Linear Algebra Subprograms) libraries and the Intel Math Kernel Library (MKL). These libraries also provide efficient linear algebra algorithms for use in MATLAB.

How can I determine which LAPAC library is compatible with my version of MATLAB?

The best way to determine compatibility is to check the documentation of the LAPAC library you are interested in using. The documentation should list the MATLAB versions that are supported. Alternatively, you can contact the developers of the LAPAC library for more information.

Can I use multiple LAPAC libraries in MATLAB?

Yes, it is possible to use multiple LAPAC libraries in MATLAB. However, it is important to make sure that the libraries are compatible with each other and with your version of MATLAB. It may also be necessary to configure MATLAB to use the desired LAPAC library for specific calculations.

Similar threads

Replies
1
Views
1K
Replies
18
Views
6K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
49
Views
10K
Replies
4
Views
4K
Replies
13
Views
2K
Back
Top