Sha256: cb657883c2237111f9793d1e568240795b8d4114ae2e8bb6c2bbad6784b73aa1
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
// // This file is part of the Bones source-to-source compiler examples. This C-code // example is meant to illustrate the use of Bones. For more information on Bones // use the contact information below. // // == More information on Bones // Contact............Cedric Nugteren <c.nugteren@tue.nl> // Web address........http://parse.ele.tue.nl/bones/ // // == File information // Filename...........neighbourhood/example4.c // Author.............Cedric Nugteren // Last modified on...16-April-2012 // #include <stdio.h> // This is 'example4', demonstrating naming (optional) in the classification to distingish the two input arrays int main(void) { int i; float factor; int size = 512; // Declare input/output arrays float A[size]; float B[size]; float C[size]; // Set the input data for(i=0;i<size;i++) { A[i] = i*2.3; B[i] = i+6.0; } // Perform the computation #pragma species kernel B[0:size-1]|neighbourhood(-1:1) ^ A[0:size-1]|element -> C[0:size-1]|element for(i=0;i<size;i++) { factor = A[i]/100.0; if ((i >= 1) && (i < size-1)) { C[i] = factor*(B[i-1]+B[i]+B[i+1]); } else { C[i] = B[i]; } } #pragma species endkernel example4 // Clean-up and exit the function fflush(stdout); return 0; }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bones-compiler-1.3.1 | examples/neighbourhood/example04.c |
bones-compiler-1.1.0 | examples/neighbourhood/example4.c |