本文整理汇总了Python中ert.util.Matrix.randomInit方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.randomInit方法的具体用法?Python Matrix.randomInit怎么用?Python Matrix.randomInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.util.Matrix
的用法示例。
在下文中一共展示了Matrix.randomInit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from ert.util import Matrix [as 别名]
# 或者: from ert.util.Matrix import randomInit [as 别名]
def update(rng , mask , module , ert , meas_data , obs_data , state_size):
S = meas_data.createS()
R = obs_data.createR()
dObs = obs_data.createDObs()
E = obs_data.createE( rng , meas_data.getActiveEnsSize() )
D = obs_data.createD(E , S)
obs_data.scale(S , E = E , D = D , R = R , D_obs = dObs)
A = Matrix(state_size , meas_data.getActiveEnsSize())
A.randomInit( rng )
module.initUpdate( mask , S , R , dObs , E , D )
module.updateA( A , S , R , dObs , E , D )
示例2: test_matrix_copy_column
# 需要导入模块: from ert.util import Matrix [as 别名]
# 或者: from ert.util.Matrix import randomInit [as 别名]
def test_matrix_copy_column(self):
m = Matrix(10,2)
rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT)
m.randomInit( rng )
with self.assertRaises(ValueError):
m.copyColumn(0,2)
with self.assertRaises(ValueError):
m.copyColumn(2,0)
with self.assertRaises(ValueError):
m.copyColumn(-2,0)
m.copyColumn(1, 0)
for i in range(m.rows()):
self.assertEqual( m[i,0] , m[i,1] )
示例3: test_sub_copy
# 需要导入模块: from ert.util import Matrix [as 别名]
# 或者: from ert.util.Matrix import randomInit [as 别名]
def test_sub_copy(self):
m1 = Matrix(3,3)
rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT)
m1.randomInit( rng )
with self.assertRaises(ValueError):
m2 = m1.subCopy( 0,0,4,2 )
with self.assertRaises(ValueError):
m2 = m1.subCopy( 0,0,2,4 )
with self.assertRaises(ValueError):
m2 = m1.subCopy( 4,0,1,1 )
with self.assertRaises(ValueError):
m2 = m1.subCopy( 0,2,1,2 )
m2 = m1.subCopy( 0,0,2,2 )
for i in range(2):
for j in range(2):
self.assertEqual( m1[i,j] , m2[i,j])
示例4: test_matrix_random_init
# 需要导入模块: from ert.util import Matrix [as 别名]
# 或者: from ert.util.Matrix import randomInit [as 别名]
def test_matrix_random_init(self):
m = Matrix(10,10)
rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT)
m.randomInit( rng )