help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] return value of matrix operations


From: kamaraju kusumanchi
Subject: Re: [Help-gsl] return value of matrix operations
Date: Sat, 27 Feb 2010 10:02:34 -0500

>
> int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b)
>
> the first argument is not declared const. You should also check the
> returned status code to verify if the operation was successful.

Thanks for all the replies Thomas, Marco, Francesco. I was confused by
the extra symbol a', missed the const keyword in the second argument.
It is clear to me now. Would it be possible to reword the
documentation of gsl_matrix_add as follows:

old version:

Function: int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b)

    This function adds the elements of matrix b to the elements of
matrix a, a'(i,j) = a(i,j) + b(i,j). The two matrices must have the
same dimensions.

new (suggested) version:

Function: int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b)

    This function adds the elements of matrix a and matrix b. The
resulting matrix, a'(i,j) = a(i,j) + b(i,j),  is stored in matrix a.
The contents of matrix b remain unchanged. The two matrices must have
the same dimensions.

It is a bit wordy, but less ambiguous in my opinion.

The same thing goes for gsl_matrix_sub, gsl_matrix_mul_elements,
gsl_matrix_div_elements, gsl_matrix_scale, gsl_matrix_add_constant




reply via email to

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