How to use the ert.util.Matrix function in ert

To help you get started, weâ€™ve selected a few ert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

Ensembles / ert / devel / python / python / ert / util / stat.py View on Github
``````def polyfit(n, x, y, s=None):
"""
@type n: int
@type x: Matrix or Sequence
@type y: Matrix or Sequence
@type s: Matrix or Sequence or None
@return: tuple
"""
if _polyfit is None:
raise NotImplementedError("Sorry - your ert distribution has been built without lapack support")

if isinstance(x, Matrix):
xm = x
else:
xm = Matrix(len(x), 1)
for i in range(len(x)):
xm[i, 0] = x[i]

if isinstance(y, Matrix):
ym = y
else:
ym = Matrix(len(y), 1)
for i in range(len(y)):
ym[i, 0] = y[i]

if s:
if isinstance(s, Matrix):
sm = s``````
Ensembles / ert / devel / python / python / ert / util / stat.py View on Github
``````def polyfit(n, x, y, s=None):
"""
@type n: int
@type x: Matrix or Sequence
@type y: Matrix or Sequence
@type s: Matrix or Sequence or None
@return: tuple
"""
if _polyfit is None:
raise NotImplementedError("Sorry - your ert distribution has been built without lapack support")

if isinstance(x, Matrix):
xm = x
else:
xm = Matrix(len(x), 1)
for i in range(len(x)):
xm[i, 0] = x[i]

if isinstance(y, Matrix):
ym = y
else:
ym = Matrix(len(y), 1)
for i in range(len(y)):
ym[i, 0] = y[i]

if s:
if isinstance(s, Matrix):
sm = s
else:
sm = Matrix(len(s), 1)
for i in range(len(s)):``````
OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / ecl / faults / fault.py View on Github
``````def __sortFaultLines(self):
N = len(self.__fault_lines)
x = Matrix(N , 1)
y = Matrix(N , 1)

for index,line in enumerate(self.__fault_lines):
xc,yc = line.center()

x[index,0] = xc
y[index,0] = yc

# y = beta[0] + beta[1] * x
#   = a       + b * x
beta = stat.polyfit(2 , x , y)
a = beta[0]
b = beta[1]

perm_list = []
for index,line in enumerate(self.__fault_lines):``````
Ensembles / ert / devel / python / python / ert / util / stat.py View on Github
``````xm = Matrix(len(x), 1)
for i in range(len(x)):
xm[i, 0] = x[i]

if isinstance(y, Matrix):
ym = y
else:
ym = Matrix(len(y), 1)
for i in range(len(y)):
ym[i, 0] = y[i]

if s:
if isinstance(s, Matrix):
sm = s
else:
sm = Matrix(len(s), 1)
for i in range(len(s)):
sm[i, 0] = s[i]
else:
sm = s

beta = Matrix(n, 1)
res = _polyfit(beta, xm, ym, sm)

if not res == LLSQResultEnum.LLSQ_SUCCESS:
raise Exception("Linear Least Squares Estimator failed?")

l = []
for i in range(n):
l.append(beta[i, 0])

return tuple(l)``````
Ensembles / ert / python / python / ert / enkf / obs_data.py View on Github
``````def scale(self, S, E=None, D=None, R=None, D_obs=None):
assert isinstance(S, Matrix)
for X in (E,D,R,D_obs):
if X is not None:
assert isinstance(X, Matrix)
self._scale(S, E, D, R, D_obs)``````
Ensembles / ert / python / python / ert / enkf / enkf_linalg.py View on Github
``````def calculatePrincipalComponents(cls, S0, D_obs, truncation, ncomp, PC, PC_obs, singular_values):
assert isinstance(S0, Matrix)
assert isinstance(D_obs, Matrix)
assert isinstance(truncation, (float, int))
assert isinstance(ncomp, int)
assert isinstance(PC, Matrix)
assert isinstance(PC_obs, Matrix)
assert isinstance(singular_values , DoubleVector)

cls._get_PC(S0, D_obs, truncation, ncomp, PC, PC_obs , singular_values)``````
Ensembles / ert / python / python / ert / enkf / plot_data / pca_plot_data.py View on Github
``````def __init__(self, name, principal_component_matrix, observation_principal_component_matrix, singular_values):
assert isinstance(name, str)
assert isinstance(principal_component_matrix, Matrix)
assert isinstance(observation_principal_component_matrix, Matrix)

c_pointer = self._alloc(name, principal_component_matrix, observation_principal_component_matrix , singular_values)
super(PcaPlotData, self).__init__(c_pointer)``````
Ensembles / ert / devel / python / python / ert / enkf / plot_data / pca_plot_data.py View on Github
``````def __init__(self, name, principal_component_matrix, observation_principal_component_matrix):
assert isinstance(name, str)
assert isinstance(principal_component_matrix, Matrix)
assert isinstance(observation_principal_component_matrix, Matrix)

c_pointer = PcaPlotData.cNamespace().alloc(name, principal_component_matrix, observation_principal_component_matrix)
super(PcaPlotData, self).__init__(c_pointer)``````
Ensembles / ert / devel / python / python / ert / enkf / plot_data / pca_plot_vector.py View on Github
``````def __init__(self, component, principal_component_matrix, observation_principal_component_matrix):
assert isinstance(component, int)
assert isinstance(principal_component_matrix, Matrix)
assert isinstance(observation_principal_component_matrix, Matrix)

c_pointer = PcaPlotVector.cNamespace().alloc(component, principal_component_matrix, observation_principal_component_matrix)
super(PcaPlotVector, self).__init__(c_pointer)``````
Ensembles / ert / python / python / ert / enkf / obs_data.py View on Github
``````def scale(self, S, E=None, D=None, R=None, D_obs=None):
assert isinstance(S, Matrix)
for X in (E,D,R,D_obs):
if X is not None:
assert isinstance(X, Matrix)
self._scale(S, E, D, R, D_obs)``````

ert

Ensemble based Reservoir Tool (ERT)

GPL-3.0