main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
852 bytes
|
| Line | |
|---|
| 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 | */
|
|---|
| 12 | void MXM44_0(float a[][], int* n1, float b[][], int* n2, float c[][], int* n3);
|
|---|
| 13 |
|
|---|
| 14 | $input int mSize;
|
|---|
| 15 | $assume(0 < mSize && mSize < 11);
|
|---|
| 16 |
|
|---|
| 17 | void main(){
|
|---|
| 18 | int n = mSize;
|
|---|
| 19 | float 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.