[Top][All Lists]

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

Re: [Help-gsl] About invalid parameters in cblas implementation

From: Brian Gough
Subject: Re: [Help-gsl] About invalid parameters in cblas implementation
Date: Wed, 15 Jul 2009 18:13:38 +0100
User-agent: Wanderlust/2.14.0 (Africa) Emacs/22.2 Mule/5.0 (SAKAKI)

At Sat, 11 Jul 2009 12:48:43 +0200,
José Luis García Pallero wrote:
> I don't know if we do this without extra confusion. The problem is that the
> arguments stride, dimensions, etc. can be in different positions of the
> argument list in the different functions, and pass this information to the
> macros would be confused.

Thanks for the file. I do think it makes sense to abstract the checks
into submacros, so that there is a single macro for the error handling
and one for each case to avoid duplication.  

If 'pos' is passed in as the first argument it looks ok I think, not
too confusing.  I would also define some dummy macros like CHECK_CONST
for arguments which don't need checks, so that all the 'pos' arguments
are in sequence from 1 to N.

#define CHECK_DIM(pos,dim)     if ((dim)<0) { ERROR(pos) ; }
#define CHECK_STRIDE(pos,inc)  if ((inc)==0) {ERROR(pos) ; }
#define CHECK_ORDER(pos,order) 
if(((order)!=CblasRowMajor)&&((order)!=CblasColMajor)) { ERROR(pos); }
#define CHECK_TRANS(pos,trans) 
if(((trans)!=CblasNoTrans)&&((trans)!=CblasTrans)&&((trans)!=CblasConjTrans)) { 
ERROR(pos) ; }
#define CHECK_CONST(pos,alpha) /* no check required */
#define CHECK_MATRIX(pos,A) /* no check required */
#define CHECK_VECTOR(pos,X) /* no check required */

#define CHECK_GEMV(pos,order,TransA,M,N,lda,incX,incY) \
        CHECK_ORDER  (1,order); \
        CHECK_TRANS  (2,trans) ; \
        CHECK_DIM    (3,M); \
        CHECK_DIM    (4,N); \
        CHECK_CONST  (5,alpha) \
        CHECK_MATRIX (6,A); \
        CHECK_STRIDE (9,incX); \
        CHECK_STRIDE (12,incY);

reply via email to

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