Java Matrix to String toString(double[][] A)

Here you can find the source of toString(double[][] A)

Description

to String

License

Creative Commons License

Declaration

public static String toString(double[][] A) 

Method Source Code


//package com.java2s;
//License from project: Creative Commons License 

import java.util.Arrays;

public class Main {
    public static String toString(double[][] A) {

        StringBuilder sb = new StringBuilder("(");

        for (double[] rawA : A)
            sb.append(Arrays.toString(rawA)).append(',');

        sb.delete(sb.length() - 1, sb.length()).append(')');

        return sb.toString();

    }/*w ww  .  jav  a2  s  .  c om*/

    public static double length(double[] x) {

        double len = 0;

        for (int index = 0; index < x.length; index++)
            len += x[index] * x[index];

        return Math.sqrt(len);

    }
}

Related

  1. matrixToString(double[][] matrix, int digit, String[] names)
  2. matrixToString(float[][][] matrix)
  3. matrixToString(int[][] m)
  4. matrixToString(int[][] matrix, String sep)
  5. matrixToString(String[][] m)
  6. toString(double[][] array)
  7. toString(double[][] data)
  8. toString(int partition[][])
  9. toString(int[][] a)