On Tue, Sep 06, 2005 at 05:11:50AM -0700, hariram subramanian wrote:
...
> In simple words, I want to make GSL work in the way as Matlab does with diag 
> (X), where X is some vector.

You might try something like this:

gsl_matrix * my_diag_alloc(gsl_vector * X)
{
    gsl_matrix * mat = gsl_matrix_alloc(X->size, X->size);
    gsl_vector_view diag = gsl_matrix_diagonal(mat);
    gsl_matrix_set_all(mat, 0.0); //or whatever number you like
    gsl_vector_memcpy(&diag.vector, X);
    return mat;
}

-- 
james bergstra
http://www-etud.iro.umontreal.ca/~bergstrj
          



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to