Buggy code:
public abstract class AbstractRealMatrix implements RealMatrix { protected AbstractRealMatrix ( ) { } protected AbstractRealMatrix ( final int rowDimension , final int columnDimension ) { } public abstract RealMatrix createMatrix ( final int rowDimension , final int columnDimension ) { } public abstract RealMatrix copy ( ) { } public RealMatrix add ( RealMatrix m ) { } public RealMatrix subtract ( final RealMatrix m ) { } public RealMatrix scalarAdd ( final double d ) { } public RealMatrix scalarMultiply ( final double d ) { } public RealMatrix multiply ( final RealMatrix m ) { } public RealMatrix preMultiply ( final RealMatrix m ) { } public RealMatrix power ( final int p ) { } public double [ ] [ ] getData ( ) { } public double getNorm ( ) { } public double getFrobeniusNorm ( ) { } public RealMatrix getSubMatrix ( final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public RealMatrix getSubMatrix ( final int [ ] selectedRows , final int [ ] selectedColumns ) { } public void copySubMatrix ( final int startRow , final int endRow , final int startColumn , final int endColumn , final double [ ] [ ] destination ) { } public void copySubMatrix ( int [ ] selectedRows , int [ ] selectedColumns , double [ ] [ ] destination ) { } public void setSubMatrix ( final double [ ] [ ] subMatrix , final int row , final int column ) { } public RealMatrix getRowMatrix ( final int row ) { } public void setRowMatrix ( final int row , final RealMatrix matrix ) { } public RealMatrix getColumnMatrix ( final int column ) { } public void setColumnMatrix ( final int column , final RealMatrix matrix ) { } public RealVector getRowVector ( final int row ) { } public void setRowVector ( final int row , final RealVector vector ) { } public RealVector getColumnVector ( final int column ) { } public void setColumnVector ( final int column , final RealVector vector ) { } public double [ ] getRow ( final int row ) { } public void setRow ( final int row , final double [ ] array ) { } public double [ ] getColumn ( final int column ) { } public void setColumn ( final int column , final double [ ] array ) { } public abstract double getEntry ( int row , int column ) { } public abstract void setEntry ( int row , int column , double value ) { } public abstract void addToEntry ( int row , int column , double increment ) { } public abstract void multiplyEntry ( int row , int column , double factor ) { } public RealMatrix transpose ( ) { } public boolean isSquare ( ) { } public abstract int getRowDimension ( ) { } public abstract int getColumnDimension ( ) { } public double getTrace ( ) { } public double [ ] operate ( final double [ ] v ) { } public RealVector operate ( final RealVector v ) { } public double [ ] preMultiply ( final double [ ] v ) { } public RealVector preMultiply ( final RealVector v ) { try { return new ArrayRealVector ( preMultiply ( ( ( ArrayRealVector ) ( v ) ) . getDataRef ( ) ) , false ) ; } catch ( ClassCastException cce ) { final int nRows = getRowDimension ( ) ; final int nCols = getColumnDimension ( ) ; if ( ( v . getDimension ( ) ) != nRows ) { throw new org . apache . commons . math . exception . DimensionMismatchException ( v . getDimension ( ) , nRows ) ; } final double [ ] out = new double [ nCols ] ; for ( int col = 0 ; col < nCols ; ++ col ) { double sum = 0 ; for ( int i = 0 ; i < nRows ; ++ i ) { sum += ( getEntry ( i , col ) ) * ( v . getEntry ( i ) ) ; } out [ col ] = sum ; } <START_BUG> return new ArrayRealVector ( out ) ; <END_BUG> } } public double walkInRowOrder ( final RealMatrixChangingVisitor visitor ) { } public double walkInRowOrder ( final RealMatrixPreservingVisitor visitor ) { } public double walkInRowOrder ( final RealMatrixChangingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public double walkInRowOrder ( final RealMatrixPreservingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public double walkInColumnOrder ( final RealMatrixChangingVisitor visitor ) { } public double walkInColumnOrder ( final RealMatrixPreservingVisitor visitor ) { } public double walkInColumnOrder ( final RealMatrixChangingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public double walkInColumnOrder ( final RealMatrixPreservingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public double walkInOptimizedOrder ( final RealMatrixChangingVisitor visitor ) { } public double walkInOptimizedOrder ( final RealMatrixPreservingVisitor visitor ) { } public double walkInOptimizedOrder ( final RealMatrixChangingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } public double walkInOptimizedOrder ( final RealMatrixPreservingVisitor visitor , final int startRow , final int endRow , final int startColumn , final int endColumn ) { } @ Override public String toString ( ) { } @ Override public boolean equals ( final Object object ) { } @ Override public int hashCode ( ) { } }

Fix:
return new ArrayRealVector ( out , false ) ;