Java Matrix Copy copyMatrixRow(final float[] m_in, final int m_in_off, final int row, final float[] v_out, final int v_out_off)

Here you can find the source of copyMatrixRow(final float[] m_in, final int m_in_off, final int row, final float[] v_out, final int v_out_off)

Description

Copy the named row of the given column-major matrix to v_out.

License

Open Source License

Parameter

Parameter Description
m_in input column-major matrix
m_in_off offset to input matrix
row named row to copy
v_out the row-vector storage, at least 3 components long
v_out_off offset to storage

Return

given result vector v_out for chaining

Declaration

public static float[] copyMatrixRow(final float[] m_in,
        final int m_in_off, final int row, final float[] v_out,
        final int v_out_off) 

Method Source Code

//package com.java2s;

public class Main {
    /**// ww w.  j av a 2  s. c om
     * Copy the named row of the given column-major matrix to v_out.
     * <p>
     * v_out may be 3 or 4 components long, hence the 4th column may not be stored.
     * </p>
     * @param m_in input column-major matrix
     * @param m_in_off offset to input matrix
     * @param row named row to copy
     * @param v_out the row-vector storage, at least 3 components long
     * @param v_out_off offset to storage
     * @return given result vector <i>v_out</i> for chaining
     */
    public static float[] copyMatrixRow(final float[] m_in,
            final int m_in_off, final int row, final float[] v_out,
            final int v_out_off) {
        v_out[0 + v_out_off] = m_in[row + 0 * 4 + m_in_off];
        v_out[1 + v_out_off] = m_in[row + 1 * 4 + m_in_off];
        v_out[2 + v_out_off] = m_in[row + 2 * 4 + m_in_off];
        if (v_out.length > 3 + v_out_off) {
            v_out[3 + v_out_off] = m_in[row + 3 * 4 + m_in_off];
        }
        return v_out;
    }
}

Related

  1. copyMatrix(final double[][] src, final double[][] dest, int n)
  2. copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix)
  3. copyMatrix(float[] origin, float destination[])
  4. copyMatrixBlock(final double[][] src, int i_src, int j_src, final double[][] dest, int i_dest, int j_dest, int rows, int cols)
  5. copyMatrixEliminateRowAndColumn(double[][] matrix, int rowToEliminate, int colToEliminate)
  6. matrixCopy(int[][] matrix)