[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] adding gsl_combination elements to gprtarray in glib but
From: |
Awhan Patnaik |
Subject: |
Re: [Help-gsl] adding gsl_combination elements to gprtarray in glib but cannot retrieve |
Date: |
Mon, 2 Sep 2013 00:18:23 +0530 |
> From: Analabha Roy <address@hidden>
> To: address@hidden
> Subject: [Help-gsl] adding gsl_combination elements to gprtarray in
> glib, but cannot retrieve
>
> As you can see, it prints the combinations correctly in the do...while loop
> where the combinations are iterated, but only prints the lexicographically
> final combination when the gptrarray elements are iterated in the
> subsequent loop.
>
> What am I doing wrong?
> Thanks in advance,
> AR
>
each time g_ptr_array_add (basis, c) adds the SAME address i.e the
value of c thus g_ptr_array_index (basis, istride) for istride = 0 to
83 will all have the same value that of c.
gsl_combination_next (c) just updates the content but of course does
not change the address of c.
so whatever was the combination last produced will be printed as per your code.
you may check using this:
printf("c is at %x\n", c)
for(i = 0; i < basis->len; ++i) { printf("%x\n", g_ptr_array_index
(basis, i)); }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Help-gsl] adding gsl_combination elements to gprtarray in glib but cannot retrieve,
Awhan Patnaik <=