public static void multAddTransA_reorder(DMatrix1Row A , DMatrixD1 B , DMatrixD1 C )
    {
        if( C.numCols != 1 ) {
            throw new MatrixDimensionException("C is not a column vector");
        } else if( C.numRows != A.numCols ) {
            throw new MatrixDimensionException("C is not the expected length");
        }
        if( B.numRows == 1 ) {
            if( A.numRows != B.numCols ) {
                throw new MatrixDimensionException("A and B are not compatible");
            }
        } else if( B.numCols == 1 ) {
            if( A.numRows != B.numRows ) {
                throw new MatrixDimensionException("A and B are not compatible");
            }
        } else {
            throw new MatrixDimensionException("B is not a vector");
        }

        C.reshape(A.numCols,1);

        int indexA = 0;
        for( int j = 0; j < A.numRows; j++ ) {
            double B_val = B.get(j);
            for( int i = 0; i < A.numCols; i++ ) {
                C.plus( i , A.get(indexA++) * B_val );
            }
        }
    }
public static void multAddTransA_reorder ( DMatrix1Row A , DMatrixD1 B , DMatrixD1 C ) { if ( C . numCols != 1 ) { throw new MatrixDimensionException ( "C is not a column vector" ) ; } else if ( C . numRows != A . numCols ) { throw new MatrixDimensionException ( "C is not the expected length" ) ; } if ( B . numRows == 1 ) { if ( A . numRows != B . numCols ) { throw new MatrixDimensionException ( "A and B are not compatible" ) ; } } else if ( B . numCols == 1 ) { if ( A . numRows != B . numRows ) { throw new MatrixDimensionException ( "A and B are not compatible" ) ; } } else { throw new MatrixDimensionException ( "B is not a vector" ) ; } C . reshape ( A . numCols , 1 ) ; int indexA = 0 ; for ( int j = 0 ; j < A . numRows ; j ++ ) { double B_val = B . get ( j ) ; for ( int i = 0 ; i < A . numCols ; i ++ ) { C . plus ( i , A . get ( indexA ++ ) * B_val ) ; } } }
An alternative implementation of {@link #multAddTransA_small} that performs well on large
matrices.  There is a relative performance hit when used on small matrices.

@param A A matrix that is m by n. Not modified.
@param B A vector that has length m. Not modified.
@param C A column vector that has length n. Modified.