help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Matrix / Vector multiplication


From: John D Lamb
Subject: Re: [Help-gsl] Matrix / Vector multiplication
Date: Sun, 11 Feb 2007 08:43:21 +0000

On Sun, 2007-02-11 at 02:28 -0500, Peter Jay Salzman wrote:
> Just discovered GSL a few hours ago.  Very neat!

> I've been trying to figure out how to multiply a vector and matrix.  How is
> one supposed to compute something like
> 
>    A x
> 
> given a gsl_matrix A and a gsl_vector x?   Does x need to be defined as a
> nx1 gsl_matrix for a column vector and a 1xn gsl_matrix for a row vector?

Look at the documentation for gsl_blas_dgemv. The vector x should be a
gsl_vector and the result a vector y. Vectors and matrices are passed as
pointers. You should end up with something like

#include<gsl/gsl_blas.h>
...

err = gsl_blas_dgemv( CblasNoTrans, 1.0, A, x, 0.0, y );


-- 
JDL





reply via email to

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