package main;

import utils.Utils;
import matrix.CholeskyMatrix;
import matrix.GaussMatrix;

/**
 * Main class.
 * @author Pavel_Verkhovtsov
 */
public class Main{
	private static int range = 3;
	private static double[][] inputMatrix  = {{2.18, 2.44, 2.49},
											 {2.17, 2.31, 2.49},
											 {3.15, 3.22, 3.17}};

	private static double[] freeCoefficients = {-4.34, -3.91, -5.27};

	/**
	 * Main method.
	 * @param args console arguments
	 */
	public static void main(final String[] args){
		Utils.verifyMatrixRange(inputMatrix, freeCoefficients, range);

	/*	freeCoefficients = Utils.multiplicationMatrix(freeCoefficients, Utils.matrixTransposition(inputMatrix));
		inputMatrix = Utils.makeMatrixSymmetric(inputMatrix);*/

		GaussMatrix gaussMatrix = new GaussMatrix(range, Utils.concatenationMatrix(inputMatrix, freeCoefficients));
		for (int i=0; i<range; i++){
			gaussMatrix.swapRow(i);
			gaussMatrix.divideRow(i);
			gaussMatrix.subtractMatrix(i);
		}

		double[] answer = gaussMatrix.makeAnswer();
		System.out.println("Gauss answer:");
		for(int i=0; i<answer.length; i++){
			System.out.println(answer[i]);
		}

		if (!Utils.checkSymmetric(inputMatrix)){
			freeCoefficients = Utils.multiplicationMatrix(freeCoefficients, Utils.matrixTransposition(inputMatrix));
			inputMatrix = Utils.makeMatrixSymmetric(inputMatrix);
		}

		double [][] q = inputMatrix; /*temp*/
		// TODO Manual check system solution.
		CholeskyMatrix choleskyMatrix = new CholeskyMatrix(range, inputMatrix, freeCoefficients);
		choleskyMatrix.makeLMatrix();
		choleskyMatrix.solveSystem();

		System.out.println("\nChelosky answer:");
		answer = choleskyMatrix.makeAnswer();
		for(int i=0; i<answer.length; i++){
			System.out.println(answer[i]);
		}
	}
}

@@ -8,16 +8,42 @@
  main;%0A%0A
+import java.util.Scanner;%0A
 import u
@@ -212,13 +212,18 @@
 ange
+;/*
  = 3;
+*/
 %0A%09pr
@@ -257,16 +257,19 @@
 utMatrix
+;/*
   = %7B%7B2.
@@ -349,16 +349,18 @@
  3.17%7D%7D;
+*/
 %0A%0A%09priva
@@ -394,16 +394,19 @@
 ficients
+;/*
  = %7B-4.3
@@ -422,16 +422,18 @@
  -5.27%7D;
+*/
 %0A%0A%09/**%0A%09
@@ -540,49 +540,149 @@
 %7B%0A%09%09
-Utils.verifyM
+System.out.println(%22Input m
 atrix
-R
+ r
 ange
-(inputMatrix, free
+: %22);%0A%09%09Scanner in = new Scanner(System.in);%0A        range = in.nextInt();%0A%0A%09%09inputMatrix = inputSystem
 Coef
@@ -693,18 +693,17 @@
 ents
-, 
+(
 range);%0A
 %0A%09/*
@@ -698,20 +698,17 @@
 range);%0A
-%0A%09/*
+%09
 %09freeCoe
@@ -723,151 +723,103 @@
 s = 
-Utils.multiplicationMatrix(freeCoefficients, Utils.matrixTransposition(inputMatrix));%0A%09%09inputMatrix = Utils.makeMatrixSymmetric(inputMatrix);*/
+inputFreeCoefficients(range);%0A%0A%09%09Utils.verifyMatrixRange(inputMatrix, freeCoefficients, range);
 %0A%0A%09%09
@@ -1826,11 +1826,812 @@
 ;%0A%09%09%7D%0A%09%7D
+%0A%0A%09/**%0A%09 * Input free coefficients.%0A%09 * @param size array range%0A%09 * @return filling array%0A%09 */%0A%09private static double%5B%5D inputFreeCoefficients(final int size) %7B%0A%09%09System.out.println(%22Input free coefficients: %22);%0A%09%09Scanner in = new Scanner(System.in);%0A%09%09double%5B%5D result = new double%5Bsize%5D;%0A%09%09for (int i=0; i%3Csize; i++)%7B%0A%09%09%09result%5Bi%5D=in.nextDouble();%0A%09%09%09%7D%0A%09%09return result;%0A%09%7D%0A%0A%09/**%0A%09 * Input systems coefficients.%0A%09 * @param size matrix range%0A%09 * @return filling matrix%0A%09 */%0A%09private static double%5B%5D%5B%5D inputSystemCoefficients(final int size) %7B%0A%09%09System.out.println(%22Input system coefficients: %22);%0A%09%09Scanner in = new Scanner(System.in);%0A%09%09double%5B%5D%5B%5D result = new double%5Bsize%5D%5Bsize%5D;%0A%09%09for (int i=0; i%3Csize; i++)%7B%0A%09%09%09for(int j=0; j%3Csize; j++)%7B%0A%09%09%09%09result%5Bi%5D%5Bj%5D=in.nextDouble();%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return result;%0A%09%7D
 %0A%7D%0A

Add console input