Proposal for new functions for matrix manipulation.

Martin Jansche jansche@ling.ohio-state.edu
Tue Jan 28 19:07:00 GMT 2003


On Tue, 28 Jan 2003, Lukas Dobrek wrote:

> [dobrek@maldini ~]$ cat t.c
> #define GSL_RANGE_CHECK_OFF 1
> #include<gsl/gsl_matrix.h>
> int main(){
> 		gsl_matrix *M;
> 		double add;
> 		int i,j;
> 		gsl_matrix_set(M,i,j,add+gsl_matrix_get(M,i,j));
> }
>
> [dobrek@maldini ~]$ gcc -S  -O2 t.c
>
> One can see in t.s that bouth functions are consecutively called
> gsl_matrix_get and gsl_matrix_set.

I compiled your file using

  gcc -S -O2 -DHAVE_INLINE -fverbose-asm t.c

and the assembly output looks exactly as you'd want it.  If that's
not an option for you, couldn't you say

  double *elem = gsl_matrix_ptr(M, i, j);
  *elem += add;

in you C source?

- martin



More information about the Gsl-discuss mailing list