def sample(self, number, lazy_update_gap=None, same_length=False):
self.update_now(lazy_update_gap)
arz = self.randn(number, self.dimension)
if same_length:
if same_length is True:
len_ = self.chiN
else:
len_ = same_length # presumably N**0.5, useful if self.opts['CSA_squared']
for i in rglen(arz):
ss = sum(arz[i]**2)
if 1 < 3 or ss > self.N + 10.1:
arz[i] *= len_ / ss**0.5
# or to average
# arz *= 1 * self.const.chiN / np.mean([sum(z**2)**0.5 for z in arz])
ary = np.dot(self.B, (self.D * arz).T).T
# self.ary = ary # needed whatfor?
return ary
评论列表
文章目录