diff options
author | dhuth <derickhuth@gmail.com> | 2014-08-27 09:52:06 -0600 |
---|---|---|
committer | dhuth <derickhuth@gmail.com> | 2014-08-27 09:52:06 -0600 |
commit | bff810cc371a38f493d688c54f71013f5a7d53bf (patch) | |
tree | fbe86954bb3c01deb21da9e41ebff5baa2889a45 /examples/chill/jacobi2.c | |
download | chill-bff810cc371a38f493d688c54f71013f5a7d53bf.tar.gz chill-bff810cc371a38f493d688c54f71013f5a7d53bf.tar.bz2 chill-bff810cc371a38f493d688c54f71013f5a7d53bf.zip |
Initial commit
Diffstat (limited to 'examples/chill/jacobi2.c')
-rw-r--r-- | examples/chill/jacobi2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/chill/jacobi2.c b/examples/chill/jacobi2.c new file mode 100644 index 0000000..b8d8d7b --- /dev/null +++ b/examples/chill/jacobi2.c @@ -0,0 +1,15 @@ +#define N 512 + +int main() { + double a[N]; + double b[N]; + int t, i; + for (t = 1; t <= 100; t++) { + for (i = 2; i <= N - 1; i++) + b[i] = (double) 0.25 * (a[i - 1] + a[i + 1]) + (double) 0.5 * a[i]; + + for (i = 2; i <= N - 1; i++) + a[i] = b[i]; + } + return 0; +} |