edu.stanford.rsl.konrad.utils
Class TestingTools

java.lang.Object
  extended by edu.stanford.rsl.konrad.utils.TestingTools

public abstract class TestingTools
extends java.lang.Object


Field Summary
static double DELTA
          delta for error margins
 
Constructor Summary
TestingTools()
           
 
Method Summary
static void assertEqualElementWise(SimpleMatrix M1, SimpleMatrix M2, double delta)
          own assert for matrices
static void assertEqualElementWise(SimpleVector v1, SimpleVector v2, double delta)
          own assert for vectors
static double rand(double min, double max)
          Randomly generates , i.e.
static int rand(int min, int max)
          Randomly generates , i.e.
static double randAng()
          Randomly generates , i.e.
static SimpleMatrix randLowerTriangularMatrix(int rows, int cols)
          Randomly generates a lower-triangular matrix of the given size.
static SimpleMatrix randMatrix(int rows, int cols)
          Randomly generates a matrix of the given size.
static SimpleMatrix randMatrixNonSingular(int size)
          Randomly generates a matrix of the given size which is not singular.
static double randNegative()
          Randomly generates , i.e.
static double randNonNegative()
          Randomly generates a non-negative number, i.e.
static double randNonPositive()
          Randomly generates , i.e.
static double randNonZero()
          Randomly generates , i.e.
static double randNotPmOne()
          Randomly generates a number in [-2.0, 2.0) but not +1.0 or -1.0, i.e.
static SimpleMatrix randOrthogonalMatrix(int size)
          Randomly generates an orthogonal matrix of the given size, i.e.
static double randPmOne()
          Randomly generates either +1.0 or -1.0, i.e.
static double randPositive()
          Randomly generates , i.e.
static SimpleMatrix randRotationMatrix2D()
          Randomly generates a 2x2 rotation matrix (representing a 2D rotation).
static SimpleMatrix randRotationMatrix3D()
          Randomly generates a 3x3 rotation matrix (representing a 3D rotation).
static SimpleMatrix randSpecialOrthogonalMatrix(int size)
          Randomly generates an special orthogonal matrix of the given size, i.e.
static SimpleMatrix randUpperTriangularMatrix(int rows, int cols)
          Randomly generates an upper-triangular matrix of the given size.
static SimpleVector randVector(int len)
          Randomly generates a vector of the given length.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELTA

public static final double DELTA
delta for error margins

Constructor Detail

TestingTools

public TestingTools()
Method Detail

assertEqualElementWise

public static final void assertEqualElementWise(SimpleMatrix M1,
                                                SimpleMatrix M2,
                                                double delta)
own assert for matrices


assertEqualElementWise

public static final void assertEqualElementWise(SimpleVector v1,
                                                SimpleVector v2,
                                                double delta)
own assert for vectors


randPmOne

public static final double randPmOne()
Randomly generates either +1.0 or -1.0, i.e. from the set {-1, +1}.


randNotPmOne

public static final double randNotPmOne()
Randomly generates a number in [-2.0, 2.0) but not +1.0 or -1.0, i.e. from the set [-2.0, 2.0) \ {-1.0, 1.0}.


randNonNegative

public static final double randNonNegative()
Randomly generates a non-negative number, i.e. from the set [0.0, 1.0).


randPositive

public static final double randPositive()
Randomly generates , i.e. from the set .


randNonPositive

public static final double randNonPositive()
Randomly generates , i.e. from the set .


randNegative

public static final double randNegative()
Randomly generates , i.e. from the set .


randNonZero

public static final double randNonZero()
Randomly generates , i.e. from the set .


rand

public static final double rand(double min,
                                double max)
Randomly generates , i.e. from the set .


rand

public static final int rand(int min,
                             int max)
Randomly generates , i.e. from the set .


randAng

public static final double randAng()
Randomly generates , i.e. from the set .


randVector

public static final SimpleVector randVector(int len)
Randomly generates a vector of the given length.


randMatrix

public static final SimpleMatrix randMatrix(int rows,
                                            int cols)
Randomly generates a matrix of the given size.


randMatrixNonSingular

public static final SimpleMatrix randMatrixNonSingular(int size)
Randomly generates a matrix of the given size which is not singular.


randRotationMatrix2D

public static final SimpleMatrix randRotationMatrix2D()
Randomly generates a 2x2 rotation matrix (representing a 2D rotation).


randRotationMatrix3D

public static final SimpleMatrix randRotationMatrix3D()
Randomly generates a 3x3 rotation matrix (representing a 3D rotation).


randOrthogonalMatrix

public static final SimpleMatrix randOrthogonalMatrix(int size)
Randomly generates an orthogonal matrix of the given size, i.e. a matrix from O(size).


randSpecialOrthogonalMatrix

public static final SimpleMatrix randSpecialOrthogonalMatrix(int size)
Randomly generates an special orthogonal matrix of the given size, i.e. a matrix from SO(size).


randUpperTriangularMatrix

public static final SimpleMatrix randUpperTriangularMatrix(int rows,
                                                           int cols)
Randomly generates an upper-triangular matrix of the given size.


randLowerTriangularMatrix

public static final SimpleMatrix randLowerTriangularMatrix(int rows,
                                                           int cols)
Randomly generates a lower-triangular matrix of the given size.