help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] gsl_vector_get () return status


From: Joel J. Adamson
Subject: [Help-gsl] gsl_vector_get () return status
Date: Wed, 02 Jan 2008 14:05:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Howdy,

Using gsl_vector_get (), how do I distinguish between an error accessing
an out-of-range vector element (returns 0 with error checking off) and
an element that is genuinely 0?

I am programming in Gambit-C (Scheme->C compiler) using the GSL for
linear algebra.  The gsl_vector and gsl_matrix operations have worked
really well for me, however I have a unique problem: I need to know when
to stop assigning vector elements to a vector in Scheme.  If I can
determine the length of the vector somehow in C, then I could simply
allocate the length in the Scheme code and stop at that index.  I
thought to do this with error checking: iterate up the vector elements
until I reach an out-of-range element, however I have the above
problem of distinguishing an element 0 from an error code 0.

Is there a way to either (a) determine the length of the vector in C or
(b) determine the error condition?  Is there some other variable that
gets set (errno?) when the error occurs?  I'm fairly new to C, and none
of the books I have adequately explain how to obtain return status (is
it anything other than the return value of the function?).

Or should I just use the BLAS functions and abandon gsl_vector and
gsl_matrix?

Thanks for any help you can offer,
Joel
-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.






reply via email to

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