You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

#ifndef __RENDER_H
#define __RENDER_H
#pragma GCC optimize ("O1")
#include <stdlib.h>
#include <time.h>
#define MAT_SIZE 514
#define RAND_SEED 114514
void Render(float a[][MAT_SIZE]);
void Print(float a[][MAT_SIZE]);
void Render(float a[][MAT_SIZE])
{
srand(RAND_SEED);
int i, j;
for(i=0; i<MAT_SIZE; i++)
for(j=0; j<MAT_SIZE; j++) {
a[i][j] = (float)rand() / (float)RAND_MAX;
}
}
void Print(float a[][MAT_SIZE])
{
printf("Matrix with Size=(%d,%d)\n", MAT_SIZE, MAT_SIZE);
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[0][0], a[0][1], a[0][2],
a[0][MAT_SIZE-3], a[0][MAT_SIZE-2], a[0][MAT_SIZE-1]);
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[1][0], a[1][1], a[1][2],
a[1][MAT_SIZE-3], a[1][MAT_SIZE-2], a[1][MAT_SIZE-1]);
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[2][0], a[2][1], a[2][2],
a[2][MAT_SIZE-3], a[2][MAT_SIZE-2], a[2][MAT_SIZE-1]);
printf(" ... ... ... ... ... ... ... \n");
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[MAT_SIZE-3][0], a[MAT_SIZE-3][1], a[MAT_SIZE-3][2],
a[MAT_SIZE-3][MAT_SIZE-3], a[MAT_SIZE-3][MAT_SIZE-2], a[MAT_SIZE-3][MAT_SIZE-1]);
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[MAT_SIZE-2][0], a[MAT_SIZE-2][1], a[MAT_SIZE-2][2],
a[MAT_SIZE-2][MAT_SIZE-3], a[MAT_SIZE-2][MAT_SIZE-2], a[MAT_SIZE-2][MAT_SIZE-1]);
printf("%5.1f %5.1f %5.1f ... %5.1f %5.1f %5.1f\n", a[MAT_SIZE-1][0], a[MAT_SIZE-1][1], a[MAT_SIZE-1][2],
a[MAT_SIZE-1][MAT_SIZE-3], a[MAT_SIZE-1][MAT_SIZE-2], a[MAT_SIZE-1][MAT_SIZE-1]);
}
#endif