summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/horzcat.c
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/c/horzcat.c
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
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.
Diffstat (limited to 'SD-VBS/common/c/horzcat.c')
-rw-r--r--SD-VBS/common/c/horzcat.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/SD-VBS/common/c/horzcat.c b/SD-VBS/common/c/horzcat.c
new file mode 100644
index 0000000..2041396
--- /dev/null
+++ b/SD-VBS/common/c/horzcat.c
@@ -0,0 +1,48 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "sdvbs_common.h"
6
7F2D* horzcat(F2D* a, F2D* b, F2D* c)
8{
9 F2D *out;
10 int rows=0, cols=0, i, j, k, c_1, c_2, r_3, c_3;
11
12 c_1 = a->width;
13 cols += c_1;
14
15 c_2 = b->width;
16 cols += c_2;
17
18 r_3 = c->height;
19 c_3 = c->width;
20 cols += c_3;
21 rows = r_3;
22
23 out = fMallocHandle(rows, cols);
24
25 for(i=0; i<rows; i++)
26 {
27 k = 0;
28 for(j=0; j<c_1; j++)
29 {
30 subsref(out,i,k) = subsref(a,i,j);
31 k++;
32 }
33 for(j=0; j<c_2; j++)
34 {
35 subsref(out,i,k) = subsref(b,i,j);
36 k++;
37 }
38 for(j=0; j<c_3; j++)
39 {
40 subsref(out,i,k) = subsref(c,i,j);
41 k++;
42 }
43 }
44
45 return out;
46}
47
48