no.hiof.imagepr.tools
Class MatrixTools

java.lang.Object
  extended byno.hiof.imagepr.tools.MatrixTools

public class MatrixTools
extends java.lang.Object

The class MatrixTools contains some static methods performing some useful operations on matrices.

Author:
Per-Olav Rus;ås

Constructor Summary
MatrixTools()
           
 
Method Summary
static double[][] copy(double[][] matrix)
          Creates a copy of a double matrix.
static short[][] copy(short[][] matrix)
          Creates a copy of a short matrix.
static short[][] double2short(double[][] matrix, double factor)
           
static void fill(short[][] matrix, short value)
          Fills the matrix with a value.
static double mean(short[][] matrix)
          Find the mean value of the elements in a matrix.
static void print(short[][] matrix)
          Prints the contens of a short matrix to standard out.
static short[][] subMatrix(short[][] matrix, int fromRow, int toRow, int fromCol, int toCol)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixTools

public MatrixTools()
Method Detail

print

public static void print(short[][] matrix)
Prints the contens of a short matrix to standard out. Useful for debugging purposes on small matrices.

Parameters:
matrix - A matrix to be printed.

fill

public static void fill(short[][] matrix,
                        short value)
Fills the matrix with a value.

Parameters:
matrix - A matrix.
value - A value.

copy

public static short[][] copy(short[][] matrix)
Creates a copy of a short matrix.

Parameters:
matrix - A matrix to be copied.
Returns:
The copy.

copy

public static double[][] copy(double[][] matrix)
Creates a copy of a double matrix.

Parameters:
matrix - A matrix to be copied.
Returns:
The copy.

mean

public static double mean(short[][] matrix)
Find the mean value of the elements in a matrix.

Parameters:
matrix - A matrix.
Returns:
the mean value.

double2short

public static short[][] double2short(double[][] matrix,
                                     double factor)

subMatrix

public static short[][] subMatrix(short[][] matrix,
                                  int fromRow,
                                  int toRow,
                                  int fromCol,
                                  int toCol)