Class RealDenseTranspose

java.lang.Object
org.flag4j.linalg.ops.dense.real.RealDenseTranspose

public final class RealDenseTranspose extends Object
This class contains several low-level algorithms for computing the transpose of real dense tensors.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[][]
    blockedIntMatrix(int[][] src)
    Transposes an integer matrix using a blocked algorithm.
    static double[]
    blockedMatrix(double[] src, int numRows, int numCols)
    Transposes a matrix using a blocked algorithm.
    static double[]
    blockedMatrixConcurrent(double[] src, int numRows, int numCols)
    Computes the transpose of a matrix using a blocked concurrent algorithm.
    static double[]
    standard(double[] src, Shape shape, int[] axes)
    Computes the transpose of a tensor.
    static double[]
    standard(double[] src, Shape shape, int axis1, int axis2)
    Transposes tensor along specified axes using a standard transpose algorithm.
    static double[]
    standardConcurrent(double[] src, Shape shape, int[] axes)
    Computes the transpose of a tensor using a concurrent implementation.
    static double[]
    standardConcurrent(double[] src, Shape shape, int axis1, int axis2)
    Transposes tensor along specified axes using a standard concurrent transpose algorithm.
    static int[][]
    standardIntMatrix(int[][] src)
    Transposes a matrix using the standard algorithm.
    static double[]
    standardMatrix(double[] src, int numRows, int numCols)
    Transposes a matrix using the standard algorithm.
    static double[]
    standardMatrixConcurrent(double[] src, int numRows, int numCols)
    Computes the transpose of a matrix using a standard concurrent algorithm.

    Methods inherited from class java.lang.Object

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

    • standard

      public static double[] standard(double[] src, Shape shape, int axis1, int axis2)
      Transposes tensor along specified axes using a standard transpose algorithm. In this context, transposing a tensor is equivalent to swapping a pair of axes.
      Parameters:
      src - Entries of the tensor.
      shape - Shape of the tensor to transpose.
      axis1 - First axis to swap in transpose.
      axis2 - Second axis to swap in transpose.
      Returns:
      The transpose of the tensor along the specified axes.
    • standard

      public static double[] standard(double[] src, Shape shape, int[] axes)
      Computes the transpose of a tensor. That is, interchanges the axes of the tensor so that it matches the specified axes permutation.
      Parameters:
      src - Entries of the tensor.
      shape - Shape of the tensor to transpose.
      axes - Permutation of tensor axis. If the tensor has rank N, then this must be an array of length N which is a permutation of {0, 1, 2, ..., N-1}.
      Returns:
      The transpose of the tensor along the specified axes.
      Throws:
      IllegalArgumentException - If the axes array is not a permutation of {0, 1, 2, ..., N-1}.
      IllegalArgumentException - If the shape rank is less than 2.
    • standardConcurrent

      public static double[] standardConcurrent(double[] src, Shape shape, int[] axes)
      Computes the transpose of a tensor using a concurrent implementation. That is, interchanges the axes of the tensor so that it matches the specified axes permutation.
      Parameters:
      src - Entries of the tensor.
      shape - Shape of the tensor to transpose.
      axes - Permutation of tensor axis. If the tensor has rank N, then this must be an array of length N which is a permutation of {0, 1, 2, ..., N-1}.
      Returns:
      The transpose of the tensor along the specified axes.
      Throws:
      IllegalArgumentException - If the axes array is not a permutation of {0, 1, 2, ..., N-1}.
      IllegalArgumentException - If the shape rank is less than 2.
    • standardConcurrent

      public static double[] standardConcurrent(double[] src, Shape shape, int axis1, int axis2)
      Transposes tensor along specified axes using a standard concurrent transpose algorithm. In this context, transposing a tensor is equivalent to swapping a pair of axes.
      Parameters:
      src - Entries of the tensor.
      shape - Shape of the tensor to transpose.
      axis1 - First axis to swap in transpose.
      axis2 - Second axis to swap in transpose.
      Returns:
      The transpose of the tensor along the specified axes.
    • standardMatrix

      public static double[] standardMatrix(double[] src, int numRows, int numCols)
      Transposes a matrix using the standard algorithm.
      Parameters:
      src - Entries of the matrix to transpose.
      numRows - Number of rows in the matrix.
      numCols - Number of columns in the matrix.
      Returns:
      The transpose of the matrix.
    • blockedMatrix

      public static double[] blockedMatrix(double[] src, int numRows, int numCols)
      Transposes a matrix using a blocked algorithm. To get or set the block size see Configurations.getBlockSize() or Configurations.setBlockSize(int).
      Parameters:
      src - Source data to compute transpose of.
      numRows - Number of rows in the matrix.
      numCols - Number of columns in the matrix.
      Returns:
      The transpose of this tensor along specified axes
    • standardMatrixConcurrent

      public static double[] standardMatrixConcurrent(double[] src, int numRows, int numCols)
      Computes the transpose of a matrix using a standard concurrent algorithm.
      Parameters:
      src - Entries of the matrix to transpose.
      numRows - Number of rows in source matrix.
      numCols - Number of columns in source matrix.
      Returns:
      The transpose of the source matrix.
    • blockedMatrixConcurrent

      public static double[] blockedMatrixConcurrent(double[] src, int numRows, int numCols)
      Computes the transpose of a matrix using a blocked concurrent algorithm.
      Parameters:
      src - Entries of the matrix to transpose.
      numRows - Number of rows in source matrix.
      numCols - Number of columns in source matrix.
      Returns:
      The transpose of the source matrix.
    • standardIntMatrix

      public static int[][] standardIntMatrix(int[][] src)
      Transposes a matrix using the standard algorithm.
      Parameters:
      src - Entries of the matrix to transpose.
      Returns:
      The transpose of the matrix.
    • blockedIntMatrix

      public static int[][] blockedIntMatrix(int[][] src)
      Transposes an integer matrix using a blocked algorithm.
      Parameters:
      src - Entries of the matrix to transpose.
      Returns:
      The transpose of the matrix.