@Override
 public double residual(final Object b, final Dataset w, boolean ignoreNaNs) {
   Dataset bds = b instanceof Dataset ? (Dataset) b : DatasetFactory.createFromObject(b);
   final BroadcastIterator it = BroadcastIterator.createIterator(this, bds);
   double sum = 0;
   {
     if (w == null) {
       while (it.hasNext()) {
         if (data[it.aIndex] ^ bds.getElementBooleanAbs(it.bIndex)) sum++;
       }
     } else {
       IndexIterator itw = w.getIterator();
       double comp = 0;
       while (it.hasNext() && itw.hasNext()) {
         if (data[it.aIndex] ^ bds.getElementBooleanAbs(it.bIndex)) {
           final double err = w.getElementDoubleAbs(itw.index) - comp;
           final double temp = sum + err;
           comp = (temp - sum) - err;
           sum = temp;
         }
       }
     }
   }
   return sum;
 }
 /** AND */
 @Override
 public BooleanDataset imultiply(final Object b) {
   Dataset bds = b instanceof Dataset ? (Dataset) b : DatasetFactory.createFromObject(b);
   final BroadcastIterator it = BroadcastIterator.createIterator(this, bds);
   while (it.hasNext()) {
     data[it.aIndex] &= bds.getElementBooleanAbs(it.bIndex);
   }
   setDirty();
   return this;
 }