From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT. --- SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c (limited to 'SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c') diff --git a/SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c b/SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c new file mode 100644 index 0000000..681f2c6 --- /dev/null +++ b/SD-VBS/benchmarks/svm/src/c/getAlphaFromTrainSet.c @@ -0,0 +1,98 @@ +/******************************** +Author: Sravanthi Kota Venkata +********************************/ + +#include "svm.h" + +alphaRet* getAlphaFromTrainSet(int N, F2D* trn1, F2D* trn2, int iterations) +{ + float tolerance, C, eps, *b; + F2D *a_result, *b_result; + int NumChanged, r, ExamineAll, cnt, d, dim, ret, iter, i; + F2D *X, *Y; + F2D *a, *e; + + b = malloc(sizeof(float)); + alphaRet* alpha; + alpha = (alphaRet*)malloc(sizeof(alphaRet)); + tolerance = 0.001; + C = 0.05; + d = -1; + dim = 256; + eps = 0.001; + a_result = fSetArray(iterations, N, 0); + b_result = fSetArray(iterations, 1, 0); + ret = 0; + + X = usps_read_partial( trn1, trn2, 0, 1, (N/iterations), iterations); + + for(iter=0; iter0 || ExamineAll == 1) + { + cnt = cnt + 1; + NumChanged = 0; + if(ExamineAll == 1) + { + for(i=0; i 0 && asubsref(a,i) C = C; + alpha->d = d; + alpha->dim = dim; + alpha->eps = eps; + alpha->a_result = a_result; + alpha->b_result = b_result; + alpha->a = a; + alpha->b = arrayref(b,0); + alpha->X = X; + alpha->tolerance = tolerance; + alpha->ret; + + free(b); + + return alpha; + +} + + + + -- cgit v1.2.2