/*! \file gk_mkblas.h \brief Templates for BLAS-like routines \date Started 3/28/07 \author George \version\verbatim $Id: gk_mkblas.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim */ #ifndef _GK_MKBLAS_H_ #define _GK_MKBLAS_H_ #define GK_MKBLAS(PRFX, TYPE, OUTTYPE) \ /*************************************************************************/\ /*! The macro for gk_?incset()-class of routines */\ /*************************************************************************/\ TYPE *PRFX ## incset(size_t n, TYPE baseval, TYPE *x)\ {\ size_t i;\ \ for (i=0; i x[max] ? i : max);\ \ return x[max];\ }\ \ \ /*************************************************************************/\ /*! The macro for gk_?min()-class of routines */\ /*************************************************************************/\ TYPE PRFX ## min(size_t n, TYPE *x)\ {\ size_t i, min=0;\ \ if (n <= 0) return (TYPE) 0;\ \ for (i=1; i x[max] ? i : max);\ \ return max;\ }\ \ \ /*************************************************************************/\ /*! The macro for gk_?argmin()-class of routines */\ /*************************************************************************/\ size_t PRFX ## argmin(size_t n, TYPE *x)\ {\ size_t i, min=0;\ \ for (i=1; i 0 ? (OUTTYPE)sqrt((double)partial) : (OUTTYPE)0);\ }\ \ \ /*************************************************************************/\ /*! The macro for gk_?dot()-class of routines */\ /**************************************************************************/\ OUTTYPE PRFX ## dot(size_t n, TYPE *x, size_t incx, TYPE *y, size_t incy)\ {\ size_t i;\ OUTTYPE partial = 0.0;\ \ for (i=0; i