From 1640830bf5dc0630481e698512064215eb3e8249 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 10 Oct 2021 19:55:59 +0200 Subject: WIP --- test.c | 65 ----------------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 test.c (limited to 'test.c') diff --git a/test.c b/test.c deleted file mode 100644 index afd0685..0000000 --- a/test.c +++ /dev/null @@ -1,65 +0,0 @@ -// > import Data.Array.Accelerate.C -// > import qualified Data.Array.Accelerate as A -// > import qualified Data.Array.Accelerate.Interpreter as I -// > let Right (p,_,_) = translateAcc "kaas" $ \(A.T2 a b) -> A.generate (A.I2 2 3) (\(A.I2 i j) -> let A.T2 x y = b A.! A.I1 i in i * j + a A.! A.I2 i j + x * y :: A.Exp Int) in putStr p -// [...this file without main()...] -// > I.run1 (\(A.T2 a b) -> A.generate (A.I2 2 3) (\(A.I2 i j) -> let A.T2 x y = b A.! A.I1 i in i * j + a A.! A.I2 i j + x * y :: A.Exp Int)) (A.fromList (A.Z A.:. (2 :: Int) A.:. (3 :: Int)) [0..], A.fromList (A.Z A.:. (2 :: Int)) [(1,2), (3,4)]) -// Matrix (Z :. 2 :. 3) -// [ 2, 3, 4, -// 15, 17, 19] -// -// Running this program will give the same result. :) - - -#include -#include -#include -#include - -static void expfun_13(int64_t* x14, int64_t* x15) { - x14[(0)] = (2LL); - x15[(0)] = (3LL); -} - -static void expfun_16(int64_t n1, int64_t n2, int64_t* a3, int64_t n4, int64_t* a5, int64_t* a6, int64_t x17, int64_t x18, int64_t* x19) { - int64_t i20; - i20 = ((x17) * (n2)) + (x18); - int64_t x21; - int64_t x22; - int64_t i23; - i23 = x17; - x21 = a5[i23]; - x22 = a6[i23]; - x19[(0)] = (((x17) * (x18)) + (a3[i20])) + ((x21) * (x22)); -} - -void kaas(int64_t n1, int64_t n2, int64_t* a3, int64_t n4, int64_t* a5, int64_t* a6, int64_t* n10, int64_t* n11, int64_t** a12) { - int64_t n7; - int64_t n8; - expfun_13(&(n7), &(n8)); - int64_t* a9 = malloc(((n7) * (n8)) * ((sizeof (int64_t)))); - for (int64_t n25 = (0); n25 < (n7); n25++) { - for (int64_t n26 = (0); n26 < (n8); n26++) { - int64_t x24; - expfun_16(n1, n2, a3, n4, a5, a6, n25, n26, &(x24)); - a9[((n25) * (n8)) + (n26)] = x24; - } - } - n10[(0)] = n7; - n11[(0)] = n8; - a12[(0)] = a9; -} - -int main() { - int64_t a[6] = {0, 1, 2, 3, 4, 5}; - int64_t b1[2] = {1, 3}; - int64_t b2[2] = {2, 4}; - int64_t resn1, resn2; - int64_t *res; - kaas(2, 3, a, 2, b1, b2, &resn1, &resn2, &res); - printf("%" PRIi64 "x%" PRIi64 ":", resn1, resn2); - for (int64_t i = 0; i < resn1; i++) - for (int64_t j = 0; j < resn2; j++) - printf(" %" PRIi64, res[resn2 * i + j]); - printf("\n"); -} -- cgit v1.2.3-70-g09d2