Class RandomMatrices_FDRM

java.lang.Object
org.ejml.dense.row.RandomMatrices_FDRM

@Generated("org.ejml.dense.row.RandomMatrices_DDRM") public class RandomMatrices_FDRM extends Object
Contains a list of functions for creating random row real matrices and vectors with different structures.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addUniform(org.ejml.data.FMatrixRMaj A, float min, float max, Random rand)
    Adds random values to each element in the matrix from an uniform distribution.

    aij = aij + U(min,max)
    static org.ejml.data.FMatrixRMaj
    diagonal(int N, float min, float max, Random rand)
    Creates a random diagonal matrix where the diagonal elements are selected from a uniform distribution that goes from min to max.
    static org.ejml.data.FMatrixRMaj
    diagonal(int numRows, int numCols, float min, float max, Random rand)
    Creates a random matrix where all elements are zero but diagonal elements.
    static void
    fillGaussian(org.ejml.data.FMatrixD1 mat, float mean, float stdev, Random rand)
    Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and standard deviation
    static void
    fillUniform(org.ejml.data.FMatrixD1 mat, float min, float max, Random rand)
    Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive.
    static void
    fillUniform(org.ejml.data.FMatrixRMaj mat, Random rand)
    Sets each element in the matrix to a value drawn from an uniform distribution from 0 to 1 inclusive.
    static org.ejml.data.FMatrixRMaj
    insideSpan(org.ejml.data.FMatrixRMaj[] span, float min, float max, Random rand)
    Creates a random vector that is inside the specified span.
    static org.ejml.data.FMatrixRMaj
    orthogonal(int numRows, int numCols, Random rand)
    Creates a random orthogonal or isometric matrix, depending on the number of rows and columns.
    static org.ejml.data.BMatrixRMaj
    randomBinary(int numRow, int numCol, Random rand)
    Returns new boolean matrix with true or false values selected with equal probability.
    static org.ejml.data.FMatrixRMaj
    rectangle(int numRow, int numCol, float min, float max, Random rand)
    Returns a matrix where all the elements are selected independently from a uniform distribution between 'min' and 'max' inclusive.
    static org.ejml.data.FMatrixRMaj
    rectangle(int numRow, int numCol, Random rand)
    Returns a matrix where all the elements are selected independently from a uniform distribution between 0 and 1 inclusive.
    static org.ejml.data.FMatrixRMaj
    rectangleGaussian(int numRow, int numCol, float mean, float stdev, Random rand)
    Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and standard deviation
    static void
    setRandomB(org.ejml.data.BMatrixRMaj mat, Random rand)
    Sets each element in the boolean matrix to true or false with equal probability
    static org.ejml.data.FMatrixRMaj
    singular(int numRows, int numCols, Random rand, float... sv)
    Creates a random matrix which will have the provided singular values.
    static org.ejml.data.FMatrixRMaj[]
    span(int dimen, int numVectors, Random rand)
    Creates a randomly generated set of orthonormal vectors.
    static org.ejml.data.FMatrixRMaj
    symmetric(int length, float min, float max, Random rand)
    Creates a random symmetric matrix whose values are selected from an uniform distribution from min to max, inclusive.
    static void
    symmetric(org.ejml.data.FMatrixRMaj A, float min, float max, Random rand)
    Sets the provided square matrix to be a random symmetric matrix whose values are selected from an uniform distribution from min to max, inclusive.
    static org.ejml.data.FMatrixRMaj
    symmetricPosDef(int width, Random rand)
    Creates a random symmetric positive definite matrix.
    static org.ejml.data.FMatrixRMaj
    symmetricWithEigenvalues(int num, Random rand, float... eigenvalues)
    Creates a new random symmetric matrix that will have the specified real eigenvalues.
    static org.ejml.data.FMatrixRMaj
    triangularLower(int dimen, int hessenberg, float min, float max, Random rand)
    Creates a lower triangular matrix whose values are selected from a uniform distribution.
    static org.ejml.data.FMatrixRMaj
    triangularUpper(int dimen, int hessenberg, float min, float max, Random rand)
    Creates an upper triangular matrix whose values are selected from a uniform distribution.

    Methods inherited from class java.lang.Object

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

    • span

      public static org.ejml.data.FMatrixRMaj[] span(int dimen, int numVectors, Random rand)

      Creates a randomly generated set of orthonormal vectors. At most it can generate the same number of vectors as the dimension of the vectors.

      This is done by creating random vectors then ensuring that they are orthogonal to all the ones previously created with reflectors.

      NOTE: This employs a brute force O(N3) algorithm.

      Parameters:
      dimen - dimension of the space which the vectors will span.
      numVectors - How many vectors it should generate.
      rand - Used to create random vectors.
      Returns:
      Array of N random orthogonal vectors of unit length.
    • insideSpan

      public static org.ejml.data.FMatrixRMaj insideSpan(org.ejml.data.FMatrixRMaj[] span, float min, float max, Random rand)
      Creates a random vector that is inside the specified span.
      Parameters:
      span - The span the random vector belongs in.
      rand - RNG
      Returns:
      A random vector within the specified span.
    • orthogonal

      public static org.ejml.data.FMatrixRMaj orthogonal(int numRows, int numCols, Random rand)

      Creates a random orthogonal or isometric matrix, depending on the number of rows and columns. The number of rows must be more than or equal to the number of columns.

      Parameters:
      numRows - Number of rows in the generated matrix.
      numCols - Number of columns in the generated matrix.
      rand - Random number generator used to create matrices.
      Returns:
      A new isometric matrix.
    • diagonal

      public static org.ejml.data.FMatrixRMaj diagonal(int N, float min, float max, Random rand)
      Creates a random diagonal matrix where the diagonal elements are selected from a uniform distribution that goes from min to max.
      Parameters:
      N - Dimension of the matrix.
      min - Minimum value of a diagonal element.
      max - Maximum value of a diagonal element.
      rand - Random number generator.
      Returns:
      A random diagonal matrix.
    • diagonal

      public static org.ejml.data.FMatrixRMaj diagonal(int numRows, int numCols, float min, float max, Random rand)
      Creates a random matrix where all elements are zero but diagonal elements. Diagonal elements randomly drawn from a uniform distribution from min to max, inclusive.
      Parameters:
      numRows - Number of rows in the returned matrix..
      numCols - Number of columns in the returned matrix.
      min - Minimum value of a diagonal element.
      max - Maximum value of a diagonal element.
      rand - Random number generator.
      Returns:
      A random diagonal matrix.
    • singular

      public static org.ejml.data.FMatrixRMaj singular(int numRows, int numCols, Random rand, float... sv)

      Creates a random matrix which will have the provided singular values. The length of sv is assumed to be the rank of the matrix. This can be useful for testing purposes when one needs to ensure that a matrix is not singular but randomly generated.

      Parameters:
      numRows - Number of rows in generated matrix.
      numCols - NUmber of columns in generated matrix.
      rand - Random number generator.
      sv - Singular values of the matrix.
      Returns:
      A new matrix with the specified singular values.
    • symmetricWithEigenvalues

      public static org.ejml.data.FMatrixRMaj symmetricWithEigenvalues(int num, Random rand, float... eigenvalues)
      Creates a new random symmetric matrix that will have the specified real eigenvalues.
      Parameters:
      num - Dimension of the resulting matrix.
      rand - Random number generator.
      eigenvalues - Set of real eigenvalues that the matrix will have.
      Returns:
      A random matrix with the specified eigenvalues.
    • rectangle

      public static org.ejml.data.FMatrixRMaj rectangle(int numRow, int numCol, Random rand)
      Returns a matrix where all the elements are selected independently from a uniform distribution between 0 and 1 inclusive.
      Parameters:
      numRow - Number of rows in the new matrix.
      numCol - Number of columns in the new matrix.
      rand - Random number generator used to fill the matrix.
      Returns:
      The randomly generated matrix.
    • randomBinary

      public static org.ejml.data.BMatrixRMaj randomBinary(int numRow, int numCol, Random rand)
      Returns new boolean matrix with true or false values selected with equal probability.
      Parameters:
      numRow - Number of rows in the new matrix.
      numCol - Number of columns in the new matrix.
      rand - Random number generator used to fill the matrix.
      Returns:
      The randomly generated matrix.
    • addUniform

      public static void addUniform(org.ejml.data.FMatrixRMaj A, float min, float max, Random rand)

      Adds random values to each element in the matrix from an uniform distribution.

      aij = aij + U(min,max)

      Parameters:
      A - The matrix who is to be randomized. Modified
      min - The minimum value each element can be.
      max - The maximum value each element can be..
      rand - Random number generator used to fill the matrix.
    • rectangle

      public static org.ejml.data.FMatrixRMaj rectangle(int numRow, int numCol, float min, float max, Random rand)

      Returns a matrix where all the elements are selected independently from a uniform distribution between 'min' and 'max' inclusive.

      Parameters:
      numRow - Number of rows in the new matrix.
      numCol - Number of columns in the new matrix.
      min - The minimum value each element can be.
      max - The maximum value each element can be.
      rand - Random number generator used to fill the matrix.
      Returns:
      The randomly generated matrix.
    • fillUniform

      public static void fillUniform(org.ejml.data.FMatrixRMaj mat, Random rand)

      Sets each element in the matrix to a value drawn from an uniform distribution from 0 to 1 inclusive.

      Parameters:
      mat - The matrix who is to be randomized. Modified.
      rand - Random number generator used to fill the matrix.
    • fillUniform

      public static void fillUniform(org.ejml.data.FMatrixD1 mat, float min, float max, Random rand)

      Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive.

      Parameters:
      min - The minimum value each element can be.
      max - The maximum value each element can be.
      mat - The matrix who is to be randomized. Modified.
      rand - Random number generator used to fill the matrix.
    • setRandomB

      public static void setRandomB(org.ejml.data.BMatrixRMaj mat, Random rand)

      Sets each element in the boolean matrix to true or false with equal probability

      Parameters:
      mat - The matrix who is to be randomized. Modified.
      rand - Random number generator used to fill the matrix.
    • rectangleGaussian

      public static org.ejml.data.FMatrixRMaj rectangleGaussian(int numRow, int numCol, float mean, float stdev, Random rand)

      Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and standard deviation

      Parameters:
      numRow - Number of rows in the new matrix.
      numCol - Number of columns in the new matrix.
      mean - Mean value in the distribution
      stdev - Standard deviation in the distribution
      rand - Random number generator used to fill the matrix.
    • fillGaussian

      public static void fillGaussian(org.ejml.data.FMatrixD1 mat, float mean, float stdev, Random rand)

      Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and standard deviation

      Parameters:
      mat - The matrix who is to be randomized. Modified.
      mean - Mean value in the distribution
      stdev - Standard deviation in the distribution
      rand - Random number generator used to fill the matrix.
    • symmetricPosDef

      public static org.ejml.data.FMatrixRMaj symmetricPosDef(int width, Random rand)
      Creates a random symmetric positive definite matrix.
      Parameters:
      width - The width of the square matrix it returns.
      rand - Random number generator used to make the matrix.
      Returns:
      The random symmetric positive definite matrix.
    • symmetric

      public static org.ejml.data.FMatrixRMaj symmetric(int length, float min, float max, Random rand)
      Creates a random symmetric matrix whose values are selected from an uniform distribution from min to max, inclusive.
      Parameters:
      length - Width and height of the matrix.
      min - Minimum value an element can have.
      max - Maximum value an element can have.
      rand - Random number generator.
      Returns:
      A symmetric matrix.
    • symmetric

      public static void symmetric(org.ejml.data.FMatrixRMaj A, float min, float max, Random rand)
      Sets the provided square matrix to be a random symmetric matrix whose values are selected from an uniform distribution from min to max, inclusive.
      Parameters:
      A - The matrix that is to be modified. Must be square. Modified.
      min - Minimum value an element can have.
      max - Maximum value an element can have.
      rand - Random number generator.
    • triangularUpper

      public static org.ejml.data.FMatrixRMaj triangularUpper(int dimen, int hessenberg, float min, float max, Random rand)
      Creates an upper triangular matrix whose values are selected from a uniform distribution. If hessenberg is greater than zero then a hessenberg matrix of the specified degree is created instead.
      Parameters:
      dimen - Number of rows and columns in the matrix..
      hessenberg - 0 for triangular matrix and > 0 for hessenberg matrix.
      min - minimum value an element can be.
      max - maximum value an element can be.
      rand - random number generator used.
      Returns:
      The randomly generated matrix.
    • triangularLower

      public static org.ejml.data.FMatrixRMaj triangularLower(int dimen, int hessenberg, float min, float max, Random rand)
      Creates a lower triangular matrix whose values are selected from a uniform distribution. If hessenberg is greater than zero then a hessenberg matrix of the specified degree is created instead.
      Parameters:
      dimen - Number of rows and columns in the matrix..
      hessenberg - 0 for triangular matrix and > 0 for hessenberg matrix.
      min - minimum value an element can be.
      max - maximum value an element can be.
      rand - random number generator used.
      Returns:
      The randomly generated matrix.