本文整理汇总了Python中pysgpp.DataVector.componentwise_div方法的典型用法代码示例。如果您正苦于以下问题:Python DataVector.componentwise_div方法的具体用法?Python DataVector.componentwise_div怎么用?Python DataVector.componentwise_div使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysgpp.DataVector
的用法示例。
在下文中一共展示了DataVector.componentwise_div方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testOps
# 需要导入模块: from pysgpp import DataVector [as 别名]
# 或者: from pysgpp.DataVector import componentwise_div [as 别名]
def testOps(self):
from pysgpp import DataVector
# sum
self.assertAlmostEqual(self.d_rand.sum(), sum(self.l_rand_total))
# sqr
d = DataVector(self.d_rand)
d.sqr()
for i in xrange(self.N):
self.assertEqual(self.d_rand[i]**2, d[i])
# abs
d = DataVector(self.d_rand)
d.abs()
for i in xrange(self.N):
self.assertEqual(abs(self.d_rand[i]), d[i])
# componentwise_mult
d = DataVector(self.d_rand)
# d2 = DataVector(self.nrows, self.ncols)
d2 = DataVector(self.N)
for i in xrange(self.N):
d2[i] = i
d.componentwise_mult(d2)
for i in xrange(self.N):
self.assertEqual(self.d_rand[i]*i, d[i])
# componentwise_div
d = DataVector(self.d_rand)
for i in xrange(self.N):
d2[i] = i+1
d.componentwise_div(d2)
for i in xrange(self.N):
self.assertEqual(self.d_rand[i]/(i+1), d[i])