Initial commit from sysy-main

This commit is contained in:
Lixuanwang
2025-02-27 23:14:53 +08:00
commit cc523fd30b
1125 changed files with 257793 additions and 0 deletions

2006
testdata/performance/2024-2D0-22.in vendored Executable file

File diff suppressed because one or more lines are too long

2
testdata/performance/2024-2D0-22.out vendored Executable file

File diff suppressed because one or more lines are too long

50
testdata/performance/2024-2D0-22.sy vendored Executable file
View File

@ -0,0 +1,50 @@
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
int i, j, k;
i = 0;
while (i < n){
x[i] = 0;
i = i + 1;
}
i = 0;
while (i < n){
j = xptr[i];
while (j < xptr[i + 1]){
x[yidx[j]] = x[yidx[j]] + vals[j];
j = j + 1;
}
j = xptr[i];
while (j < xptr[i + 1]){
x[yidx[j]] = x[yidx[j]] + vals[j] * (b[i] - 1);
j = j + 1;
}
i = i + 1;
}
}
const int N = 100010;
const int M = 3000000;
int x[N], y[M], v[M];
int a[N], b[N], c[N];
int main(){
int n = getarray(x) - 1;
int m = getarray(y);
getarray(v);
getarray(a);
starttime();
int i = 0;
while (i < 100){
spmv(n, x, y, v, a, b);
spmv(n, x, y, v, b, a);
i=i+1;
}
stoptime();
putarray(n, b);
return 0;
}

2
testdata/performance/2024-C64-14.out vendored Executable file
View File

@ -0,0 +1,2 @@
10
0

50
testdata/performance/2024-C64-14.sy vendored Executable file
View File

@ -0,0 +1,50 @@
//large loop and large array caculate
int COUNT = 500000;
float loop(float x[], float y[], int length) {
int i = 0;
float accum = 0.0;
while (i < length) {
accum = accum + x[i] * y[i];
i = i + 1;
}
return accum;
}
int main() {
int i = 0, j = 0;
float x[6000];
float y[6000];
int len=6000;
float total = 0.0;
float a = 0.0;
float b = 1.0;
starttime();
while ( i < COUNT) {
if (i % 10) {
a = 0.0;
b = 1.0;
} else {
a = a + 0.1;
b = b + 0.2;
}
while ( j < len) {
x[j] = a + j;
y[j] = b + j;
j = j + 1;
}
total = total + loop(x, y, len);
i = i + 1;
}
stoptime();
int final=total - 36239413625225216.0000001;
if (final <=0.000001 && final>= -0.000001) {
putint(10);
return 0;
}
else {
putint(1);
return 1;
}
}