help-gsl
[Top][All Lists]

## Re: [Help-gsl] gsl_blas_dtrsm

 From: James Bergstra Subject: Re: [Help-gsl] gsl_blas_dtrsm Date: Sun, 28 May 2006 12:09:11 -0400 User-agent: Mutt/1.4.2.1i

```On Sun, May 28, 2006 at 12:48:01PM +0200, Remi Vieux wrote:
> Hi all,
>
> Im trying to code in C a MatLab program. In the MatLab code, there is
> the instruction A\B, which is "left division" and equivalent to
> inv(A)*B. So I'm trying to compute this lattest instruction with GSL
> using the function gsl_blas_dtrsm, but I'm not quite sure how to do it.
...
> Does the matrix A has to be triangular to use this function? What
Yes.  If A is a triangular matrix, then multiplying by it's inverse is much
easier than if A is not triangular.  BLAS has only this simple algorithm, so
BLAS can't invert more general matrices.
> exactly is TransA for? Same question for the parameter Diag: what do you
> mean by "the diagonal of A is used or taken as unity"?
You can invert A or its transpose, according to this flag.  I imagine that the
unit diagonal is to speed things up, but perhaps it uses a slightly different
algorithm?

The next paragraph is written with less confidence... but...
So that all said, you will be wondering what to do with your non-triangular
matrix.  If you'd rather mess with syntax than algorithms, then you might look
at the LAPACK dgesv routine.  In the GSL, you should look at the linalg section.
Depending on what kind of special structure you have in your matrix (is it
symmetric?), you can try more or less general factoring techniques, which will
give you representations of your A matrix that facilitate solving A\B.  See the
linalg section for docs and examples.  There's work going on right now to add QR
factoring to linalg, but I think it's not done yet.

--
James Bergstra
http://www-etud.iro.umontreal.ca/~bergstrj

```