Array2DRowRealMatrix extends AbstractRealMatrix implements Serializable { @Override public double[] operate(final double[] v) throws DimensionMismatchException { final int nRows = this.getRowDimension(); final int nCols = this.getColumnDimension(); if (v.length != nCols) { throw new DimensionMismatchException(v.length, nCols); } final double[] out = new double[nRows]; for (int row = 0; row < nRows; row++) { final double[] dataRow = data[row]; double sum = 0; for (int i = 0; i < nCols; i++) { sum += dataRow[i] * v[i]; } out[row] = sum; } return out; } Array2DRowRealMatrix();  Array2DRowRealMatrix(final int rowDimension,
                                final int columnDimension);  Array2DRowRealMatrix(final double[][] d);  Array2DRowRealMatrix(final double[][] d, final boolean copyArray);  Array2DRowRealMatrix(final double[] v); @Override RealMatrix createMatrix(final int rowDimension,
                                   final int columnDimension); @Override RealMatrix copy(); Array2DRowRealMatrix add(final Array2DRowRealMatrix m); Array2DRowRealMatrix subtract(final Array2DRowRealMatrix m); Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m); @Override double[][] getData(); double[][] getDataRef(); @Override void setSubMatrix(final double[][] subMatrix, final int row,
                             final int column); @Override double getEntry(final int row, final int column); @Override void setEntry(final int row, final int column, final double value); @Override void addToEntry(final int row, final int column,
                           final double increment); @Override void multiplyEntry(final int row, final int column,
                              final double factor); @Override int getRowDimension(); @Override int getColumnDimension(); @Override double[] operate(final double[] v); @Override double[] preMultiply(final double[] v); @Override double walkInRowOrder(final RealMatrixChangingVisitor visitor); @Override double walkInRowOrder(final RealMatrixPreservingVisitor visitor); @Override double walkInRowOrder(final RealMatrixChangingVisitor visitor,
                                 final int startRow, final int endRow,
                                 final int startColumn, final int endColumn); @Override double walkInRowOrder(final RealMatrixPreservingVisitor visitor,
                                 final int startRow, final int endRow,
                                 final int startColumn, final int endColumn); @Override double walkInColumnOrder(final RealMatrixChangingVisitor visitor); @Override double walkInColumnOrder(final RealMatrixPreservingVisitor visitor); @Override double walkInColumnOrder(final RealMatrixChangingVisitor visitor,
                                    final int startRow, final int endRow,
                                    final int startColumn, final int endColumn); @Override double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,
                                    final int startRow, final int endRow,
                                    final int startColumn, final int endColumn);  }
@Test public void testOperate() { RealMatrix m = new Array2DRowRealMatrix(id); TestUtils.assertEquals("identity operate", testVector, m.operate(testVector), entryTolerance); TestUtils.assertEquals("identity operate", testVector, m.operate(new ArrayRealVector(testVector)).toArray(), entryTolerance); m = new Array2DRowRealMatrix(bigSingular); try { m.operate(testVector); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { } }