public Matrix scale(int ratio) {
        Matrix result = new Matrix(rows, columns);
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < columns; j++) {
                result.set(matrix[i][j] * ratio, i, j);
            }
        }
        return result;
    }