def multiply_C(self, factor):
"""multiply ``self.C`` with ``factor`` updating internal states.
``factor`` can be a scalar, a vector or a matrix. The vector
is used as outer product and multiplied element-wise, i.e.,
``multiply_C(diag(C)**-0.5)`` generates a correlation matrix.
Details:
"""
self._updateC()
if np.isscalar(factor):
self.C *= factor
self.D *= factor**0.5
try:
self.inverse_root_C /= factor**0.5
except AttributeError:
pass
elif len(np.asarray(factor).shape) == 1:
self.C *= np.outer(factor, factor)
self._decompose_C()
elif len(factor.shape) == 2:
self.C *= factor
self._decompose_C()
else:
raise ValueError(str(factor))
# raise NotImplementedError('never tested')
评论列表
文章目录