Multiplies every element in row r by a scalar s. - Java java.lang

Java examples for java.lang:Math Matrix

Description

Multiplies every element in row r by a scalar s.

Demo Code



public class Main{
    /**/*from w  ww. j a va 2s .com*/
     * Multiplies every element in row <code>r</code> by a scalar <code>s</code>.
     */
    public static void rowScale(int[][] matrix, int r, int s, Field field) {
        int width = matrix[0].length;
        for (int column = 0; column < width; column++) {
            matrix[r][column] = field.mul(matrix[r][column], s);
        }
    }
}

Related Tutorials