From: "Dan, Ho-Jin" <hjdan@sys713.kaist.ac.kr>
To: gsl-discuss <gsl-discuss@sources.redhat.com>
Subject: Re: matrix multiplication
Date: Tue, 27 Nov 2001 12:54:00 -0000 [thread overview]
Message-ID: <3C0AFA50.4060604@sys713.kaist.ac.kr> (raw)
Message-ID: <20011127125400.63VtTLaV1iem6JSid5fHZICJJwZFDwd6840ka-wqUlU@z> (raw)
In-Reply-To: <1007346875.25380.0.camel@mrburns>
[-- Attachment #1: Type: text/plain, Size: 483 bytes --]
try to use level 3 of blas.
gsl supports blas interfaces. A simple example is attatched. gsl_gemm.c
LDFLAGS=-lgsl -lgslcblas -lm
yours
Dan, Ho-Jin
Matthew J. Doller wrote:
>someone correct me if i am wrong, but is there really no way of
>multiplying two matrices, or a matrix and a vector with gsl
>i know i can go element by element, but i'm looking for something of the
>form:
>
>return_matrix = gsl_matrix_mul_matrix_by_matrix ( matrix_one ,
>matrix_two );
>
>thanks!
>matt
>
[-- Attachment #2: gsl_gemm.c --]
[-- Type: text/plain, Size: 652 bytes --]
#include <stdio.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
int main()
{
double A[] = {
1., 2.,
3., 4.
};
double B[] = {
2., 3.,
4., 5.
};
double alpha = 1., beta = 0.;
gsl_matrix_view A_m = gsl_matrix_view_array(A, 2, 2);
gsl_matrix_view B_m = gsl_matrix_view_array(B, 2, 2);
gsl_matrix *C = gsl_matrix_alloc(2,2);
gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, alpha, &A_m.matrix,
&B_m.matrix, beta, C);
printf("[[\n%f\t%f\n%f\t%f]]\n",
gsl_matrix_get(C, 0, 0), gsl_matrix_get(C, 0, 1),
gsl_matrix_get(C, 1, 0), gsl_matrix_get(C, 1, 1));
gsl_matrix_free(C);
return 0;
}
next prev parent reply other threads:[~2001-12-03 4:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-19 13:20 Matthew J. Doller
2001-11-27 12:47 ` Matthew J. Doller
2001-12-19 13:20 ` Dan, Ho-Jin [this message]
2001-11-27 12:54 ` Dan, Ho-Jin
2001-12-19 13:20 ` Dan, Ho-Jin
2002-07-22 8:42 Daniel T Konkle
2002-07-24 15:25 ` Brian Gough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3C0AFA50.4060604@sys713.kaist.ac.kr \
--to=hjdan@sys713.kaist.ac.kr \
--cc=gsl-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).