On 1/2/08, Joel J. Adamson <[EMAIL PROTECTED]> wrote: > 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
Yes, use my_vector->size. -- mj > (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. > > > > > _______________________________________________ > Help-gsl mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-gsl > _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
