Skip to content

Commit

Permalink
add LinearModelling operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Günther authored and Thomas Günther committed Jun 3, 2022
1 parent d5d11bf commit 422700f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pygimli/frameworks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


from .modelling import (Modelling, Block1DModelling, MeshModelling,
JointModelling, PriorModelling,
JointModelling, PriorModelling, LinearModelling,
PetroModelling, LCModelling, ParameterModelling)

from .inversion import (Inversion, MarquardtInversion,
Expand Down
22 changes: 22 additions & 0 deletions pygimli/frameworks/modelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,28 @@ def drawData(self, ax, data, **kwargs):
raise Exception("No yet implemented")


class LinearModelling(Modelling):
"""Modelling class for linearized problems with a given matrix."""
def __init__(self, A):
"""Initialize by storing the (reference to the) matrix."""
super().__init__()
self.A = A
self.setJacobian(self.A)

def response(self, model):
"""Linearized forward modelling by matrix-vector product."""
return self.A * model

def createJacobian(self, model):
"""Do not compute a jacobian (linear)."""
pass

@property
def parameterCount(self):
"""Define the number of parameters from the matrix size."""
return self.A.cols()


class Block1DModelling(Modelling):
"""General forward operator for 1D layered models.
Expand Down

0 comments on commit 422700f

Please sign in to comment.