Here you can find the source of printMatrix(double[] a, String label)
Parameter | Description |
---|---|
a | Vector to print |
label | Label to print as a header |
public static void printMatrix(double[] a, String label)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a v a 2 s .c om * Print a vector for debugging purposes. * * @param a Vector to print * @param label Label to print as a header */ public static void printMatrix(double[] a, String label) { int count; System.out.println("\n\t\t" + label + ":"); count = 0; for (int j = 0; j < a.length; j++) { if (count > 8) { System.out.print("\n "); count = 1; } System.out.format(" %10.3e", a[j]); count++; } System.out.println(); } /** * Print a vector for debugging purposes. * * @param a Vector to print * @param label Label to print as a header */ public static void printMatrix(int[] a, String label) { int count; System.out.println("\n\t\t" + label + ":"); count = 0; for (int j = 0; j < a.length; j++) { if (count > 17) { System.out.print("\n "); count = 1; } System.out.format(" %4d", a[j]); count++; } System.out.println(); } /** * Print a matrix for debugging purposes. * * @param a Matrix to print * @param label Label to print as a header */ public static void printMatrix(double[][] a, String label) { int count; System.out.println("\n\t\t" + label + ":"); for (int i = 0; i < a.length; i++) { count = 0; for (int j = 0; j < a[i].length; j++) { if (count > 8) { System.out.print("\n "); count = 1; } System.out.format(" %10.3e", a[i][j]); count++; } System.out.println(); } } }