Class MatrixOps_DDRB

java.lang.Object
org.ejml.dense.block.MatrixOps_DDRB

public class MatrixOps_DDRB
extends Object
Various operations on DMatrixRBlock.
  • Constructor Details

    • MatrixOps_DDRB

      public MatrixOps_DDRB()
  • Method Details

    • convert

      public static void convert​(DMatrixRMaj src, DMatrixRBlock dst)
      Converts a row major matrix into a row major block matrix.
      Parameters:
      src - Original DMatrixRMaj. Not modified.
      dst - Equivalent DMatrixRBlock. Modified.
    • convertInplace

      public static DMatrixRBlock convertInplace​(DMatrixRMaj src, @Nullable @Nullable DMatrixRBlock dst, @Nullable @Nullable DGrowArray workspace)
      Converts a row major matrix into a row major block matrix. Both matrices will contain the same data array. Useful when you wish to avoid declaring two large matrices.
      Parameters:
      src - Original DMatrixRMaj. Modified.
      dst - Equivalent DMatrixRBlock. Modified.
    • convertRowToBlock

      public static void convertRowToBlock​(int numRows, int numCols, int blockLength, double[] data, @Nullable @Nullable DGrowArray workspace)

      Converts matrix data stored is a row major format into a block row major format in place.

      Parameters:
      numRows - number of rows in the matrix.
      numCols - number of columns in the matrix.
      blockLength - Block size in the converted matrix.
      data - Matrix data in a row-major format. Modified.
      workspace - Optional internal workspace. Nullable.
    • convert

      public static DMatrixRMaj convert​(DMatrixRBlock src, DMatrixRMaj dst)
      Converts a row major block matrix into a row major matrix.
      Parameters:
      src - Original DMatrixRBlock.. Not modified.
      dst - Equivalent DMatrixRMaj. Modified.
    • convertInplace

      public static DMatrixRMaj convertInplace​(DMatrixRBlock src, @Nullable @Nullable DMatrixRMaj dst, @Nullable @Nullable DGrowArray workspace)
      Converts a row major block matrix into a row major matrix. Both matrices will contain the same data array. Useful when you wish to avoid declaring two large matrices.
      Parameters:
      src - Original DMatrixRBlock. Modified.
      dst - Equivalent DMatrixRMaj. Modified.
    • convertBlockToRow

      public static void convertBlockToRow​(int numRows, int numCols, int blockLength, double[] data, @Nullable @Nullable DGrowArray workspace)

      Converts matrix data stored is a block row major format into a row major format in place.

      Parameters:
      numRows - number of rows in the matrix.
      numCols - number of columns in the matrix.
      blockLength - Block size in the converted matrix.
      data - Matrix data in a block row-major format. Modified.
      workspace - Optional internal workspace. Nullable.
    • convertTranSrc

      public static void convertTranSrc​(DMatrixRMaj src, DMatrixRBlock dst)
      Converts the transpose of a row major matrix into a row major block matrix.
      Parameters:
      src - Original DMatrixRMaj. Not modified.
      dst - Equivalent DMatrixRBlock. Modified.
    • mult

      public static void mult​(DMatrixRBlock A, DMatrixRBlock B, DMatrixRBlock C)
    • multTransA

      public static void multTransA​(DMatrixRBlock A, DMatrixRBlock B, DMatrixRBlock C)
    • multTransB

      public static void multTransB​(DMatrixRBlock A, DMatrixRBlock B, DMatrixRBlock C)
    • transpose

      public static DMatrixRBlock transpose​(DMatrixRBlock A, @Nullable @Nullable DMatrixRBlock A_tran)
      Transposes a block matrix.
      Parameters:
      A - Original matrix. Not modified.
      A_tran - Transposed matrix. Modified.
    • createRandom

      public static DMatrixRBlock createRandom​(int numRows, int numCols, double min, double max, Random rand)
    • createRandom

      public static DMatrixRBlock createRandom​(int numRows, int numCols, double min, double max, Random rand, int blockLength)
    • convert

      public static DMatrixRBlock convert​(DMatrixRMaj A, int blockLength)
    • convert

      public static DMatrixRBlock convert​(DMatrixRMaj A)
    • isEquals

      public static boolean isEquals​(DMatrixRBlock A, DMatrixRBlock B)
    • isEquals

      public static boolean isEquals​(DMatrixRBlock A, DMatrixRBlock B, double tol)
    • zeroTriangle

      public static void zeroTriangle​(boolean upper, DMatrixRBlock A)
      Sets either the upper or low triangle of a matrix to zero
    • copyTriangle

      public static void copyTriangle​(boolean upper, DMatrixRBlock src, DMatrixRBlock dst)
      Copies either the upper or lower triangular portion of src into dst. Dst can be smaller than src.
      Parameters:
      upper - If the upper or lower triangle is copied.
      src - The source matrix. Not modified.
      dst - The destination matrix. Modified.
    • set

      public static void set​(DMatrixRBlock A, double value)

      Sets every element in the matrix to the specified value.

      aij = value

      Parameters:
      A - A matrix whose elements are about to be set. Modified.
      value - The value each element will have.
    • setIdentity

      public static void setIdentity​(DMatrixRBlock A)

      Sets the value of A to all zeros except along the diagonal.

      Parameters:
      A - Block matrix.
    • identity

      public static DMatrixRBlock identity​(int numRows, int numCols, int blockLength)

      Returns a new matrix with ones along the diagonal and zeros everywhere else.

      Parameters:
      numRows - Number of rows.
      numCols - NUmber of columns.
      blockLength - Block length.
      Returns:
      An identify matrix.
    • checkIdenticalShape

      public static void checkIdenticalShape​(DMatrixRBlock A, DMatrixRBlock B)

      Checks to see if the two matrices have an identical shape an block size.

      Parameters:
      A - Matrix.
      B - Matrix.
    • extractAligned

      public static void extractAligned​(DMatrixRBlock src, DMatrixRBlock dst)

      Extracts a matrix from src into dst. The submatrix which is copied has its initial coordinate at (0,0) and ends at (dst.numRows,dst.numCols). The end rows/columns must be aligned along blocks or else it will silently screw things up.

      Parameters:
      src - Matrix which a submatrix is being extracted from. Not modified.
      dst - Where the submatrix is written to. Its rows and columns be less than or equal to 'src'. Modified.
    • blockAligned

      public static boolean blockAligned​(int blockLength, DSubmatrixD1 A)
      Checks to see if the submatrix has its boundaries along inner blocks.
      Parameters:
      blockLength - Size of an inner block.
      A - Submatrix.
      Returns:
      If it is block aligned or not.