Adds s times one row to another row - Java java.lang

Java examples for java.lang:Math Matrix

Description

Adds s times one row to another row

Demo Code



public class Main{
    /**/*w  w  w  .  j  a  v  a 2 s  . c o  m*/
     * Adds <code>s</code> times row <code>rs</code> to row <code>rd</code>.
     */
    public static void rowAddMultiple(int[][] matrix, int rd, int rs,
            int s, Field field) {
        int width = matrix[0].length;
        for (int column = 0; column < width; column++) {
            matrix[rd][column] = field.add(matrix[rd][column],
                    field.mul(matrix[rs][column], s));
        }
    }
}

Related Tutorials