def __mul__(self, fact):
"""Multiply ``MPArray`` by a scalar.
.. todo:: These could be made more stable by rescaling all
non-normalized tens
"""
if np.isscalar(fact):
lcanon, rcanon = self.canonical_form
ltens = self._lt
ltens_new = it.chain(ltens[:lcanon], [fact * ltens[lcanon]],
ltens[lcanon + 1:])
return type(self)(LocalTensors(ltens_new, cform=(lcanon, rcanon)))
raise NotImplementedError("Multiplication by non-scalar not supported")
评论列表
文章目录