def block_cat(self, Y0, Y1):
"""Concatenate components corresponding to Y0 and Y1 blocks
into Y.
"""
# Axes are swapped here for similar reasons to those
# motivating swapping in cbpdn.ConvTwoBlockCnstrnt.block_cat
Y1sa = np.swapaxes(Y1, self.cri.axisM, -1)[..., 0]
# If cri.Cd > 1 (multi-channel dictionary) Y0 has a singleton
# channel axis but Y1 has a non-singleton channel axis. To make
# it possible to concatenate Y0 and Y1, we reshape Y1 by a
# partial ravel of axisM and axisC onto axisM.
if self.cri.Cd > 1:
shp = list(Y1sa.shape)
shp[self.cri.axisM] *= shp[self.cri.axisC]
shp[self.cri.axisC] = 1
Y1sa = Y1sa.reshape(shp)
return np.concatenate((Y0, Y1sa), axis=self.cri.axisM)
评论列表
文章目录