[Top][All Lists]

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

Re: [Help-gsl] Can I create a symmtric matrix?

From: Shixin Zeng
Subject: Re: [Help-gsl] Can I create a symmtric matrix?
Date: Wed, 18 May 2005 14:47:27 +0800
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Brian Gough wrote:

Shixin Zeng writes:
> I'm writing a FEM(Finite Elements Mothed) program using gsl to do > matrix/vector operations. > For the matrix is very big and symmetric, so I'm wondering if there > is a way to create a symmetric matrix? I've read the manual, but I can't > find any functions to do so.

The raw CBLAS functions have support for packed (symmetric) matrices.
What do you mean by "support"? I guess you mean that CBLAS functions get/set elements of matrix merely via _get/_set functions, rather than visit the memory occupied by that element directorly, so if I implement myself _get/_set methods of matrices, then CBLAS will work fine, is it?

GSL matrices don't have this, but you could define a few _get/_set
packed access functions for such matrices.

Could you give me some examples?
Could I do it like this?

typedef struct {
     gsl_matrix m;
} my_sym_matrix;

my_sym_matrix* *my_sym_matrix_alloc*(size_t, size_t);
double *my_sym_matrix_get* /(const gsl_matrix * m, size_t i, size_t j);
/void *my_sym_matrix_set* /(gsl_matrix * m, size_t i, size_t j, double x);
/|void|/| |/*my_sym_matrix_free*/(my_sym_matrix *m);

/Then, just treat my_sym_matrix as gsl_matrix for other operations?
But how CBLAS/gsl functions invoke my_sym* functions?

Thanks for your reply.

Best regards
Shixin Zeng

reply via email to

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