math
Class Mat2

java.lang.Object
  extended by math.Mat2
Direct Known Subclasses:
MatFloat

public abstract class Mat2
extends java.lang.Object


Constructor Summary
Mat2()
           
 
Method Summary
static short clip(short i)
           
static short[][] clip(short[][] i)
           
static short[][] copy(short[][] r)
           
static short[][] copyArray(short[][] a)
           
static boolean equal(short[][] a, short[][] b)
           
static double getAverage(double[][] a)
          Compute the avg value of the array.
static double[] getAverage(double[] a, double[] b, double[] c)
           
static double getAverage(float[][] a)
          Compute the avg value of the array.
static double getAverage(short[][] a)
          Compute the avg value of the array.
static short[][] getIdentity(int r, int c)
           
static int[][] getInt2(int[] pels, int width, int height)
           
static short getMax(short[] a)
           
static short getMax(short[][] a)
           
static short getMin(short[] a)
           
static short[][] getSampleSquareMatrix(int n)
           
static short[][] getShort(byte[][] a)
           
static short[][] getShort(short[][] a)
           
static double getStandardDeviation(float[][] a)
           
static double getStandardDeviation(short[][] a)
          Compute the Standard Deviation of the array.
static double getSum(double[][] a)
           
static double getSum(float[][] a)
           
static double getSum(short[][] a)
           
static double getVariance(float[][] a)
           
static double getVariance(short[][] a)
           
static short[][] grow(short[][] in, java.awt.Dimension dimension, int borderType)
           
static void intQuickSort(int[] a, int lo0, int hi0)
           
static void main(java.lang.String[] args)
           
static short median(java.util.Vector v)
           
static void normalize(double[][] a)
           
static void normalize(float[][] a)
           
static float[][] normalize(short[][] a)
           
static int numberOfNonZeros(short[][] k)
           
static void print(double[][] a)
           
static void print(float[][] a)
           
static void print(int[][] a)
           
static void print(short[][] a)
           
static void printArray(double[][] k, java.lang.String name)
           
static void printKernel(double[][] k, java.lang.String name)
           
static void printKernel(float[][] k, java.lang.String name)
           
static void printKernel(short[][] k, java.lang.String name)
           
static void printMaple(float[][] a)
           
static void printMaple(short[][] a)
           
static void printMedian(short[][] k, java.lang.String name)
           
static void printStats(float[][] a)
           
static void printStats(java.lang.String title, float[][] a)
           
static short[][] quadSwap(short[][] r)
          Centers the image by translating the image to the center.
static void removeTheDcComponent(float[][] r)
          Compute the average and remove it from the input 2D mat.
static void removeTheDcComponent(short[][] r)
          Compute the average and remove it from the input 2D mat.
static short[][] resample(short[][] a, int ratio)
           
static void scale(double[][] a, double k)
           
static void scale(float[][] a, double k)
           
static void scale(float[][] a, float k)
           
static float[][] scale(short[][] a, float k)
           
static short[][] scale(short[][] a, short k)
           
static float[][] shortToFloat(short[][] a)
           
static short[][] subtract(short[][] a, short[][] b)
           
static void testOutlier()
           
static void testQuickSort()
           
static void threshold(short[][] a)
           
static void threshold(short[][] a, short thresh)
           
static boolean[][] transpose(boolean[][] src)
           
static byte[][] transpose(byte[][] src)
          returns the Transposition of a 2-D byte matrix of any size.
static char[][] transpose(char[][] src)
          returns the Transposition of a 2-D char matrix of any size.
static double[][] transpose(double[][] src)
          returns the Transposition of a 2-D double matrix of any size.
static float[][] transpose(float[][] src)
          returns the Transposition of a 2-D float matrix of any size.
static int[][] transpose(int[][] src)
          returns the Transposition of a 2-D int matrix of any size.
static long[][] transpose(long[][] src)
          returns the Transposition of a 2-D long matrix of any size.
static java.lang.Object[][] transpose(java.lang.Object[][] src)
          returns the Transposition of a 2-D Object matrix of any size.
static short[][] transpose(short[][] src)
          returns the Transposition of a 2-D short matrix of any size.
static java.lang.String[][] transpose(java.lang.String[][] src)
          returns the Transposition of a 2-D String matrix of any size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mat2

public Mat2()
Method Detail

main

public static void main(java.lang.String[] args)

equal

public static boolean equal(short[][] a,
                            short[][] b)
Parameters:
a - must be the same size as b
b - must be the same size as a
Returns:
true if equal

getSampleSquareMatrix

public static short[][] getSampleSquareMatrix(int n)

print

public static void print(double[][] a)

printStats

public static void printStats(java.lang.String title,
                              float[][] a)

printStats

public static void printStats(float[][] a)

print

public static void print(float[][] a)

print

public static void print(int[][] a)

getMax

public static short getMax(short[][] a)

print

public static void print(short[][] a)

getSum

public static double getSum(double[][] a)

getSum

public static double getSum(float[][] a)
Parameters:
a - 2D array of float
Returns:
a sum of all the values in a.

getSum

public static double getSum(short[][] a)
Parameters:
a - two dim array of shorts
Returns:
the sum of all the values in a.

getShort

public static short[][] getShort(byte[][] a)

getShort

public static short[][] getShort(short[][] a)

clip

public static short clip(short i)

clip

