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
Open sidebar
Neel Shah
NIFTy
Commits
49074cd1
Commit
49074cd1
authored
Apr 02, 2020
by
Martin Reinecke
Browse files
small improvements
parent
85cb31fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty6/linearization.py
View file @
49074cd1
...
...
@@ -156,6 +156,7 @@ class Linearization(Operator):
return
self
.
new
(
self
.
_val
-
other
,
self
.
_jac
,
self
.
_metric
)
else
:
return
self
.
new
(
self
.
_val
+
other
,
self
.
_jac
,
self
.
_metric
)
raise
RuntimeError
(
"must not get here"
)
def
__add__
(
self
,
other
):
return
self
.
_myadd
(
other
,
False
)
...
...
nifty6/utilities.py
View file @
49074cd1
...
...
@@ -27,6 +27,16 @@ __all__ = ["get_slice_list", "safe_cast", "parse_spaces", "infer_space",
"my_product"
,
"frozendict"
,
"special_add_at"
,
"iscomplextype"
]
def
assertValue
(
cond
,
msg
):
if
not
cond
:
raise
ValueError
(
msg
)
def
assertType
(
cond
,
msg
):
if
not
cond
:
raise
TypeError
(
msg
)
def
my_sum
(
iterable
):
return
reduce
(
lambda
x
,
y
:
x
+
y
,
iterable
)
...
...
Write
Preview
Supports
Markdown
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