[Top][All Lists]

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

[Help-gsl] gsl_vector_alloc( 0 )

From: John D Lamb
Subject: [Help-gsl] gsl_vector_alloc( 0 )
Date: Tue, 10 Jan 2012 17:03:15 +0000

Is there any particular reason why gsl should abort on
gsl_vector_alloc( 0 ) and gsl_matrix_alloc( 0 )?

It is straightforward to construct a gsl_vector or matrix of size 0. And
I think all the vector and matrix operations behave appropriately on
such as vector or matrix: that is, they do not abort if the operation is
meaningful, even if the result is undefined.

There are occasions when it is useful to allow a vector of size 0. For
example, it is easier to put a gsl_vector* in a struct and interrogate
it with gsl_vector_size( s.vector ) than with s.vector == 0 ? 0 :
gsl_vector_size( s.vector ).

John D Lamb

reply via email to

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