commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject [math] AbstractFieldMatrix.checkMultiplicationCompatible() throws exception?
Date Wed, 16 Dec 2015 19:08:03 GMT
Hi,

I'm working on making the linear package standalone.  The methods that perform precondition
checks for matrix operations throw exceptions (See below).  An option would be return a boolean
instead.  Obviously I would love it if CM adopts the code at some point, so I want to check
whether changing the interface is going to kill kittens.

Cheers,
- Ole

CURRENT
     /**
      * Check if a matrix is multiplication compatible with the instance.
      *
      * @param m
      *            Matrix to check.
      * @throws DimensionMismatchException
      *             if the matrix is not multiplication-compatible with instance.
      */
     protected void checkMultiplicationCompatible(final FieldMatrix<T> m) throws DimensionMismatchException
{
         if (getColumnDimension() != m.getRowDimension()) {
             throw new DimensionMismatchException(m.getRowDimension(), getColumnDimension());
         }
     }

PROPOSED

     /**
      * Check if a matrix is multiplication compatible with the instance.
      *
      * @param m
      *            Matrix to check.
      * @return true if the matrix is multiplication compatible, false otherwise.
      */
     protected boolean checkMultiplicationCompatible(final FieldMatrix<T> m) {
         if (getColumnDimension() != m.getRowDimension()) {
             return false;
         }
         return true;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message