This should be done via the xoptional assembly proposed in https://github.com/QuantStack/xtensor/issues/238.