Go to the documentation of this file.
14 #define GK_MKBLAS(PRFX, TYPE, OUTTYPE) \
18 TYPE *PRFX ## incset(size_t n, TYPE baseval, TYPE *x)\
31 TYPE PRFX ## max(size_t n, TYPE *x)\
35 if (n <= 0) return (TYPE) 0;\
38 max = (x[i] > x[max] ? i : max);\
47 TYPE PRFX ## min(size_t n, TYPE *x)\
51 if (n <= 0) return (TYPE) 0;\
54 min = (x[i] < x[min] ? i : min);\
63 size_t PRFX ## argmax(size_t n, TYPE *x)\
68 max = (x[i] > x[max] ? i : max);\
77 size_t PRFX ## argmin(size_t n, TYPE *x)\
82 min = (x[i] < x[min] ? i : min);\
91 size_t PRFX ## argmax_n(size_t n, TYPE *x, size_t k)\
96 cand = PRFX ## kvmalloc(n, "GK_ARGMAX_N: cand");\
98 for (i=0; i<n; i++) {\
102 PRFX ## kvsortd(n, cand);\
104 max_n = cand[k-1].val;\
106 gk_free((void *)&cand, LTERM);\
115 OUTTYPE PRFX ## sum(size_t n, TYPE *x, size_t incx)\
120 for (i=0; i<n; i++, x+=incx)\
130 TYPE *PRFX ## scale(size_t n, TYPE alpha, TYPE *x, size_t incx)\
134 for (i=0; i<n; i++, x+=incx)\
144 OUTTYPE PRFX ## norm2(size_t n, TYPE *x, size_t incx)\
147 OUTTYPE partial = 0;\
149 for (i=0; i<n; i++, x+=incx)\
150 partial += (*x) * (*x);\
152 return (partial > 0 ? (OUTTYPE)sqrt((double)partial) : (OUTTYPE)0);\
159 OUTTYPE PRFX ## dot(size_t n, TYPE *x, size_t incx, TYPE *y, size_t incy)\
162 OUTTYPE partial = 0.0;\
164 for (i=0; i<n; i++, x+=incx, y+=incy)\
165 partial += (*x) * (*y);\
174 TYPE *PRFX ## axpy(size_t n, TYPE alpha, TYPE *x, size_t incx, TYPE *y, size_t incy)\
179 for (i=0; i<n; i++, x+=incx, y+=incy)\
187 #define GK_MKBLAS_PROTO(PRFX, TYPE, OUTTYPE) \
188 TYPE *PRFX ## incset(size_t n, TYPE baseval, TYPE *x);\
189 TYPE PRFX ## max(size_t n, TYPE *x);\
190 TYPE PRFX ## min(size_t n, TYPE *x);\
191 size_t PRFX ## argmax(size_t n, TYPE *x);\
192 size_t PRFX ## argmin(size_t n, TYPE *x);\
193 size_t PRFX ## argmax_n(size_t n, TYPE *x, size_t k);\
194 OUTTYPE PRFX ## sum(size_t n, TYPE *x, size_t incx);\
195 TYPE *PRFX ## scale(size_t n, TYPE alpha, TYPE *x, size_t incx);\
196 OUTTYPE PRFX ## norm2(size_t n, TYPE *x, size_t incx);\
197 OUTTYPE PRFX ## dot(size_t n, TYPE *x, size_t incx, TYPE *y, size_t incy);\
198 TYPE *PRFX ## axpy(size_t n, TYPE alpha, TYPE *x, size_t incx, TYPE *y, size_t incy);\
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:38