Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
47fe571f
Commit
47fe571f
authored
Jun 22, 2018
by
Philipp Arras
Browse files
Cleanup
parent
a5b955e5
Pipeline
#31644
failed with stages
in 3 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/models/constant.py
View file @
47fe571f
...
...
@@ -20,6 +20,7 @@ from .model import Model
class
Constant
(
Model
):
# TODO Remove position
def
__init__
(
self
,
position
,
constant
):
super
(
Constant
,
self
).
__init__
(
position
)
self
.
_constant
=
constant
...
...
nifty5/models/model.py
View file @
47fe571f
...
...
@@ -16,10 +16,11 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from
..field
import
Field
from
..multi
import
MultiField
from
..operators.selection_operator
import
SelectionOperator
from
..
operators.diagonal_operator
import
DiagonalOperator
from
..
sugar
import
makeOp
from
..utilities
import
NiftyMetaBase
from
..field
import
Field
class
Model
(
NiftyMetaBase
()):
...
...
@@ -49,7 +50,7 @@ class Model(NiftyMetaBase()):
if
isinstance
(
other
,
Model
):
from
.binary_helpers
import
Add
return
Add
.
make
(
self
,
other
)
if
isinstance
(
other
,
Field
):
if
isinstance
(
other
,
(
Field
,
MultiField
)
):
from
.constant
import
Constant
return
self
.
__add__
(
Constant
(
self
.
position
,
other
))
raise
TypeError
...
...
@@ -64,8 +65,8 @@ class Model(NiftyMetaBase()):
if
isinstance
(
other
,
Model
):
from
.binary_helpers
import
Mul
return
Mul
.
make
(
self
,
other
)
if
isinstance
(
other
,
Field
):
return
DiagonalOperator
(
other
)(
self
)
if
isinstance
(
other
,
(
Field
,
MultiField
)
):
return
makeOp
(
other
)(
self
)
raise
NotImplementedError
def
__rmul__
(
self
,
other
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment