// sucks, but so does the visitor pattern.  not often used.
 public void plusEquals(ConstantMatrix m, double factor) {
   if (m instanceof SparseVector) {
     values.plusEqualsSparse((SparseVector) m, factor);
   } else if (m instanceof SparseMatrixn) {
     SparseMatrixn smn = (SparseMatrixn) m;
     if (Arrays.equals(sizes, smn.sizes)) {
       values.plusEqualsSparse(smn.values, factor);
     } else {
       throw new UnsupportedOperationException("sizes of " + m + " do not match " + this);
     }
   } else {
     throw new UnsupportedOperationException("Can't add " + m + " to " + this);
   }
 }