help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] C++ wrapper for linear algebra


From: Jordi Gutiérrez Hermoso
Subject: Re: [Help-gsl] C++ wrapper for linear algebra
Date: Mon, 5 Nov 2007 13:39:28 -0600

On 02/11/2007, Hasan Hasanov <address@hidden> wrote:
> I am looking for a C++ wrapper for the GSL.

I have a very minimal and probably not great implementation of such a
wrapper below which you may find interesting. I can at least vouch
that it's quick enough if you compile with optimisations (the -03 in
g++), and that it leaks no memory. It also has operator>> and
operator<< overloaded for easier input and output of matrices in text
format. In fact, it reads and writes in the same text format suitable
for GNU Octave. I index from 1 and use operator() for indexing,
because I'm a heavy Octave user. I attach this implementation with my
own hand-written Makefile and a sample main.cpp to demonstrate its
usage. Type "make test" in the directory where you extract the tarball
to compile and run the example.

> It is also very important that it implements an efficient matrix
> inversion operator.

The GSL itself only has a few matrix inversion algorithms. It does
pivoted LU factorisation for inverting matrices. If your matrices have
no specific structure, this is is more or less the best you can do.
You can also try tridiagonal reductions or Householder
transformations. My wrapper just uses the GSL's LU.

> Since Octave is the GNU analogue of Matlab I am wondering if
> Octave has an C++ API for matrix operations that would be an alternative to
> the above two wrappers?

It does. I have not used it much, but others seem to find it useful.

- Jordi G. H.

Attachment: linalg.tar.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]