List of utility methods to do Matrix Transpose
float[] | transposeMatrix(final float[] msrc, final int msrc_offset, final float[] mres, final int mres_offset) Transpose the given matrix. mres[mres_offset + 0] = msrc[msrc_offset + 0 * 4]; mres[mres_offset + 1] = msrc[msrc_offset + 1 * 4]; mres[mres_offset + 2] = msrc[msrc_offset + 2 * 4]; mres[mres_offset + 3] = msrc[msrc_offset + 3 * 4]; final int i4_1 = 1 * 4; mres[mres_offset + 0 + i4_1] = msrc[msrc_offset + 1 + 0 * 4]; mres[mres_offset + 1 + i4_1] = msrc[msrc_offset + 1 + 1 * 4]; mres[mres_offset + 2 + i4_1] = msrc[msrc_offset + 1 + 2 * 4]; ... |
void | transposeMatrix3x3(float[] result, float[] m) transpose Matrixx for (int i = 0, j = 0; i < 3; i++, j += 4) { result[i] = m[j]; result[i + 4] = m[j + 1]; result[i + 8] = m[j + 2]; |
double[] | transposematrixmultiply(final double[][] A, final double[] b) Multiply matrix transpose(A) with vector b. double[] answer = new double[b.length]; for (int row = 0; row < answer.length; ++row) for (int col = 0; col < b.length; ++col) answer[row] += A[col][row] * b[col]; return answer; |
double[][] | transposeQuad(final double[][] src, int n) Transposes the given quadratic matrix. assert hasShape(src, n, n); final double[][] dest = new double[n][n]; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { dest[i][j] = src[j][i]; dest[j][i] = src[i][j]; return dest; |
T[][] | transposeSquareMatrix(T[][] matrixT) transpose Square Matrix Object[][] matrix = new Object[matrixT.length][matrixT.length]; int matrixSize = matrixT.length; for (int i = 0; i < matrixSize; i++) { for (int j = 0; j < matrixSize; j++) { matrix[i][j] = (Object) matrixT[j][i]; return (T[][]) matrix; ... |
long[] | transposeValue(long[] valSet, int DEPTH) Transpose the value from long[DIM] to long[DEPTH]. long[] tv = new long[DEPTH]; long valMask = 1L << (DEPTH - 1); int rightShift = DEPTH - 1; for (int j = 0; j < DEPTH; j++) { long pos = 0; for (long v : valSet) { pos <<= 1; pos |= (valMask & v) >>> rightShift; ... |