Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int* buffer =(int *)malloc(267289 * sizeof(int));
- FILE* ptr;
- int n = 517;
- double w[25];
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- if (abs(eucD(i, 2, j, 2) - 8) == 0)
- w[5 * i + j] = 0.004;
- else if (abs(eucD(i, 2, j, 2) - 5) == 0)
- w[5 * i + j] = 0.016;
- else if (abs(eucD(i, 2, j, 2) - 4) == 0)
- w[5 * i + j] = 0.026;
- else if (abs(eucD(i, 2, j, 2) - 2) == 0)
- w[5 * i + j] = 0.071;
- else if (abs(eucD(i, 2, j, 2) - 1) == 0)
- w[5 * i + j] = 0.117;
- else
- w[5 * i + j] = 0.0;
- }
- }
- ptr = fopen("conf-init.bin", "rb"); // r for read, b for binary
- fread(buffer, sizeof(buffer), 1, ptr); // read 10 bytes to our buffer
- fclose(ptr);
- ising(buffer, w, 1, 517);
- int * test=(int *)malloc(267289 * sizeof(int));
- ptr = fopen("conf-1.bin", "rb"); // r for read, b for binary
- fread(test, sizeof(test), 1, ptr); // read 10 bytes to our buffer
- fclose(ptr);
- int a = 0;
- for (int i = 0; i < 267289; i++) {
- if (test[i] != buffer[i]) {
- a++;
- }
- }
- printf("Errors=%d\n", a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement