1 /* cblas/error_cblas.h 2 * 3 * Copyright (C) 2010 José Luis García Pallero 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or (at 8 * your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __ERROR_CBLAS_H__ 21 #define __ERROR_CBLAS_H__ 22 23 24 #define CHECK_ARGS_X(FUNCTION,VAR,ARGS) do { int VAR = 0 ; \ 25 CBLAS_ERROR_##FUNCTION ARGS ; \ 26 if (VAR) cblas_xerbla(pos,__FILE__,""); } while (0) 27 28 #define CHECK_ARGS7(FUNCTION,A1,A2,A3,A4,A5,A6,A7) \ 29 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7)) 30 31 #define CHECK_ARGS8(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8) \ 32 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8)) 33 34 #define CHECK_ARGS9(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9) \ 35 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9)) 36 37 #define CHECK_ARGS10(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \ 38 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10)) 39 40 #define CHECK_ARGS11(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \ 41 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11)) 42 43 #define CHECK_ARGS12(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12) \ 44 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12)) 45 46 #define CHECK_ARGS13(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13) \ 47 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13)) 48 49 #define CHECK_ARGS14(FUNCTION,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14) \ 50 CHECK_ARGS_X(FUNCTION,pos,(pos,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14)) 51 52 /* check if CBLAS_ORDER is correct */ 53 #define CHECK_ORDER(pos,posIfError,order) \ 54 if(((order)!=CblasRowMajor)&&((order)!=CblasColMajor)) \ 55 pos = posIfError; 56 57 /* check if CBLAS_TRANSPOSE is correct */ 58 #define CHECK_TRANSPOSE(pos,posIfError,Trans) \ 59 if(((Trans)!=CblasNoTrans)&&((Trans)!=CblasTrans)&&((Trans)!=CblasConjTrans)) \ 60 pos = posIfError; 61 62 /* check if CBLAS_UPLO is correct */ 63 #define CHECK_UPLO(pos,posIfError,Uplo) \ 64 if(((Uplo)!=CblasUpper)&&((Uplo)!=CblasLower)) \ 65 pos = posIfError; 66 67 /* check if CBLAS_DIAG is correct */ 68 #define CHECK_DIAG(pos,posIfError,Diag) \ 69 if(((Diag)!=CblasNonUnit)&&((Diag)!=CblasUnit)) \ 70 pos = posIfError; 71 72 /* check if CBLAS_SIDE is correct */ 73 #define CHECK_SIDE(pos,posIfError,Side) \ 74 if(((Side)!=CblasLeft)&&((Side)!=CblasRight)) \ 75 pos = posIfError; 76 77 /* check if a dimension argument is correct */ 78 #define CHECK_DIM(pos,posIfError,dim) \ 79 if((dim)<0) \ 80 pos = posIfError; 81 82 /* check if a stride argument is correct */ 83 #define CHECK_STRIDE(pos,posIfError,stride) \ 84 if((stride)==0) \ 85 pos = posIfError; 86 87 #endif /* __ERROR_CBLAS_H__ */ 88