Code for solving a random number matrix with the Pivot Gauss elimination method

I submitted a school assignment, so I saved the code as an article. conditions: ・ Solve ʻax = b. ・ ʻA is a random number matrix of 500 * 500 (components 1 to 9) ・ The 2 norms of (b-ax) are thrown into ʻerr1` as an error. ・ Language is Java. Whole source

	public static main {
		long t0;
		long time;
		int n =500;
		int m=100;
		double [][]a =new double[n][n];
		double []b =new double[n];
		double []x2 =new double[n];
		double err1 =0.0;
		//Issue err1
		t0 = System.currentTimeMillis();
		for(int s=0;s<m;s++){
			for(int j=0;j<n;j++){
				for(int i=0;i<n;i++){
					a[i][j]=Math.abs((Math.random()));
					b[i]  =Math.abs((Math.random()));
				}
			}
			x2 =Calc.pivotGauss(a, b);
			err1 =Calc.vecNorm2(Calc.subVec(b,Calc.matVec(a, x2)));
			System.out.println(err2);
		}
		time = System.currentTimeMillis()-t0;
		System.out.println("\n Processing time:"+time);
	}

Recommended Posts

Code for solving a random number matrix with the Pivot Gauss elimination method
Code for solving the random number matrix with Pivot Gaussian elimination and Gaussian elimination and comparing the accuracy
Source code for finding an orthonormal basis with the Gram-Schmidt orthogonalization method
Come out with a suffix on the method
Come out with a suffix on the method 2
Rewrite the code for java.io.File with java.nio.Path and java.nio.Files
I want to call a method and count the number
How to test a private method with RSpec for yourself
Find the number of days in a month with Kotlin
With the software I've been making for a long time ...
Modeling a Digimon with DDD for the first time Part 1
[Java] How to search for a value in an array (or list) with the contains method