source: CIVL/examples/fortran/provesaExamples/MXM/mxmdriver.c@ 552ed59

1.23 2.0 main test-branch
Last change on this file since 552ed59 was ef56832, checked in by Wenhao Wu <wuwenhao@…>, 10 years ago

Add a mxm driver file written in C for CIVL.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3743 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 850 bytes
RevLine 
[ef56832]1#include<civlc.cvh>
2#include<stdio.h>
3
4/*
5 * A MXM driver written in C for CIVL.
6 *
7 * ! Notice that arguments of the function declaration MXM44_0
8 * contains two-dimensional array without length info.
9 * This feature is illegal and invalid for the C standard,
10 * but it can be handled by CIVL.
11 */
12void MXM44_0(double a[][], int n1, double b[][], int n2, double c[][], int n3);
13
14$input int mSize;
15$assume(0 < mSize && mSize < 11);
16
17void main(){
18 int n = mSize;
19 double a[n][n], b[n][n], c[n][n];
20
21 for (int i = 0; i < n; i++)
22 for (int j = 0; j < n; j++){
23 a[i][j] = 1.0 * (i + j);
24 b[i][j] = 1.0 * (i - j);
25 c[i][j] = 0.0;
26 }
27
28 MXM44_0(a,n,b,n,c,n);
29
30 for (int i = 0; i < n; i++)
31 for (int j = 0; j < n; j++)
32 printf("c[%d][%d]: %d", i, j, c[i][j]);
33}
34
Note: See TracBrowser for help on using the repository browser.