* matrix multiplication
2001-12-19 13:20 matrix multiplication Matthew J. Doller
@ 2001-11-27 12:47 ` Matthew J. Doller
2001-12-19 13:20 ` Dan, Ho-Jin
1 sibling, 0 replies; 7+ messages in thread
From: Matthew J. Doller @ 2001-11-27 12:47 UTC (permalink / raw)
To: gsl-discuss
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
--
Matthew J. Doller
mdoller@wpi.edu
http://www.wpi.edu/~mdoller
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: matrix multiplication
2001-12-19 13:20 ` Dan, Ho-Jin
@ 2001-11-27 12:54 ` Dan, Ho-Jin
2001-12-19 13:20 ` Dan, Ho-Jin
1 sibling, 0 replies; 7+ messages in thread
From: Dan, Ho-Jin @ 2001-11-27 12:54 UTC (permalink / raw)
To: gsl-discuss
[-- 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;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* matrix multiplication
@ 2001-12-19 13:20 Matthew J. Doller
2001-11-27 12:47 ` Matthew J. Doller
2001-12-19 13:20 ` Dan, Ho-Jin
0 siblings, 2 replies; 7+ messages in thread
From: Matthew J. Doller @ 2001-12-19 13:20 UTC (permalink / raw)
To: gsl-discuss
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
--
Matthew J. Doller
mdoller@wpi.edu
http://www.wpi.edu/~mdoller
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: matrix multiplication
2001-12-19 13:20 matrix multiplication Matthew J. Doller
2001-11-27 12:47 ` Matthew J. Doller
@ 2001-12-19 13:20 ` Dan, Ho-Jin
2001-11-27 12:54 ` Dan, Ho-Jin
2001-12-19 13:20 ` Dan, Ho-Jin
1 sibling, 2 replies; 7+ messages in thread
From: Dan, Ho-Jin @ 2001-12-19 13:20 UTC (permalink / raw)
To: gsl-discuss
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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: matrix multiplication
2001-12-19 13:20 ` Dan, Ho-Jin
2001-11-27 12:54 ` Dan, Ho-Jin
@ 2001-12-19 13:20 ` Dan, Ho-Jin
1 sibling, 0 replies; 7+ messages in thread
From: Dan, Ho-Jin @ 2001-12-19 13:20 UTC (permalink / raw)
To: gsl-discuss
[-- 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;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: matrix multiplication
2002-07-22 8:42 Daniel T Konkle
@ 2002-07-24 15:25 ` Brian Gough
0 siblings, 0 replies; 7+ messages in thread
From: Brian Gough @ 2002-07-24 15:25 UTC (permalink / raw)
To: Daniel T Konkle; +Cc: gsl-discuss
Daniel T Konkle writes:
> I need to implement S = A' * A where A' is the transpose of A.
> Is it possible to do it like this:
> gsl_blas_dgemm( CblasTrans, CblasNoTrans, 1.0, A, A, 0.0, S );
> or do I need to copy the contents of a into a temporary matrix
> first
> gsl_matrix_memcpy( B, A ); gsl_blas_dgemm( CblasTrans,
> CblasNoTrans, 1.0, A, B, 0.0, S );
If you look at the function definition in the gsl_blas.h header file
or the manual the 'const' keyword shows which arguments are not
modified.
regards
Brian Gough
^ permalink raw reply [flat|nested] 7+ messages in thread
* matrix multiplication
@ 2002-07-22 8:42 Daniel T Konkle
2002-07-24 15:25 ` Brian Gough
0 siblings, 1 reply; 7+ messages in thread
From: Daniel T Konkle @ 2002-07-22 8:42 UTC (permalink / raw)
To: gsl-discuss
I need to implement S = A' * A where A' is the transpose of A.
Is it possible to do it like this:
gsl_blas_dgemm( CblasTrans, CblasNoTrans, 1.0, A, A, 0.0, S );
or do I need to copy the contents of a into a temporary matrix first
gsl_matrix_memcpy( B, A );
gsl_blas_dgemm( CblasTrans, CblasNoTrans, 1.0, A, B, 0.0, S );
Thanks,
Danny
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-07-24 22:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-19 13:20 matrix multiplication Matthew J. Doller
2001-11-27 12:47 ` Matthew J. Doller
2001-12-19 13:20 ` Dan, Ho-Jin
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
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).