El 15 de julio de 2009 19:13, Brian Gough <[email protected]> escribió:

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


OK, I agree.

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.


I agree too.

#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);
>

But I don't understand clearly how these macros run. My idea is that the
macros "return" in the argument 'pos' the position in the argument list of
the bad argument and then we can do the correct thing:
- If we are working in cblas_* function, call cblas_xerbla
- If we are working with gsl_cblas_* wrapper, call a function to convert
from 'pos' to GSL_ERROR_CODE and return this code.
I don't know exactly the behaviour of your macros.

-- 
*****************************************
José Luis García Pallero
[email protected]
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to