-
-
Save d4rn0k/21a0e73c1115253b35a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for i in {0..3} | |
| do | |
| echo "zapisuje wyniki dla $((i+1)) watku" | |
| cat wyniki.txt | grep "$i\$" > temp | |
| sort temp > $i | |
| done | |
| #echo 'set terminal png font "/usr/share/fonts/dejavu/DejaVuSans.ttf" 20 size 1200,1000' > gnuplot.gnu | |
| #echo 'set output "wykres.png"' >> gnuplot.gnu | |
| printf 'plot ' > gnuplot.gnu | |
| for i in {0..3} | |
| do | |
| printf " \"$i\" with points ps 0.5 pt 1 lt $((i+1))" >> gnuplot.gnu | |
| if [ $i -ne "3" ] | |
| then | |
| printf ", " >> gnuplot.gnu | |
| fi | |
| done | |
| gnuplot gnuplot.gnu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #include <omp.h> | |
| int main(int argc, char* argv[]) { | |
| double x,y; | |
| int a,i, threadNum; | |
| FILE *fp; | |
| srand(time(NULL)); | |
| if ((fp=fopen("wyniki.txt", "w")) == NULL) { | |
| printf ("Blad fopen()!\n"); | |
| exit(1); | |
| } | |
| x=1; | |
| y=1; | |
| #pragma omp parallel for num_threads(4) | |
| for (i=1;i<=7000;i++) { | |
| a=(int)(rand() / (RAND_MAX + 1.0) * 2.0); | |
| if(a==0) { | |
| x=-0.4*x-1; | |
| y=-0.4*y+0.01; | |
| // x=-0.4*x-0.1; | |
| // y=-0.4*y+0.00001; | |
| } else { | |
| x=0.76*x-0.4*y; | |
| y=0.4*x+0.76*y; | |
| // x=0.766666*x-0.4*y; | |
| // y=0.444444*x+0.766666*y; | |
| } | |
| fprintf(fp,"%19.15lf\t%19.15lf\t%d\n", x, y, omp_get_thread_num() ); | |
| } | |
| fclose(fp); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment