Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Algorithms;
- import java.io.File;
- import java.util.Scanner;
- import java.util.*;
- public class Driver {
- public static void main(String[] args) throws java.io.FileNotFoundException {
- Scanner scan = new Scanner(new File("src/Algorithms/input.txt"));
- int rows = 0;
- int columns = 0;
- scan.nextLine();
- while(scan.hasNextLine()) {
- rows++;
- Scanner colReader = new Scanner(scan.nextLine());
- columns = 0;
- while(colReader.hasNextDouble()) {
- columns++;
- }
- }
- rows = rows - 1;
- double arr[][] = new double[rows][columns];
- scan.close();
- scan = new Scanner(new File("array.txt"));
- int n = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < rows; i++) {
- for(int j = 0; j < columns; j++) {
- if(scan.hasNextDouble()) {
- arr[i][j] = scan.nextDouble();
- }
- }
- }
- double vector[] = new double[n];
- for(int i = 0;i < n; i++) {
- if(scan.hasNextDouble()){
- vector[i] = scan.nextDouble();
- }
- }
- scan.close();
- NaiveGaussianAlgorithm NGE = new NaiveGaussianAlgorithm();
- NGE.naiveGaussian(arr, vector);
- System.out.println(columns);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement