http://www.cli.di.unipi.it/~sgandurr...e/Matrice.html
/**Restituisce la matrice di iterazione di Gauss-Seidel
@return la matrice di iterazione calcolata con il metodo di Gauss-Seidel
*/
nel link trovi tutte le altre funzioni che nn sono definitecodice:public Matrice gaussSeidel() { int n = this.getN(); Matrice gs = new Matrice(n); Matrice b = new Matrice(n); Matrice c = new Matrice(n); Matrice d = new Matrice(n); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { b.assegna(i, j, (i > j ? ((-1) * this.getValore(i, j)): 0)); c.assegna(i, j, (i < j ? ((-1) * this.getValore(i, j)): 0)); d.assegna(i, j, (i == j ? (this.getValore(i, j)): 0)); } } gs = (d.somma(b.moltiplicazione(-1)).inversa()).prodotto(c); return gs; }

Rispondi quotando