help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] gsl_vector_alloc( 0 )


From: Michael Lehn
Subject: Re: [Help-gsl] gsl_vector_alloc( 0 )
Date: Tue, 10 Jan 2012 23:13:49 +0100

Am 10.01.2012 um 18:03 schrieb John D Lamb:

> 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
> 
> 

I agree.  In LAPACK vectors of length zero or matrices with zero rows
or columns are used/allowed because it often eases the implementation
of numerical algorithms.

Michael





reply via email to

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