public static short[][] clip(short[][] i)

normalize

public static void normalize(double[][] a)

normalize

public static float[][] normalize(short[][] a)

normalize

public static void normalize(float[][] a)

getAverage

public static double getAverage(double[][] a)
Compute the avg value of the array.

Parameters:
a - rectangular array
Returns:
the average.

getAverage

public static double getAverage(float[][] a)
Compute the avg value of the array.

Parameters:
a - rectangular array
Returns:
the average.

getAverage

public static double getAverage(short[][] a)
Compute the avg value of the array.

Parameters:
a - rectangular array
Returns:
the average.

getStandardDeviation

public static double getStandardDeviation(short[][] a)
Compute the Standard Deviation of the array.

Parameters:
a - rectangular array
Returns:
the average.

threshold

public static void threshold(short[][] a,
                             short thresh)

threshold

public static void threshold(short[][] a)

printKernel

public static void printKernel(float[][] k,
                               java.lang.String name)

printArray

public static void printArray(double[][] k,
                              java.lang.String name)

printKernel

public static void printKernel(double[][] k,
                               java.lang.String name)

printKernel

public static void printKernel(short[][] k,
                               java.lang.String name)

transpose

public static double[][] transpose(double[][] src)
returns the Transposition of a 2-D double matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D double array

scale

public static float[][] scale(short[][] a,
                              float k)

scale

public static short[][] scale(short[][] a,
                              short k)

scale

public static void scale(double[][] a,
                         double k)

scale

public static void scale(float[][] a,
                         float k)

scale

public static void scale(float[][] a,
                         double k)

shortToFloat

public static float[][] shortToFloat(short[][] a)

copyArray

public static short[][] copyArray(short[][] a)

testOutlier

public static void testOutlier()

intQuickSort

public static void intQuickSort(int[] a,
                                int lo0,
                                int hi0)

getStandardDeviation

public static double getStandardDeviation(float[][] a)

getVariance

public static double getVariance(float[][] a)

getVariance

public static double getVariance(short[][] a)

getAverage

public static double[] getAverage(double[] a,
                                  double[] b,
                                  double[] c)

copy

public static short[][] copy(short[][] r)

getMin

public static short getMin(short[] a)

getMax

public static short getMax(short[] a)

median

public static short median(java.util.Vector v)

testQuickSort

public static void testQuickSort()

numberOfNonZeros

public static int numberOfNonZeros(short[][] k)

printMedian

public static void printMedian(short[][] k,
                               java.lang.String name)

printMaple

public static void printMaple(short[][] a)

printMaple

public static void printMaple(float[][] a)

subtract

public static short[][] subtract(short[][] a,
                                 short[][] b)

resample

public static short[][] resample(short[][] a,
                                 int ratio)

transpose

public static boolean[][] transpose(boolean[][] src)

transpose

public static byte[][] transpose(byte[][] src)
returns the Transposition of a 2-D byte matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D byte array
See Also:
transpose(Object[][])

transpose

public static short[][] transpose(short[][] src)
returns the Transposition of a 2-D short matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D short array
See Also:
transpose(Object[][])

transpose

public static int[][] transpose(int[][] src)
returns the Transposition of a 2-D int matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D int array
See Also:
transpose(Object[][])

transpose

public static long[][] transpose(long[][] src)
returns the Transposition of a 2-D long matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D long array
See Also:
transpose(Object[][])

transpose

public static float[][] transpose(float[][] src)
returns the Transposition of a 2-D float matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D float array
See Also:
transpose(Object[][])

transpose

public static char[][] transpose(char[][] src)
returns the Transposition of a 2-D char matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D char array
See Also:
transpose(Object[][]), transpose(String[][])

transpose

public static java.lang.String[][] transpose(java.lang.String[][] src)
returns the Transposition of a 2-D String matrix of any size. If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D String array
See Also:
transpose(Object[][]), transpose(char[][])

transpose

public static java.lang.Object[][] transpose(java.lang.Object[][] src)
returns the Transposition of a 2-D Object matrix of any size. You can use this for any descendants of the Object class, like data sets and GUI-Components You can also use this if you enclosed your primitive datatypes in Wrapper-classes like Integer and Double, but i think using the generic types will be faster (not only for this, but any math operation, like what you probably do when you transpose number matrixes) If you supply a matrix of size AxB, the return's size will be BxA.

Parameters:
src - : the source array
Returns:
a 2-D Object array. use cast to get back your original Class type.

grow

public static short[][] grow(short[][] in,
                             java.awt.Dimension dimension,
                             int borderType)

getIdentity

public static short[][] getIdentity(int r,
                                    int c)

getInt2

public static int[][] getInt2(int[] pels,
                              int width,
                              int height)

quadSwap

public static short[][] quadSwap(short[][] r)
Centers the image by translating the image to the center. This can be done via a phase shift in the frequency domain, but I think this is pretty fast (using JAI, etc.).
q1 q2 q3 q4 becomes: q4 q3 q2 q1 QuadSwap destroys its argument.


removeTheDcComponent

public static void removeTheDcComponent(short[][] r)
Compute the average and remove it from the input 2D mat.

Parameters:
r - non-negative array of shorts.

removeTheDcComponent

public static void removeTheDcComponent(float[][] r)
Compute the average and remove it from the input 2D mat.

Parameters:
r - non-negative array of shorts.