def add(self, other, idx):
if other.ndim == 2 and self.ndim == 1:
self = KernelMatrix(np.diag(self))
if self.ndim == 1:
self[idx] += other
else:
if other.ndim == 1:
self[idx, idx] += other
else:
self._setcliques(idx)
idx = ((idx, idx) if isinstance(idx, slice)
else (idx[:, None], idx))
self[idx] += other
return self
评论列表
文章目录