inline void bi::SparseStaticUpdaterVisitorHost<B,S,L,PX,OX>::accept(
    State<B,ON_HOST>& s, const Mask<L>& mask, const int p, const PX& pax,
    OX& x) {
  typedef typename front<S>::type front;
  typedef typename pop_front<S>::type pop_front;
  typedef typename front::target_type target_type;
  typedef typename front::coord_type coord_type;

  const int id = var_id<target_type>::value;
  int ix = 0;
  coord_type cox;

  if (mask.isDense(id)) {
    while (ix < mask.getSize(id)) {
      front::simulates(s, p, ix, cox, pax, x);
      ++cox;
      ++ix;
    }
  } else if (mask.isSparse(id)) {
    while (ix < mask.getSize(id)) {
      cox.setIndex(mask.getIndex(id, ix));
      front::simulates(s, p, ix, cox, pax, x);
      ++ix;
    }
  }

  SparseStaticUpdaterVisitorHost<B,pop_front,L,PX,OX>::accept(s, mask, p, pax,
      x);
}
inline void bi::SparseStaticUpdaterMatrixVisitorHost<B,S,L,PX,OX>::accept(
    State<B,ON_HOST>& s, const Mask<L>& mask, const int p, const PX& pax,
    OX& x) {
  typedef typename front<S>::type front;
  typedef typename pop_front<S>::type pop_front;
  typedef typename front::target_type target_type;

  const int id = var_id<target_type>::value;

  if (mask.isDense(id)) {
    front::simulates(s, p, pax, x);
  } else if (mask.isSparse(id)) {
    BI_ASSERT_MSG(false, "Cannot do sparse update with matrix expression");
  }
  SparseStaticUpdaterMatrixVisitorHost<B,pop_front,L,PX,OX>::accept(s, mask,
      p, pax, x);
}