Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. /**
  2.  *  Przyklad
  3.  */
  4. public class Przyklad {
  5.     int N;          //liczba krokow
  6.     int n_max;      //maksymalny rozmiar problemu
  7.     int[] n;     //tablica rozmiarow macierzy
  8.     double[] T;     //tablica czasow
  9.    
  10.     //Konstruktor
  11.     public Przyklad(int NN, int nn_max) {
  12.         N = NN;
  13.         n_max = nn_max;
  14.         n = new int[N];
  15.         T = new double[N];
  16.     }
  17.    
  18.     public void BadajZlozonosc() {
  19.         int n_krok = (int) (n_max / N);     //krok zmiany rozmiaru problemu
  20.         long pomiar;                //zmienna przechowujaca czas
  21.         for(int i = 0; i < N; i++) {
  22.             Uklad u1 = new Uklad((i + 1) * n_krok);
  23.             u1.LosujUklad();
  24.             Banachiewicz test3 = new Banachiewicz(u1);
  25.             pomiar = System.currentTimeMillis();
  26.             test3.Rozklad();
  27.             test3.RozwiazTrojkatnyDolny();
  28.             test3.RozwiazTrojkatnyGorny();
  29.             pomiar = System.currentTimeMillis() - pomiar;        
  30.             n[i] = (i + 1) * n_krok;
  31.             T[i] = pomiar/1000.0;
  32.             System.out.format("%d \t %4.5f\n", n[i], T[i]);
  33.         }
  34.         Wykresik wykresik = new Wykresik(N, n, T);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement