Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Prints a graphical representation of the matrix to ease understanding*/
- public static void visualizeMatrix(double [][] matrix)
- {
- if(matrix != null)
- {
- for(int i = 0; i < matrix.length; i++)
- {
- // Index starts at 1 in mathematical terms
- String row = (i+1) + ". " ;
- for(int j = 0; j < matrix[i].length; j++)
- {
- row += "[" + matrix[i][j] + "]";
- }
- System.out.println(row);
- }
- System.out.println();
- }else {
- System.out.println("Matrix is null");
- }
- }
- /*Prints a graphical representation of the matrix to ease understanding*/
- public static void visualizeMatrix(int [][] matrix)
- {
- if(matrix != null)
- {
- for(int i = 0; i < matrix.length; i++)
- {
- // Index starts at 1 in mathematical terms
- String row = (i+1) + ". ";
- for(int j = 0; j < matrix[i].length; j++)
- {
- row += "[" + matrix[i][j] + "]";
- }
- System.out.println(row);
- }
- System.out.println();
- }else {
- System.out.println("Matrix is null");
- }
- }
- /*Prints a graphical representation of vector*/
- public static void visualizeVector(int [] vector)
- {
- if(vector!= null)
- {
- String row = "1. ";
- for(int i = 0; i < vector.length; i++)
- {
- row += "[" + vector[i] + "]";
- }
- System.out.println(row + "\n");
- }else {
- System.out.println("Vector is null");
- }
- }
- /*Prints a graphical representation of vector*/
- public static void visualizeVector(double [] vector)
- {
- if(vector!= null)
- {
- String row = "1. ";
- for(int i = 0; i < vector.length; i++)
- {
- row += "[" + vector[i] + "]";
- }
- System.out.println(row + "\n");
- }else {
- System.out.println("Vector is null");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement