Interface MatrixStrategy

All Known Implementing Classes:
DoubleMatrixStrategy, FloatMatrixStrategy, IntAparapiMatrixStrategy, IntMatrixStrategy, LongAparapiMatrixStrategy, LongMatrixStrategy

public interface MatrixStrategy
Matrix operations.
Since:
1.7.0
Version:
1.7.0
Author:
Mikko Tommila
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    permuteToDoubleWidth​(ArrayAccess arrayAccess, int n1, int n2)
    Permute the rows of the n1 x n2 matrix so that it is shaped like a n1/2 x 2*n2 matrix.
    void
    permuteToHalfWidth​(ArrayAccess arrayAccess, int n1, int n2)
    Permute the rows of the n1 x n2 matrix so that it is shaped like a 2*n1 x n2/2 matrix.
    void
    transpose​(ArrayAccess arrayAccess, int n1, int n2)
    Transpose a n1 x n2 matrix.
    void
    transposeSquare​(ArrayAccess arrayAccess, int n1, int n2)
    Transpose a square n1 x n1 block of n1 x n2 matrix.
  • Method Details

    • transpose

      void transpose(ArrayAccess arrayAccess, int n1, int n2) throws ApfloatRuntimeException
      Transpose a n1 x n2 matrix.

      Both n1 and n2 must be powers of two. Additionally, one of these must be true:

      n1 = n2
      n1 = 2*n2
      n2 = 2*n1

      Parameters:
      arrayAccess - Accessor to the matrix data. This data will be transposed.
      n1 - Number of rows in the matrix.
      n2 - Number of columns in the matrix.
      Throws:
      ApfloatRuntimeException
    • transposeSquare

      void transposeSquare(ArrayAccess arrayAccess, int n1, int n2) throws ApfloatRuntimeException
      Transpose a square n1 x n1 block of n1 x n2 matrix.

      Both n1 and n2 must be powers of two, and n1 <= n2.

      Parameters:
      arrayAccess - Accessor to the matrix data. This data will be transposed.
      n1 - Number of rows and columns in the block to be transposed.
      n2 - Number of columns in the matrix.
      Throws:
      ApfloatRuntimeException
    • permuteToDoubleWidth

      void permuteToDoubleWidth(ArrayAccess arrayAccess, int n1, int n2) throws ApfloatRuntimeException
      Permute the rows of the n1 x n2 matrix so that it is shaped like a n1/2 x 2*n2 matrix. Logically, the matrix is split in half, and the lower half is moved to the right side of the upper half.

      Both n1 and n2 must be powers of two, and n1 >= 2.

      E.g. if the matrix layout is originally as follows:

      Matrix before
      0123
      4567
      891011
      12131415

      Then after this method it is as follows:

      Matrix after
      0123891011
      456712131415
      Parameters:
      arrayAccess - Accessor to the matrix data. This data will be permuted.
      n1 - Number of rows in the matrix.
      n2 - Number of columns in the matrix.
      Throws:
      ApfloatRuntimeException
      Since:
      1.7.0
    • permuteToHalfWidth

      void permuteToHalfWidth(ArrayAccess arrayAccess, int n1, int n2) throws ApfloatRuntimeException
      Permute the rows of the n1 x n2 matrix so that it is shaped like a 2*n1 x n2/2 matrix. Logically, the matrix is split in half, and the right half is moved below the left half.

      Both n1 and n2 must be powers of two. E.g. if the matrix layout is originally as follows:

      Matrix before
      01234567
      89101112131415

      Then after this method it is as follows:

      Matrix after
      0123
      891011
      4567
      12131415
      Parameters:
      arrayAccess - Accessor to the matrix data. This data will be permuted.
      n1 - Number of rows in the matrix.
      n2 - Number of columns in the matrix.
      Throws:
      ApfloatRuntimeException