[Top][All Lists]

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

[Help-gsl] gsl_matrix_alloc_from_block() usability?

From: Alejandro Cámara Iglesias
Subject: [Help-gsl] gsl_matrix_alloc_from_block() usability?
Date: Wed, 1 Sep 2010 00:18:40 +0200

Hello there,

I'm trying to design a custom structure that is gsl_matrix* compatible and
also has some extra members. The prototype is basically:

   |- dimensions (unsigned int)
   |- N[] (size_t)
   |- d[] (double)
   |- type (enum)
   |- data[] (double *)

In order to be able to use the gsl_matrix* operations I need to construct a
gsl_matrix* structure from mine. For that purpose I'm thinking in building a
gsl_block* structure in which the *data member points to the
gico_object->data pointer. Then, calling the gsl_matrix*_alloc_from_block
using an offset = 0, n1 = N[0], n2 = N[1], d2 = n2, and making its block
pointer point to the gsl_block* that I created previously (which points to
the double* of my struct), I can create a gsl_matrix* structure that points
to the data of my gico_object.

Now the questions:

   1. Am I cracking nuts with sledgehammers? or equivalently, do you think
   there is any easier way to accomplish that?
   2. Why is the gsl_matrix_alloc_from_block() function undocumented? Is it
   stable? I've been browsing the code and I believe it is not used internally.

Notice that the workaround that involves the creation of different
gico_objects, one for each gsl_matrix* structure, is not contemplated. The
whole purpose is to be able to create a single function that works for both
real or complex data.

Thanks in advance!

*Alejandro Cámara*
PhD Student at the GICO <>

reply via email to

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