help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Declaring GSL Matrices


From: Matthew Boulton
Subject: Re: [Help-gsl] Declaring GSL Matrices
Date: Mon, 13 Aug 2007 17:22:23 +0100
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

An excellent idea, I'll give it a try.

Kind Regards,

Matt


Rutger van Haasteren wrote:
Hi Matt,

it looks like you are using the permutation matrix "indx" in 2 different functions (main and check_stamps). These are 2 different variables, so naturally you have to declare them both. Give it as an argument to your function. If you do not know how to do this, try to search for a c++ tutorial on google, because it is reasonable basic stuff that doesn't belong in a GSL discussion. Good luck!

Rutger



On 8/13/07, *Matthew Boulton* <address@hidden <mailto:address@hidden>> wrote:

    Hello. I'm having a bit of an issue with implementing GSL matrices.
    Basically at the moment when I declare a permutation matrix in a
    particular function called by the main function, that matrix is not
    considered to be declared if I try and use it later on in my main
    function.

    For example, I declare a matrix called indx in check_stamps() as
    follows:

      gsl_permutation * indx = gsl_permutation_calloc( ncomp_total + 1
    + 100 );

    Now bear in mind that line is in the check_stamps() function, my main
    function looks as follows:

      check_stamps();
      printf("Expanding Matrix\n");
      mat_size = (ncomp_kernel - 1) * ((( deg_spatial + 1 ) * (
    deg_spatial
    + 2 )) / 2) + ((( deg_bg + 1 ) * ( deg_bg + 2 )) / 2) + 1;
      gsl_matrix *matrix = gsl_matrix_calloc( ncomp_total + 1 + 100 ,
    ncomp_total + 1 + 100);   /* Declare matrix */
      matrix = build_matrix();
      printf("Expanding Matrix Done\n");
      build_scprod(sub_image);
      ncomp_total = (ncomp1 - 1) * ncomp2 + 1 + ncomp_bg; /* = mat_size
    (Size of matrix) */
    /* gsl_permutation *indx = gsl_permutation_calloc( ncomp_total + 1
    + 100
    );  Has same dimension as 'matrix' but is 1D */
      gsl_linalg_LU_decomp( matrix , indx , d );

    Sadly this will not compile unless I remove the commented out
    line, but
    this means I am declaring the same matrix twice.

    Is this a common problem or have I simply not implemented this
    correctly?

    Kind Regards,

    Matt


    _______________________________________________
    Help-gsl mailing list
    address@hidden <mailto:address@hidden>
    http://lists.gnu.org/mailman/listinfo/help-gsl




--
Matthew Boulton
Level 4 Physics and Astronomy
Collingwood College

address@hidden





reply via email to

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