Class MathematicaIO

java.lang.Object
imagingbook.common.util.MathematicaIO

public abstract class MathematicaIO extends Object
This class provides some static methods for formatting Java arrays (representing vectors, matrices or measurements) for copy-pasting to Mathematica.
Version:
2014/12/03
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    listArray(String name, double[] A)
    Generates a string holding the named definition of a 1D double array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};
    static String
    listArray(String name, double[][] A)
    Generates a string holding the named definition of a 2D double array for Mathematica in the form name = {{A[0][0],...,A[0][m-1]}, {A[1][0],...,A[1][m-1]}, ..., {A[n-1][0], A[n-1][1], ...,A[n-1][m-1]}};
    static String
    listArray(String name, float[] A)
    Generates a string holding the named definition of a 1D float array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};
    static String
    listArray(String name, float[][] A)
    Generates a string holding the named definition of a 2D float array for Mathematica in the form name = {{A[0][0],...,A[0][m-1]}, {A[1][0],...,A[1][m-1]}, ..., {A[n-1][0], A[n-1][1], ...,A[n-1][m-1]}};
    static String
    listArray(String name, int[] A)
    Generates a string holding the named definition of a 1D int array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • listArray

      public static String listArray(String name, double[] A)
      Generates a string holding the named definition of a 1D double array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};
      Parameters:
      name - the identifier to be used in Mathematica.
      A - the array to be encoded (of length m).
      Returns:
      a String holding the Mathematica definition.
    • listArray

      public static String listArray(String name, float[] A)
      Generates a string holding the named definition of a 1D float array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};
      Parameters:
      name - the name (Mathematica symbol) for the resulting array
      A - the array to be encoded (of length m).
      Returns:
      a String holding the Mathematica definition.
    • listArray

      public static String listArray(String name, int[] A)
      Generates a string holding the named definition of a 1D int array for Mathematica in the form name = {A[0], A[1], ...,A[m-1]};
      Parameters:
      name - the name (Mathematica symbol) for the resulting array
      A - the array to be encoded (of length m).
      Returns:
      a String holding the Mathematica definition.
    • listArray

      public static String listArray(String name, double[][] A)
      Generates a string holding the named definition of a 2D double array for Mathematica in the form name = {{A[0][0],...,A[0][m-1]}, {A[1][0],...,A[1][m-1]}, ..., {A[n-1][0], A[n-1][1], ...,A[n-1][m-1]}};
      Parameters:
      name - the identifier to be used in Mathematica.
      A - the array to be encoded (of length m).
      Returns:
      a String holding the Mathematica definition.
    • listArray

      public static String listArray(String name, float[][] A)
      Generates a string holding the named definition of a 2D float array for Mathematica in the form name = {{A[0][0],...,A[0][m-1]}, {A[1][0],...,A[1][m-1]}, ..., {A[n-1][0], A[n-1][1], ...,A[n-1][m-1]}};
      Parameters:
      name - the identifier to be used in Mathematica.
      A - the array to be encoded (of length m).
      Returns:
      a String holding the Mathematica definition.